arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.01030cs.CLcs.AI
收藏

可执行代码动作激发更优的LLM智能体

Executable Code Actions Elicit Better LLM Agents

University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Apple(苹果公司)

Xingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang, Yunzhu Li, Hao Peng, Heng Ji

AI总结:

本文提出CodeAct方法,用可执行Python代码统一LLM智能体的动作空间,突破JSON格式在动作范围和组合灵活性上的限制,并构建CodeActInstruct数据集与CodeActAgent开源智能体,在API-Bank等基准上成功率最高提升20%。

摘要:

大型语言模型(LLM)智能体能够执行广泛的动作,如调用工具和控制机器人,在应对现实世界挑战方面展现出巨大潜力。LLM智能体通常被提示以预定义格式生成JSON或文本来产生动作,这通常受限于受限的动作空间(例如预定义工具的范围)和有限的灵活性(例如无法组合多个工具)。本文提出使用可执行的Python代码将LLM智能体的动作整合到一个统一的动作空间(CodeAct)中。CodeAct与Python解释器集成后,可以执行代码动作,并在多轮交互中根据新的观察动态修正先前的动作或发出新的动作。我们在API-Bank和一个新构建的基准上对17个LLM进行了广泛分析,结果表明CodeAct优于广泛使用的替代方案(成功率最高提升20%)。CodeAct令人鼓舞的性能促使我们构建一个开源的LLM智能体,它通过执行可解释的代码与环境交互,并使用自然语言与用户协作。为此,我们收集了一个指令微调数据集CodeActInstruct,其中包含使用CodeAct的7k次多轮交互。我们证明它可以与现有数据结合使用,在不损害模型通用能力的情况下提升其在智能体导向任务中的表现。CodeActAgent基于Llama2和Mistral微调而来,与Python解释器集成,并经过独特定制,能够利用现有库执行复杂任务(例如模型训练)并自主进行自我调试。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑