Towards Completeness-Oriented Tool Retrieval for Large Language Models

📄 arXiv: 2405.16089v2 📥 PDF

作者: Changle Qu, Sunhao Dai, Xiaochi Wei, Hengyi Cai, Shuaiqiang Wang, Dawei Yin, Jun Xu, Ji-Rong Wen

分类: cs.CL, cs.IR

发布日期: 2024-05-25 (更新: 2024-07-28)

备注: Accepted by CIKM 2024; GitHub: https://github.com/quchangle1/COLT

DOI: 10.1145/3627673.3679847


💡 一句话要点

提出COLT,一种面向完备性的工具检索方法,提升大语言模型工具增强效果

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 工具检索 大型语言模型 协同学习 图神经网络 信息检索

📋 核心要点

  1. 现有工具检索方法侧重语义匹配,易检索到冗余工具,无法为LLM提供完整且多样化的工具集。
  2. COLT方法通过协同学习,同时捕捉查询与工具的语义相似性以及工具间的协同关系,提升检索完备性。
  3. 实验表明,COLT显著提升工具检索性能,参数量更小的BERT-mini甚至超越了参数量更大的BERT-large。

📝 摘要(中文)

将外部工具集成到大型语言模型(LLM)中,作为缓解其预训练数据固有局限性的有效策略,受到了广泛关注。然而,实际系统中通常包含大量工具,由于长度限制和延迟约束,将所有工具输入LLM是不切实际的。因此,为了充分发挥工具增强型LLM的潜力,开发有效的工具检索系统至关重要。现有的工具检索方法主要侧重于用户查询和工具描述之间的语义匹配,经常导致检索到冗余、相似的工具。因此,这些方法无法提供解决LLM遇到的多方面问题所需的完整且多样化的工具集。本文提出了一种新的、与模型无关的基于协同学习的工具检索方法COLT,该方法不仅捕获用户查询和工具描述之间的语义相似性,还考虑了工具的协同信息。具体来说,我们首先微调基于PLM的检索模型,以捕获语义学习阶段中查询和工具之间的语义关系。随后,我们构建了查询、场景和工具之间的三个二分图,并引入了双视图图协同学习框架,以捕获协同学习阶段中工具之间复杂的协同关系。在开放基准和新引入的ToolLens数据集上的大量实验表明,COLT取得了优异的性能。值得注意的是,使用我们提出的模型框架的BERT-mini (11M)的性能优于BERT-large (340M),后者具有30倍以上的参数。此外,我们将公开发布ToolLens,以促进未来对工具检索的研究。

🔬 方法详解

问题定义:论文旨在解决大型语言模型(LLM)工具增强场景下,现有工具检索方法无法提供完整且多样化工具集的问题。现有方法主要依赖用户查询和工具描述的语义匹配,容易检索到语义相似但功能冗余的工具,导致LLM无法有效利用工具解决复杂问题。

核心思路:论文的核心思路是引入协同学习,不仅考虑用户查询与工具描述的语义相似性,还考虑工具之间的协同关系。通过挖掘工具在不同场景下的共现模式,学习工具之间的依赖和互补关系,从而提升检索结果的完备性和多样性。

技术框架:COLT框架包含两个主要阶段:语义学习阶段和协同学习阶段。在语义学习阶段,使用预训练语言模型(PLM)微调检索模型,学习查询和工具之间的语义关系。在协同学习阶段,构建查询-工具、场景-工具等二分图,利用图神经网络学习工具之间的协同关系。最终,将语义相似度和协同关系融合,用于工具检索排序。

关键创新:COLT的关键创新在于引入了双视图图协同学习框架。该框架通过构建多个二分图,从不同角度刻画工具之间的协同关系。例如,查询-工具图反映了哪些工具经常被用于处理相似的查询,场景-工具图反映了哪些工具经常在相似的场景下被使用。通过图神经网络学习这些图结构,可以有效捕捉工具之间的依赖和互补关系。

关键设计:COLT使用对比学习损失函数在语义学习阶段微调PLM,以增强查询和相关工具之间的语义相似性。在协同学习阶段,使用图注意力网络(GAT)学习二分图的节点表示。最终的工具排序分数由语义相似度得分和协同关系得分加权得到。论文还提出了ToolLens数据集,用于评估工具检索模型的性能。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,COLT在开放基准和ToolLens数据集上均取得了显著的性能提升。值得注意的是,使用COLT框架的BERT-mini (11M)的性能超越了BERT-large (340M),表明COLT能够有效利用协同信息,提升模型性能,即使在参数量较小的情况下也能取得优异的结果。这证明了COLT方法的有效性和实用性。

🎯 应用场景

COLT方法可应用于各种需要工具增强的大型语言模型应用场景,例如智能助手、代码生成、知识问答等。通过提供更完整和多样化的工具集,COLT可以提升LLM解决复杂问题的能力,提高用户体验,并降低人工干预成本。该研究对构建更智能、更可靠的工具增强型LLM系统具有重要意义。

📄 摘要(原文)

Recently, integrating external tools with Large Language Models (LLMs) has gained significant attention as an effective strategy to mitigate the limitations inherent in their pre-training data. However, real-world systems often incorporate a wide array of tools, making it impractical to input all tools into LLMs due to length limitations and latency constraints. Therefore, to fully exploit the potential of tool-augmented LLMs, it is crucial to develop an effective tool retrieval system. Existing tool retrieval methods primarily focus on semantic matching between user queries and tool descriptions, frequently leading to the retrieval of redundant, similar tools. Consequently, these methods fail to provide a complete set of diverse tools necessary for addressing the multifaceted problems encountered by LLMs. In this paper, we propose a novel modelagnostic COllaborative Learning-based Tool Retrieval approach, COLT, which captures not only the semantic similarities between user queries and tool descriptions but also takes into account the collaborative information of tools. Specifically, we first fine-tune the PLM-based retrieval models to capture the semantic relationships between queries and tools in the semantic learning stage. Subsequently, we construct three bipartite graphs among queries, scenes, and tools and introduce a dual-view graph collaborative learning framework to capture the intricate collaborative relationships among tools during the collaborative learning stage. Extensive experiments on both the open benchmark and the newly introduced ToolLens dataset show that COLT achieves superior performance. Notably, the performance of BERT-mini (11M) with our proposed model framework outperforms BERT-large (340M), which has 30 times more parameters. Furthermore, we will release ToolLens publicly to facilitate future research on tool retrieval.