Abstract
As Large Language Model (LLM) agents scale to utilize thousands of specialized tools, efficient and accurate tool retrieval becomes a critical bottleneck. Existing supervised methods struggle with evolving toolsets and ambiguous user queries. We present Re-Invoke, a zero-shot, unsupervised framework that enhances tool retrieval by bridging the semantic gap between technical documentation and user intent. Re-Invoke employs an offline Query Generator to expand tool indices with synthetic user queries and an online Intent Extractor to distill core tasks from verbose user requests. Evaluated on ToolBench and ToolE, Re-Invoke achieves up to a 39% improvement in retrieval accuracy for complex multi-tool tasks, demonstrating robust performance across various backbone LLMs without requiring labeled training data.
Introduction
The transition of LLM-based agents from simple conversational interfaces to autonomous assistants necessitates the ability to navigate vast tool registries. Modern systems are scaling to accommodate thousands of APIs, such as ChatGPT plugins or cloud services, creating a "Tool Retrieval Bottleneck." Current retrieval paradigms face three primary challenges: the inability to fit massive toolsets into a single prompt, the high cost of retraining supervised retrievers for evolving toolsets, and the inherent ambiguity of user intent. For instance, a user request containing significant background context may mislead standard retrievers into selecting tools based on irrelevant keywords rather than the actionable task.
Methodology
Re-Invoke addresses these challenges through a three-stage unsupervised pipeline designed to align tool documentation with human query patterns.
1. Offline Query Generation
To bridge the semantic gap between technical API documentation and natural language queries, Re-Invoke utilizes an LLM to "hallucinate" potential user queries for each tool. By generating diverse synthetic queries that a tool could potentially answer, the framework creates a user-centric index. This approach ensures that the retriever matches against how humans actually ask for assistance rather than relying solely on developer-centric documentation.
2. Online Intent Extraction
During inference, user queries are often verbose or contain multiple distinct goals. Re-Invoke employs an LLM-based Intent Extractor to act as a query analyzer. This component strips away irrelevant "noise" and decomposes complex requests into distinct sub-queries, ensuring the retriever focuses on the core actionable intents.
3. Multi-view Similarity Ranking
Rather than a simple vector search, Re-Invoke implements a novel ranking strategy. It calculates similarity scores for each extracted intent against the expanded tool index. A tuple-based ordering system, combining rank and similarity, is used to ensure that all components of a multi-tool request are adequately satisfied in the final retrieved set.
Experimental Evaluation
The framework was evaluated on two major benchmarks: ToolBench, featuring over 16,000 real-world APIs, and ToolE, which focuses on challenging single-tool and multi-tool scenarios.
Key Results
Re-Invoke demonstrated significant performance gains over standard dense retrieval and BM25 baselines across multiple metrics. On the ToolE dataset, the framework achieved a 20% relative improvement in nDCG@5 for single-tool retrieval and a 39% improvement for multi-tool tasks.
Furthermore, end-to-end testing with the ToolLLaMA agent showed that improved retrieval directly correlates with higher task completion "pass rates." The system proved versatile, maintaining high performance across different backbone models, including GPT-3.5, Mistral-7B, and Vertex AI's text-bison.
Discussion and Insights
A key finding of this work is that "thinking like a user" is more effective than "reading the manual." While popular techniques like Hypothetical Document Embeddings (HyDE) often fail in tool retrieval due to the wide gap between hallucinated and technical documentation, Re-Invoke’s strategy of hallucinating the query effectively bridges this divide.
However, limitations remain. The Intent Extractor introduces additional latency and cost due to the extra LLM call during inference. Additionally, the system can still struggle to distinguish between tools with highly similar documentation, such as those for renting versus purchasing property. Future work will focus on distilling these capabilities into smaller models and refining query generation to better highlight subtle tool differences.
Conclusion
Re-Invoke provides a robust, zero-shot solution to the tool retrieval bottleneck. By leveraging LLMs to rewrite both tool indices and user queries, it enables agents to navigate large-scale toolsets with unprecedented accuracy and flexibility, paving the way for more capable and autonomous AI assistants.
Summary updated