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
- Standard dense retrieval using BGE-base-en-v1.5 on ToolBench G1 outranks 62.4% of relevant query-tool pairs because relevant pairs overlap in cosine similarity with hard irrelevant tools.
- On ToolBench, adding synthetic query-shots and graph expansion to BGE-base-en-v1.5 raises Recall@10 from 72.44% to 83.42% and Completeness@10 from 59.85% to 77.54% without fine-tuning.
- Using sampled historical query-shots with BGE-base-en-v1.5 on ToolBench pushes Recall@10 to 92.52% and Completeness@10 to 91.47%, beating the supervised ToolLLM Retriever across all four metrics at K=1 and K=10.
- On the 44,453-tool ToolRex corpus, QS-Graph with Qwen3-Embedding-4B and synthetic query-shots achieves an average Recall@10 of 59.09%, outperforming the fine-tuned Tool-Embed-4B baseline at 49.95% across Web, Code, and Customized domains.
- Applying QS-Graph on top of the fine-tuned ToolBench-IR model without further training increases Completeness@10 from 87.95% to 91.34% with synthetic shots and to 97.37% with sampled shots.
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
- Query-Shot: An example user request, either generated from a tool’s documentation or sampled from past logs, that illustrates how a user asks for that tool.
- Document-Anchored Intent Prototype: A vector representation formed by clustering similar example queries for a tool and blending each cluster center with the tool’s original document embedding.
- Graph Hyperlink Expansion: An index-time step that aggregates a tool’s prototypes, spreads that signal across category hierarchies and co-usage links, and adds the structural difference back to each prototype.
- Completeness@K: A retrieval metric that scores 1 for a query only when every single ground-truth tool needed to answer that query appears within the top K results.
- Cold Start: A setting where no historical logs of past user queries and matched tools exist, requiring example queries to be synthesized from tool descriptions.
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 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 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
- Combining user-facing textual evidence with structural tool relations at index time improves the recovery of complete multi-tool sets near the top of dense retrieval rankings without fine-tuning the encoder.
- Retaining separate document-anchored intent prototypes preserves diverse request semantics better than pooling all example queries into a single vector representation.
- Propagating neighborhood information through a gated residual path incorporates dependency evidence while preventing a tool’s own semantics from being diluted.
- Historical query-tool associations provide stronger semantic enrichment than synthetic queries, whereas graph propagation provides its largest benefit when historical query evidence is absent or weak.
What to do with it
- 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.
- 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.
- 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%.
- 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.
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.