让大模型重写器与密集编码器一起迭代进化,提升工具检索准确率。
CoHyDE: Iterative Co-Training of LLM Rewriter & Dense Encoder for Tool Retrieval
- 大模型重写查询,编码器用生成的描述做对比学习,双向优化
- 在1万工具数据集上,模糊查询召回率提升6.3个百分点
- 适合需要精准调用复杂API的智能体研发者
在大型API目录中进行工具检索是大语言模型代理的核心瓶颈:用户查询常使用口语化、不明确的表达,而目录则采用技术性词汇,单一编码器难以应对。现有两种主流方法——对比编码器微调和零样本HyDE查询扩展——各有短板:前者在查询形式匹配时表现好,但不匹配时失效;后者对模糊查询更鲁棒,但生成的假设描述缺乏目录感知,导致良好查询性能下降。我们提出CoHyDE,一种迭代式联合训练机制,将密集编码器与大模型重写器作为协同演化的系统:编码器使用重写器生成的目录风格假设描述进行InfoNCE训练,重写器通过偏好对齐(DPO)根据编码器的检索得分优化。两者均以工具目录为起点预热后开始循环训练。在ToolBench约10,000个工具子集上,三轮CoHyDE使标准查询的NDCG@5提升2.5个百分点,模糊查询提升6.3个百分点,最困难的模糊类别最高提升8个百分点。消融实验表明,联合训练是关键,单独使用任一组件均无法在两类查询上达到同等效果,模糊查询损失高达-8个百分点。
原文摘要 · Abstract (English)
Tool retrieval over large API catalogs is a core bottleneck for LLM agents: user queries arrive in colloquial, often underspecified language, while the catalog uses technical API vocabulary that no fixed encoder can bridge on its own. The two dominant training approaches, contrastive encoder fine-tuning and HyDE-style query expansion with a frozen LLM, address this problem from opposite ends and fail in complementary directions: the fine-tuned encoder excels when the query's surface form already matches the catalog but collapses when it does not, while zero-shot HyDE is more robust to underspecified queries yet generates catalog-unaware hypothetical descriptions that degrade retrieval when queries are well-formed. We introduce CoHyDE, an iterative procedure that trains the dense encoder and the LLM rewriter as a single co-evolving system: the encoder is retrained with InfoNCE on catalog-style hypothetical descriptions produced by the rewriter, and the rewriter is preference-aligned via DPO against the encoder's retrieval scores, with both sides warm-started on the tool catalog before the loop begins. On a ~10k tool subset of the ToolBench catalog, three rounds of CoHyDE improve over the strongest single-component baseline by +2.5 pp NDCG@5 on standard queries and +6.3 pp on held-out vague queries, with gains as large as +8 pp on the hardest vague tier. Ablations confirm that co-training is the key ingredient: using either component in isolation fails to match CoHyDE on both well-formed and vague queries, with losses of up to -8 pp on vague queries.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。