Abstract
Large Language Models (LLMs) have recently demonstrated strong capabilities in tool use, yet progress in tool retrieval remains hindered by incomplete and heterogeneous tool documentation. To address this challenge, we introduce Tool-DE, a new benchmark and framework that systematically enriches tool documentation with structured fields to enable more effective tool retrieval, together with two dedicated models, Tool-Embed and Tool-Rank. We design a scalable document expansion pipeline that leverages both open- and closed-source LLMs to generate, validate, and refine enriched tool profiles at low cost, producing large-scale corpora with 50k instances for embedding-based retrievers and 200k for rerankers. On top of this data, we develop two models specifically tailored for tool retrieval: Tool-Embed, a dense retriever, and Tool-Rank, an LLM-based reranker. Extensive experiments on ToolRet and Tool-DE demonstrate that document expansion substantially improves retrieval performance, with Tool-Embed and Tool-Rank achieving new state-of-the-art results on both benchmarks. Overall, our findings highlight both the promise and limitations of LLM-driven document expansion, positioning Tool-DE as a foundation for future research in tool retrieval.
Introduction
While Large Language Models (LLMs) have become remarkably adept at executing tool-based tasks (APIs), they frequently stumble at the first hurdle: retrieval. When an AI agent is presented with a library of thousands of potential APIs, identifying the precise tool required for a user's query is the critical gateway to success.
The primary bottleneck in this process is not necessarily the retrieval algorithms, but the documentation itself. Current tool libraries suffer from a significant "semantic gap." Technical documentation is often inconsistent, incomplete, or lacks the context of why or when a human would actually use the tool. For instance, a user might request "latest movies," while the technical documentation only specifies GET /v1/films. Without a bridge between user intent and technical specifications, even sophisticated retrievers fail to make the connection.
The Tool-DE Framework
To bridge this semantic gap, we propose Tool-DE (Tool-Document Expansion), a data-centric framework designed to enrich tool descriptions with structured, human-centric fields. We developed a scalable, four-stage pipeline to ensure the generated documentation is both comprehensive and faithful to the original technical specifications.
The Expansion Pipeline
- Expansion: Utilizing Qwen3-32B, we generate structured fields including
function_description,tags,when_to_use,limitations, andexample_usage. - Judgement: LLaMA-3.1-70B serves as a "semantic judge" to verify that the generated fields remain faithful to the original technical documentation.
- Refinement: Any instances that fail the judgement phase are routed to GPT-4o for high-reasoning correction.
- Human Validation: A final layer of expert human review ensures the robustness of the entire pipeline.
Specialized Retrieval Models
Leveraging this enriched data, we trained two specialized models:
- Tool-Embed: A dense retriever (based on Qwen3-Embedding) trained on 50,000 expanded instances.
- Tool-Rank: An LLM-based reranker (based on Qwen3-Reranker) trained on 200,000 instances.
This work is evaluated on ToolRet, a unified collection of 35 tool-use datasets covering Web APIs, code functions, and customized applications. We also introduce the Tool-DE Benchmark, the first benchmark specifically dedicated to document-expanded tool retrieval.
Key Insights and Analysis
Our analysis reveals several critical findings regarding how document expansion affects retrieval dynamics:
- The Dominance of "When-to-Use": Ablation studies indicate that the
when_to_usefield provides the most significant boost to retrieval performance. This field effectively bridges the gap between abstract technical functions and concrete user scenarios. - The Risk of Semantic Dilution: Interestingly, including
example_usage(actual code snippets) can sometimes degrade performance. The specific syntax of code can distract the model from the broader functional intent, a phenomenon we term "semantic dilution." - Asymmetric Separability: Document expansion increases the "gap" between relevant and irrelevant tools. While expansion makes positive matches slightly less similar (due to increased text length), it makes negative matches significantly less similar, as shown in Figure 5. This increased separability makes the reranker's task substantially easier.
Performance Results
The results demonstrate that high-quality data can outperform sheer model scale:
- State-of-the-Art Performance: Tool-Embed and Tool-Rank achieved new SOTA results on both the ToolRet and Tool-DE benchmarks.
- Significant Gains: On the Tool-DE benchmark, our models achieved 56.44 NDCG@10, an improvement of +10.23 over the previous leading open-source models on the MTEB leaderboard.
- Efficiency: Our 0.6B parameter model (Tool-Embed-0.6B) outperformed baseline models with 8B parameters, proving that enriched documentation allows for more efficient, smaller-scale retrieval solutions.
Conclusion and Future Work
While Tool-DE significantly advances tool retrieval, challenges remain. As documentation grows longer, it risks hitting the context window limits of embedding models, potentially losing technical details. Future research could explore "query-aware" expansion, where documentation is dynamically highlighted or summarized based on specific user queries. Furthermore, while our multi-stage validation minimizes hallucinations, ensuring LLMs do not invent non-existent tool capabilities remains a priority for fully automated systems.
Summary updated