arXiv:2409.02141cs.LGcs.AI2024-09被引 20

用大模型生成真实工具使用数据,实现高效精准的工具检索。

Efficient and Scalable Estimation of Tool Representations in Vector Space

  • 用大模型合成真实用户行为数据,构建新工具检索数据集
  • 提出三种方法,最高提升30.5%工具召回率
  • 适合需要快速调用外部工具的AI系统开发者

函数调用与工具使用能力显著提升了大语言模型(LLM)的能力,使其能与外部信息源交互并执行复杂任务。然而,LLM有限的上下文窗口在面对大量可用工具时带来挑战,需高效管理提示长度并保持准确率。现有方法如微调或依赖推理能力,要么需频繁重训,要么延迟高。更优方案是训练小型模型来检索相关工具,但需高质量、领域特定的数据。为此,我们提出一种生成工具检索应用合成数据的新框架,并采用小编码器模型实现高效数据驱动的工具检索策略。借助大模型,我们创建了反映真实用户行为的ToolBank工具检索数据集。针对工具检索方法,我们提出:(1) Tool2Vec:基于使用场景的工具嵌入生成;(2) ToolRefiner:分阶段迭代优化检索结果;(3) MLC:将工具检索建模为多标签分类问题。在ToolBench和ToolBank数据集上,召回率分别提升达27.28和30.5。进一步实验验证了方法有效性。代码已开源。

原文摘要 · Abstract (English)

Recent advancements in function calling and tool use have significantly enhanced the capabilities of large language models (LLMs) by enabling them to interact with external information sources and execute complex tasks. However, the limited context window of LLMs presents challenges when a large number of tools are available, necessitating efficient methods to manage prompt length and maintain accuracy. Existing approaches, such as fine-tuning LLMs or leveraging their reasoning capabilities, either require frequent retraining or incur significant latency overhead. A more efficient solution involves training smaller models to retrieve the most relevant tools for a given query, although this requires high quality, domain-specific data. To address those challenges, we present a novel framework for generating synthetic data for tool retrieval applications and an efficient data-driven tool retrieval strategy using small encoder models. Empowered by LLMs, we create ToolBank, a new tool retrieval dataset that reflects real human user usages. For tool retrieval methodologies, we propose novel approaches: (1) Tool2Vec: usage-driven tool embedding generation for tool retrieval, (2) ToolRefiner: a staged retrieval method that iteratively improves the quality of retrieved tools, and (3) MLC: framing tool retrieval as a multi-label classification problem. With these new methods, we achieve improvements of up to 27.28 in Recall@K on the ToolBench dataset and 30.5 in Recall@K on ToolBank. Additionally, we present further experimental results to rigorously validate our methods. Our code is available at \url{https://github.com/SqueezeAILab/Tool2Vec}

工具检索大模型数据合成向量空间

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。