COLT: Towards Completeness-Oriented Tool Retrieval for Large Language Models

Changle Qu, Sunhao Dai, Xiaochi Wei, Hengyi Cai, Shuaiqiang Wang, Dawei Yin, Jun Xu, Ji-Rong Wen · DOI

Abstract

Integrating Large Language Models (LLMs) with external tools is a powerful strategy to overcome the limitations of pre-training data. However, as tool repositories grow, retrieving the right set of tools becomes a significant challenge. Current retrieval methods focus primarily on semantic similarity, which often leads to the retrieval of redundant tools and fails to provide the complete set of diverse tools needed for complex, multifaceted tasks. We propose COLT (COllaborative Learning-based Tool Retrieval), a model-agnostic framework that captures both semantic similarity and collaborative relationships between tools. By utilizing a dual-view graph learning approach and a novel "scene" concept, COLT ensures completeness in retrieval. Our experiments demonstrate that COLT allows a BERT-mini (11M) model to outperform a BERT-large (340M) model, significantly improving the performance of tool-augmented LLMs.

Introduction

The utility of Large Language Models (LLMs) is significantly enhanced when they can access external tools like APIs, calculators, and databases. However, real-world systems often contain thousands of tools, making it impractical to include all tool descriptions in a single prompt due to context window limits and latency. This necessitates an effective retrieval step.

Traditional tool retrieval relies on dense retrieval, which ranks tools based on the semantic similarity between a user's query and tool descriptions. While effective for simple tasks, this approach struggles with multifaceted queries. For instance, a query requiring a gold price API, a stock price API, and a currency converter might return three different gold price APIs because they are semantically the closest to the query. This redundancy leaves the LLM without the necessary variety of tools to complete the task. COLT addresses this by shifting the objective from "similarity" to "completeness."

The COLT Framework

COLT is a two-stage, model-agnostic framework designed to capture the intricate relationships between queries and the tools required to solve them.

1. Semantic Learning Stage

In the first stage, COLT fine-tunes a Pre-trained Language Model (PLM) backbone (such as BERT or Contriever) using standard contrastive learning (InfoNCE loss). This ensures the model understands the basic textual alignment between user queries and tool documentation.

2. Collaborative Learning Stage

The core innovation of COLT lies in its collaborative learning stage, which introduces the concept of a "Scene." A scene represents a group of tools that are frequently used together to solve a specific type of problem.

To model these relationships, COLT constructs three bipartite graphs:

  • Query-Scene (Q-S): Mapping queries to the functional contexts they belong to.
  • Query-Tool (Q-T): Direct mapping of queries to required tools.
  • Scene-Tool (S-T): Mapping functional contexts to the set of tools they typically employ.

Using a dual-view graph learning framework powered by LightGCN, the model learns embeddings that reflect how tools collaborate. A list-wise multi-label loss is employed during training. Unlike standard retrieval losses that reward the selection of any single correct tool, this loss encourages the model to retrieve the entire set of required tools simultaneously, prioritizing completeness over individual similarity scores.

Datasets and Evaluation

The researchers evaluated COLT using two primary benchmarks:

  • ToolBench: A standard benchmark for tool-augmented LLMs, specifically focusing on multi-tool scenarios (I2 and I3 subsets).
  • ToolLens: A new dataset introduced by the authors to better reflect real-world complexity. ToolLens features concise, natural-language queries that are often multifaceted, containing 18,770 queries and 464 tools.

To measure success, the authors utilized COMP@K, a strict metric that only awards a score of 1 if all ground-truth tools for a query appear within the top-K retrieved results.

Key Findings

Efficiency and Scale

One of the most significant results is the efficiency gain provided by the COLT framework. A BERT-mini model (11M parameters) using COLT outperformed a BERT-large model (340M parameters) using standard retrieval methods. This suggests that the retrieval architecture and training strategy are more critical for tool discovery than the raw size of the encoder.

Performance Gains

COLT demonstrated substantial improvements across various backbones. On the ToolLens dataset, it improved the COMP@3 score of the Contriever backbone from approximately 7.5% to over 84%. This massive jump highlights the effectiveness of modeling tool collaboration.

Downstream Impact

The ultimate test of a retriever is the performance of the LLM using those tools. Using GPT-4 as an evaluator, the authors found that LLMs equipped with COLT-retrieved tools produced significantly more coherent, relevant, and comprehensive answers compared to those using tools from standard semantic retrievers, as measured by Elo ratings.

Conclusion

COLT represents a paradigm shift in tool retrieval for LLMs, moving from simple semantic matching to completeness-oriented collaborative learning. By treating tools as part of a functional ecosystem (scenes) rather than isolated entities, COLT ensures that LLMs receive the diverse set of instruments necessary for complex problem-solving. While challenges remain regarding dynamic graph updates and cold-start scenarios for new tools, COLT provides a robust and efficient foundation for the next generation of tool-augmented AI systems.

Summary updated

BibTeX
@inproceedings{qu2024colt,
  author = {Changle Qu and Sunhao Dai and Xiaochi Wei and Hengyi Cai and Shuaiqiang Wang and Dawei Yin and Jun Xu and Ji-Rong Wen},
  title = {{COLT: Towards Completeness-Oriented Tool Retrieval for Large Language Models}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2024},
  doi = {10.1145/3627673.3679847},
}
Figure