ToolNet: Connecting Large Language Models with Massive Tools via Tool Graph

Xukun Liu, Zhiyuan Peng, Xiaoyuan Yi, Xing Xie, Lirong Xiang, Yuchen Liu, Dongkuan XuarXiv 2024 · DOI

Abstract

ToolNet is a "plug-and-play" framework designed to enable Large Language Models (LLMs) to effectively navigate and utilize massive libraries of thousands of external tools. By organizing tools into a directed graph and treating tool selection as a pathfinding problem, ToolNet overcomes the limitations of traditional in-context learning, such as token constraints and performance degradation. Experimental results demonstrate that ToolNet achieves superior accuracy while using up to 2.6x fewer tokens than traditional prompting methods.

Introduction

While LLMs are proficient at reasoning, they often struggle when integrated with a vast array of external tools. The standard approach, in-context tool learning, involves providing API descriptions directly in the prompt. However, this method faces two primary challenges: the token limit of context windows and the "hallucination tax," where performance degrades as the number of tools increases. ToolNet addresses these issues by introducing a scalable architecture that manages massive toolsets without overwhelming the model's context.

Methodology: The Tool Graph

The core innovation of ToolNet is the Tool Graph. Instead of a flat list, tools are nodes in a directed graph where weighted edges represent the probability or preference of transitioning from one tool to another.

Comparison between conventional in-context tool learning and the ToolNet framework.

Graph Navigation and Construction

At any given step, the LLM is only prompted with the "successor" tools (immediate neighbors) of the current tool in the graph. This localized view drastically reduces the number of options the LLM must consider. The graph can be initialized statically using historical tool-use trajectories or updated dynamically. An internal Evaluator scores the success of each tool-use step, allowing the system to down-weight failing edges and prioritize more effective paths. This approach relies on a Markov assumption, where the next optimal tool depends primarily on the current tool and the task state.

Experimental Evaluation

ToolNet was evaluated across five diverse benchmarks:

  • SciQA, TabMWP, and MATH: Task-specific datasets used to test resilience against noisy or irrelevant tools.
  • APIBank: A multi-task benchmark featuring 49 tools.
  • ToolBench: A large-scale "stress test" involving 3,451 real-world APIs across various domains.

Key Insights and Results

Efficiency and Scalability

Analysis of the ToolBench dataset revealed that most tools have a limited set of logical successors. ToolNet exploits this sparsity to simplify the selection process. In terms of efficiency, ToolNet used only 16.4% and 22.8% of the tokens required by the Reflexion method on TabMWP and MATH datasets, respectively.

Resilience and Dynamic Adaptation

A significant advantage of ToolNet is its ability to handle "broken" tools. In simulations where a primary API crashes, ToolNet’s dynamic scoring mechanism quickly identifies the failure and shifts preference toward fallback tools. Furthermore, the researchers observed that LLMs are more sensitive to transition weights when formatted as integers (e.g., 0 to 100) rather than decimals, leading to improved performance.

ToolNet's ability to dynamically switch from a crashed primary tool to a fallback tool based on updated scores.

Performance Gains

ToolNet achieved a minimum 10% absolute improvement in Exact Match (EM) scores over baselines like ReAct and Tree-of-Thought on SciQA and TabMWP. In the massive ToolBench environment, it achieved a higher win rate (0.75 when combined with Reflexion) than competing methods while maintaining lower token overhead.

Conclusion

ToolNet represents a shift from "one big prompt" toward a structured, map-based approach for LLM tool integration. While challenges remain—such as the "cold start" problem for new toolsets and the need for benchmarks that better reflect multi-hop tool use—ToolNet provides a robust foundation for scaling AI capabilities in tool-rich environments.

Summary updated

BibTeX
@misc{liu2024toolnet,
  author = {Xukun Liu and Zhiyuan Peng and Xiaoyuan Yi and Xing Xie and Lirong Xiang and Yuchen Liu and Dongkuan Xu},
  title = {{ToolNet: Connecting Large Language Models with Massive Tools via Tool Graph}},
  year = {2024},
  eprint = {2403.00839},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.00839},
}
Figure