ToolCoder: A Systematic Code-Empowered Tool Learning Framework for Large Language Models
Hanxing Ding, Shuchang Tao, Liang Pang, Zihao Wei, Jinyang Gao, Bolin Ding, Huawei Shen, Xueqi Cheng
摘要
Tool learning has emerged as a crucial capability for large language models (LLMs) to solve complex real-world tasks through interaction with external tools. Existing approaches face significant challenges, including reliance on hand-crafted prompts, difficulty in multistep planning, and lack of precise error diagnosis and reflection mechanisms. We propose ToolCoder, a novel framework that reformulates tool learning as a code generation task. Inspired by software engineering principles, ToolCoder transforms natural language queries into structured Python function scaffold and systematically breaks down tasks with descriptive comments, enabling LLMs to leverage coding paradigms for complex reasoning and planning. It then generates and executes function implementations to obtain final responses. Additionally, ToolCoder stores successfully executed functions in a repository to promote code reuse, while leveraging error traceback mechanisms for systematic debugging, optimizing both execution efficiency and robustness. Experiments demonstrate that ToolCoder achieves superior performance in task completion accuracy and execution reliability compared to existing approaches, establishing the effectiveness of code-centric approaches in tool learning. Our code is available at this link. Limitations of Existing Approaches When is the birthday of the director of The Shawshank Redemption?
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 3 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsets 引用了 MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language Feedback
- CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsets 引用了 Executable Code Actions Elicit Better LLM Agents
- MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language Feedback 引用了 Executable Code Actions Elicit Better LLM Agents
- MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language Feedback 引用了 Chameleon: Plug-and-Play Compositional Reasoning with Large Language Models
- CoEvolve: Training LLM Agents via Agent-Data Mutual Evolution 引用了 Reflexion: language agents with verbal reinforcement learning
引用它的顶会 Paper3
- Latent Collaboration in Multi-Agent SystemsJiaru Zou, Xiyuan Yang, Ruizhong Qiu, Gaotang Li 等ICML 2026 · 42 次引用
- Attractive Metadata Attack: Inducing LLM Agents to Invoke Malicious ToolsKanghua Mo, Li Hu, Yucheng Long, Zhihao LiNeurIPS 2025 · 37 次引用
- CoEvolve: Training LLM Agents via Agent-Data Mutual EvolutionShidong Yang, Ziyu Ma, Tongwen Huang, Yiming Hu 等ACL 2026 · 6 次引用
它引用的 Paper12
- Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan 等NeurIPS 2023 · 5,828 次引用
- Chameleon: Plug-and-Play Compositional Reasoning with Large Language ModelsPan Lu, Baolin Peng, Hao Cheng, Michel Galley 等NeurIPS 2023 · 515 次引用
- Executable Code Actions Elicit Better LLM AgentsXingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang 等ICML 2024 · 436 次引用
- MINT: Evaluating LLMs in Multi-turn Interaction with Tools and Language FeedbackXingyao Wang, Zihan Wang, Jiateng Liu, Yangyi Chen 等ICLR 2024 · 308 次引用
- CRAFT: Customizing LLMs by Creating and Retrieving from Specialized ToolsetsLifan Yuan, Yangyi Chen, Xingyao Wang, Yi Fung 等ICLR 2024 · 117 次引用
相关 Paper
- Tool-Planner: Task Planning with Clusters across Multiple ToolsYanming Liu, Xinyue Peng, Jiannan Cao, Shi Bo 等ICLR 2025
- MapCoder: Multi-Agent Code Generation for Competitive Problem SolvingMd. Ashraful Islam, Mohammed Eunus Ali, Md. Rizwan ParvezACL 2024 · 29 次引用
- From Exploration to Mastery: Enabling LLMs to Master Tools via Self-Driven InteractionsChangle Qu, Sunhao Dai, Xiaochi Wei, Hengyi Cai 等ICLR 2025
- A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven RefinementHuan Zhang, Wei Cheng, Yuhan Wu, Wei HuASE 2024 · 7 次引用
- ToolWeaver: Weaving Collaborative Semantics for Scalable Tool Use in Large Language ModelsBowen Fang, Wen Ye, Yunyue Su, Jinghao Zhang 等ICLR 2026
