ToolCoder: A Systematic Code-Empowered Tool Learning Framework for Large Language Models

Hanxing Ding, Shuchang Tao, Liang Pang, Zihao Wei, Jinyang Gao +3 more
2/17/2025
cs.CL

No confident code implementation found for this paper.

Abstract

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 multi-step planning, and lack of precise error diagnosis and reflection mechanisms.

Show full abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{ding2025toolcoder,
  title  = {ToolCoder: A Systematic Code-Empowered Tool Learning Framework for Large Language Models},
  author = {Hanxing Ding and Shuchang Tao and Liang Pang and Zihao Wei and Jinyang Gao and Bolin Ding and Huawei Shen and Xueqi Cheng},
  year   = {2025},
  eprint = {2502.11404},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.11404v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.11404.svg)](https://codeofpaper.com/paper/2502.11404)

Discussion