QS-Graph: Query-Shot Augmentation and Graph Hyperlink Expansion for Large-Scale Tool Retrieval(QS-Graph:用于大规模工具检索的查询样本增强与图超链接扩展)于 2026-12-03 提交到 arXiv,作者 Zhoucai Tang, Xiangpeng Li, Yuan Su, Deqiang Ouyang, Ning Wang。去 arXiv 读原文,或下载 PDF。
主要发现
- 在 ToolBench G1 上使用 BGE-base-en-v1.5 进行标准稠密检索时,由于相关查询与工具对的余弦相似度与难负样本严重重叠,有 62.4% 的相关对被无关工具排在前面。
- 在 ToolBench 上,为 BGE-base-en-v1.5 加入合成查询样本和图扩展后,无需微调即可将 Recall@10 从 72.44% 提升至 83.42%,将 Completeness@10 从 59.85% 提升至 77.54%。
- 在 ToolBench 上使用采样的历史查询样本配合 BGE-base-en-v1.5 时,Recall@10 达到 92.52%,Completeness@10 达到 91.47%,在 K=1 和 K=10 的全部四项指标上均超过有监督的 ToolLLM 检索器。
- 在包含 44,453 个工具的 ToolRex 语料库上,使用 Qwen3-Embedding-4B 和合成查询样本的 QS-Graph 平均 Recall@10 达到 59.09%,在 Web、Code 和 Customized 三个领域均超过经过微调的 Tool-Embed-4B(49.95%)。
- 将 QS-Graph 直接应用于已微调的 ToolBench-IR 模型且不做额外训练时,使用合成样本可将 Completeness@10 从 87.95% 提升至 91.34%,使用采样样本则提升至 97.37%。
最重要的一点。 在索引阶段预先计算多个用户意图原型和基于图传播的依赖信号,可以在不微调嵌入模型也不增加在线大模型调用的前提下,明显提升 ToolBench 和 ToolRex 上的前 10 项工具检索效果。当存在历史用户查询日志时提升最为明显,而仅靠合成示例查询也足以在 ToolRex 的三个领域中超过微调基线。
摘要
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.
译文:基于大语言模型(LLM)的智能体越来越依赖外部工具来解决复杂任务,因此从大规模工具库中准确检索工具变得至关重要。然而,现有的检索方法面临两个主要局限:用户查询与工具文档之间的语义不匹配,以及未能利用工具之间的结构依赖关系。我们提出了 QS-Graph,这是一个无需训练的框架,能够同时解决这两个局限。查询样本增强(Query-Shot Augmentation)将示例查询自适应地分组为锚定文档的意图原型,从而保留工具可能被请求的多样化方式。图超链接扩展(Graph Hyperlink Expansion)将这些原型聚合为工具级表示,在层级关系和协作关系上进行传播,并将生成的结构残差注入每个原型中。这两项增强操作均在索引阶段完成,因此在线检索只需进行一次查询编码、向量搜索和轻量级原型聚合,无需调用 LLM 或进行图遍历。在使用从历史查询中采样的查询样本时,QS-Graph 无需微调嵌入模型即可在 ToolBench 上取得与有监督最先进方法相当的性能。此外,仅使用合成查询样本时,QS-Graph 在 ToolRex 的 Web、Code 和 Customized 三个领域中均优于现有基线。
关键术语
- 查询样本(Query-Shot):从工具文档生成或从历史日志中采样的示例用户请求,用来展示用户会如何描述对该工具的需求。
- 文档锚定意图原型(Document-Anchored Intent Prototype):将某个工具的相似示例查询聚类后,把每个聚类中心与该工具原始文档向量融合得到的向量表示。
- 图超链接扩展(Graph Hyperlink Expansion):一种在索引阶段执行的步骤,先汇总工具的意图原型,再沿分类层级和协同使用边传播信号,最后把结构差值加回各个原型。
- 完整度指标(Completeness@K):一种检索评估指标,只有当完成某条查询所需的全部真实工具都出现在前 K 个结果中时,该查询才计为 1 分,否则为 0 分。
- 冷启动(Cold Start):缺乏历史用户查询与工具匹配日志的场景,此时只能根据工具说明文档合成示例查询。
论文原文
作者指出了现有文档扩展方法和图方法在单独使用时各自的不足。
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.
译文:这些方法减少了语义不匹配,但它们仍然独立地表示每个工具,因此无法利用工具之间的关系。这种独立性限制了多工具任务的表现,因为所需工具通常共享类别、依赖或协同使用关系。
论文说明了两个增强阶段都在索引期完成,从而保证在线检索的速度。
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.
译文:这两项增强操作都在索引阶段执行,因此在线检索只需要一次查询编码、向量搜索和轻量级原型聚合,无需调用大语言模型或进行图遍历。
消融实验表明,当只有合成查询时,图扩展带来的增益要大得多。
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.
译文:在使用合成查询样本时,图扩展提升了全部四项指标,并将 Completeness@10 提高了 12.42 个百分点。在使用采样查询样本时,对应的增益仅为 3.01 个百分点,因为仅使用查询样本的变体已经很强。
论文里的图
重点看图(a)中 62.4% 的相关查询与工具对在余弦相似度上与难负样本重叠,以及图(b)中查询 38411 排第 2 召回了 historical_weather,却把必需的前置依赖工具 find_places 漏排到了第 105 位。
图来自论文 arXiv:2612.04768,版权归作者。原图说明: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.
重点看随着每个工具使用的历史采样查询数量从 1 条增加到全部可用样本,ToolBench 上的四项检索指标均持续上升。
图来自论文 arXiv:2612.04768,版权归作者。原图说明:Figure 3: Effect of the number of sampled query-shots on ToolBench. All uses all available historical query-shots for each tool.
作者自己说的含义
- 在索引阶段把面向用户的文本证据与工具之间的结构关系结合起来,无需微调编码器就能提高排名靠前结果中完整工具集的召回率。
- 保留多个文档锚定的意图原型,比把所有示例查询平均合并为单一向量更能保留多样化的请求语义。
- 通过门控残差路径传播邻域信息,可以在引入依赖关系证据的同时,避免工具自身的原始语义被稀释。
- 历史查询与工具的关联记录能提供比合成查询更强的语义增强,而图传播在缺乏历史查询证据的冷启动条件下发挥的作用最大。
可以怎么做
- 为工具构建索引时,将示例用户查询聚类为多个锚定文档的意图原型,而不要把所有合成查询平均合并成一个工具向量。 依据:在 ToolBench 上使用 BGE-base-en-v1.5 时,意图融合在 Recall@10 上优于文本拼接,合成样本下从 75.36% 提升至 77.61%,采样样本下从 86.03% 提升至 91.30%。
- 在积累了历史交互日志的系统中,记录并采样真实的历史查询与工具匹配对来生成意图原型。 依据:在 ToolBench 上,使用采样历史查询样本的 QS-Graph 取得 92.52% 的 Recall@10 和 91.47% 的 Completeness@10,高于合成样本的 83.42% 和 77.54%。
- 为缺乏真实查询日志的新工具或冷启动工具建立索引时,加入基于分类层级和协同使用边的门控残差图传播。 依据:在 ToolBench 的合成查询样本消融实验中,启用图超链接扩展使 Completeness@10 从 65.12% 提高到 77.54%,增加了 12.42 个百分点。
- 在需要跨多个专业领域检索工具时,优先采用索引期查询样本与图增强,而不要仅依赖特定领域的嵌入模型微调。 依据:在 ToolRex 上,无需训练的 QS-Graph 配合 Qwen3-Embedding-4B 在 Code 和 Customized 领域分别达到 65.57% 和 45.49% 的 Recall@10,高于微调后的 Tool-Embed-4B(46.18% 和 41.03%)。
注意。 该研究测试的是 ToolBench 和包含 44,453 个工具的 ToolRex 数据集上的 API 与函数检索,而非通用网页排序;同时作者指出,为每个工具存储多个原型会增加索引开销,未来需要针对动态更新的工具库研究更高效的原型索引方法。
一句话
QS-Graph 通过在索引阶段将示例查询聚类为意图原型,并在工具关系图上传播依赖信号,改进了大规模稠密工具检索。该方法无需微调嵌入模型,也无需在查询时调用大语言模型,在 ToolBench 上配合历史查询样本取得了 92.52% 的 Recall@10,并在 ToolRex 的三个领域中仅凭合成查询样本就超过了微调基线。
这篇解读根据论文原文写成。引用的段落是原话,数字都是作者自己报告的。方法和完整结果请读论文。