Executable Code Actions Elicit Better LLM Agents
By Xingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang, Yunzhu Li, Hao Peng, Heng Ji. International Conference on Machine Learning, 2024
551 citations recorded by the source corpus.
Large Language Model (LLM) agents, capable of performing a broad range of actions, such as invoking tools and controlling robots, show great potential in tackling real-world challenges. LLM agents are typically prompted to produce actions by generating JSON or text in a pre-defined format, which is usually limited by constrained action space (e.g., the scope of pre-defined tools) and restricted flexibility (e.g., inability to compose multiple tools). This work proposes to use executable Python code to consolidate LLM agents' actions into a unified action space (CodeAct). Integrated with a Python interpreter, CodeAct can execute code actions and dynamically revise prior actions or emit new actions upon new observations through multi-turn interactions. Our extensive analysis of 17 LLMs on API-Bank and a newly curated benchmark shows that CodeAct outperforms widely used alternatives (up to 20% higher success rate). The encouraging performance of CodeAct motivates us to build an open-source LLM agent that interacts with environments by executing interpretable code and collaborates with users using natural language. To this end, we collect an instruction-tuning dataset CodeActInstruct that consists of 7k multi-turn interactions using CodeAct. We show that it can be used with existing data to improve models in agent-oriented tasks without compromising their general capability. CodeActAgent, finetuned from Llama2 and Mistral, is integrated with Python interpreter and uniquely tailored to perform sophisticated tasks (e.g., model training) using existing libraries and autonomously self-debug.
Subfields: Information Systems
View Paper: https://www.semanticscholar.org/paper/78fbb6e7a1c568a04e8c935aa9909d0c942ea5f6
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Information Systems
Citations in the corpus
- A Survey on Large Language Models for Code Generation (2024, unknown): “Finally, for the model’s good and reliable performance, the paper found the following critical components: a high-quality competitive programming dataset, efficient transformer models, and large-scale sampling.”
- OpenHands: An Open Platform for AI Software Developers as Generalist Agents (2024, unknown): “6), OpenHands CodeActAgent v1.”
- MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language Feedback (2023, methodology): “We adopt code as a unified tool interface due to its flexibility and performance, as demonstrated by Wang et al. (2024).”