Enhancing Tool Retrieval with Iterative Feedback from Large Language Models

Qiancheng Xu, Yongqi Li, Heming Xia, Wenjie Li

Introduction

Large Language Models (LLMs) have revolutionized natural language processing, yet they remain constrained by their internal knowledge and finite context windows. To address complex real-world tasks, LLMs must interact with external tools—APIs for weather, financial databases, or specialized calculators. However, as the number of available tools grows into the thousands, selecting the correct one becomes a significant challenge. This paper introduces an iterative feedback framework that leverages the reasoning capabilities of LLMs to refine tool retrieval, bridging the gap between user intent and technical API specifications.

The Retrieval Bottleneck

Traditional approaches to tool integration face three primary hurdles: scale, volatility, and semantic misalignment.

The limitations of in-context learning and fine-tuning for large-scale tool sets.
  1. Scale: The sheer volume of potential tools exceeds the context limits of most LLMs.
  2. Volatility: Tools are frequently updated or added, making constant model fine-tuning prohibitively expensive.
  3. Misalignment: Standard retrieval methods, such as BM25 or basic dense retrievers, often fail to grasp the nuances of multi-step instructions, leading to "keyword matching" that misses the functional requirement.

Methodology: The Iterative Feedback Framework

The core innovation of this work is a multi-round retrieval process that treats the LLM as an active critic rather than a passive consumer. By using the LLM to "coach" the retriever through refined queries, the system transfers high-level reasoning into the retrieval process.

The Iterative Feedback Framework: Comprehension, Assessment, and Refinement.

The framework operates in three distinct stages within each iteration:

  • Comprehension: The LLM summarizes the user's goals and analyzes the functionality of the currently retrieved candidate tools.
  • Assessment: The model evaluates whether the current toolset can solve the problem, identifying specific failures such as missing parameters or incorrect API selection.
  • Refinement: Based on the assessment, the LLM rewrites the user's instruction into a "refined instruction"—a more precise query designed to help the retriever find the correct tools in the subsequent round.

To further enhance performance, the retriever is trained using Iteration-aware tokens and Hard Negative Sampling, teaching the model to distinguish between subtly different APIs and improve its search strategy over time.

Evaluation and Results

The researchers introduced TR-bench, a comprehensive benchmark combining data from ToolBench, T-Eval, and UltraTools. The results demonstrate a significant leap in retrieval accuracy:

  • Accuracy Gains: The proposed method achieved an NDCG@1 of 88.53 on in-domain benchmarks, significantly outperforming the previous state-of-the-art (75.73).
  • Complex Scenarios: In multi-tool retrieval tasks, accuracy improved by over 30% compared to baseline models.
  • Downstream Impact: Improved retrieval directly translated to task success, with the overall "pass rate" for tool-use tasks increasing from 68.5% to 75.6%.

Discussion and Future Work

While the iterative approach provides substantial accuracy gains, it introduces a trade-off in latency due to multiple LLM calls. Future research will focus on optimizing inference speed and exploring real-time, online feedback mechanisms. Despite these challenges, the framework represents a major step toward creating AI agents that can navigate vast, dynamic tool ecosystems with human-like precision.

Summary updated

BibTeX
@inproceedings{xu2024enhancing,
  author = {Qiancheng Xu and Yongqi Li and Heming Xia and Wenjie Li},
  title = {{Enhancing Tool Retrieval with Iterative Feedback from Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.561},
}
Figure