Authors: Zhoucai Tang, Xiangpeng Li, Yuan Su, Deqiang Ouyang, Ning WangarXiv 2612.04768

QS-Graph: Query-Shot Augmentation and Graph Hyperlink Expansion for Large-Scale Tool Retrieval was submitted to arXiv on 2026-12-03 by Zhoucai Tang, Xiangpeng Li, Yuan Su, Deqiang Ouyang, Ning Wang. Read it on arXiv or as a PDF.

Key findings

The main takeaway. Precomputing multiple user-intent prototypes and graph-propagated dependency signals during indexing improves top-10 tool retrieval on ToolBench and ToolRex without fine-tuning the embedding model or adding online LLM calls. The largest gains occur when historical user queries are available, though synthetic example queries still beat fine-tuned baselines across all three ToolRex domains.

The abstract, as written

Large language model (LLM)-based agents increasingly rely on external tools to solve complex tasks, making accurate tool retrieval from large-scale repositories essential. Existing retrieval methods, however, face two key limitations: the semantic mismatch between user queries and tool documents, and the failure to exploit structural dependencies among tools. We introduce QS-Graph, a training-free framework that addresses both limitations. Query-Shot Augmentation adaptively groups example queries into document-anchored intent prototypes, preserving diverse ways in which a tool may be requested. Graph Hyperlink Expansion aggregates these prototypes into a tool-level representation, propagates it over hierarchical and collaborative relations, and injects the resulting structural residual into each prototype. Both enrichment operations are performed at index time, so online retrieval requires only one query encoding, vector search, and lightweight prototype aggregation, without LLM calls or graph traversal. Using query-shots sampled from historical queries, QS-Graph achieves performance competitive with the supervised state of the art on ToolBench without fine-tuning the embedding model. Furthermore, using only synthetic query-shots, QS-Graph outperforms existing baselines across the Web, Code, and Customized domains in ToolRex.

Key terms

From the paper

The authors explain why existing document expansion and graph methods fall short when used separately.

These approaches reduce semantic mismatch, but they still represent each tool independently and therefore cannot exploit relations among tools. This independence is restrictive for multi-tool tasks, where the required tools often share category, dependency, or co-usage relations.

The paper describes how both enrichment stages run during indexing so online search stays fast.

Both enrichment operations are performed at index time, so online retrieval requires only one query encoding, vector search, and lightweight prototype aggregation, without LLM calls or graph traversal.

The ablation study shows that graph expansion helps much more when only synthetic queries are available.

With synthetic query-shots, graph expansion improves all four metrics and raises Completeness@10 by 12.42 percentage points. With sampled query-shots, the corresponding gain is only 3.01 percentage points, as the query-shot-only variant is already strong.

Figures from the paper

Look at panel (a) showing how 62.4% of relevant query-tool pairs overlap in similarity with hard negatives, and panel (b) showing how query 38411 retrieves historical_weather at rank 2 while missing its required dependency find_places at rank 105.

Figure 1: Two failure modes of dense tool retrieval with BGE-base-en-v1.5 on ToolBench G1. (a) Relevant query–tool pairs

Figure from the paper, arXiv:2612.04768, by its authors. Caption as written: Figure 1: Two failure modes of dense tool retrieval with BGE-base-en-v1.5 on ToolBench G1. (a) Relevant query–tool pairs substantially overlap with their hardest irrelevant tools in cosine similarity, causing 62.4% of relevant pairs to be outranked. (b) For query 38411, historical_weather is retrieved at rank 2, whereas its one-hop dependency find_places is missed at rank 105 despite being required to resolve the queried location. The t-SNE coordinates are qualitative. Ranks and cosine similarity scores are computed in the original embedding space.

Look at how all four ToolBench retrieval metrics rise steadily from 1 sampled query-shot up to using all available historical query-shots per tool.

Figure 3: Effect of the number of sampled query-shots on ToolBench. All uses all available historical query-shots for ea

Figure from the paper, arXiv:2612.04768, by its authors. Caption as written: Figure 3: Effect of the number of sampled query-shots on ToolBench. All uses all available historical query-shots for each tool.

What the authors say it means

What to do with it

  1. Cluster example user queries into separate document-anchored prototypes rather than averaging all synthetic queries into one tool embedding. Supported by: On ToolBench with BGE-base-en-v1.5, Intent Fusion beats Text Concat on Recall@10, raising it from 75.36% to 77.61% with synthetic shots and from 86.03% to 91.30% with sampled shots.
  2. Log and sample historical query-tool associations to build prototypes when past usage data exists. Supported by: On ToolBench, sampled query-shots with QS-Graph achieve 92.52% Recall@10 and 91.47% Completeness@10, compared with 83.42% Recall@10 and 77.54% Completeness@10 using synthetic shots.
  3. Add gated residual graph propagation over category and co-usage links when indexing new or cold-start tools that lack real query logs. Supported by: In the ToolBench ablation with synthetic query-shots, enabling Graph Hyperlink Expansion increases Completeness@10 by 12.42 percentage points, from 65.12% to 77.54%.
  4. Use index-time query-shot and graph enrichment instead of domain-specific encoder fine-tuning when serving tools across varied domains. Supported by: On ToolRex, training-free QS-Graph with Qwen3-Embedding-4B reaches 65.57% Recall@10 on Code and 45.49% on Customized tools, beating fine-tuned Tool-Embed-4B at 46.18% and 41.03%.

Caveat. The experiments evaluate API and function retrieval on ToolBench and the 44,453-tool ToolRex corpus rather than general web page ranking, and the authors note that storing multiple prototypes per tool increases index size and requires efficient indexing methods for dynamic repositories.

In short

QS-Graph improves dense tool retrieval on ToolBench and ToolRex by clustering example queries into intent prototypes and propagating dependency signals over a tool graph during indexing. Without fine-tuning the embedding model or running online LLM calls, it reaches 92.52% Recall@10 on ToolBench with historical query-shots and outperforms fine-tuned baselines across all three ToolRex domains with synthetic query-shots.

Read the paper on arXiv →

Written from the paper's own text. Quoted passages are verbatim and the numbers are the authors' own. For the method and full results, read the paper.