先分后聚:一种通过并行工具调用的高效工具学习方法
Divide-Then-Aggregate: An Efficient Tool Learning Method via Parallel Tool Invocation
AI总结:
提出DTA-Llama方法,通过将工具搜索路径转为DAG并训练模型并行调用工具,再聚合结果决策,显著提升任务性能并降低推理成本,使Llama2-7B媲美GPT-3.5。
摘要:
尽管当前的大型语言模型(LLMs)展现出令人印象深刻的能力,但执行复杂的现实世界任务仍然需要工具学习。主流方法,如CoT/ReAct,依赖逐步工具调用来与外部环境交互,但它们在感知范围上受限,且缺乏足够的任务规划能力。为解决这些局限,其他研究引入了首个基于搜索的决策树(DFSDT),但其仍面临高计算成本的问题。在本文中,我们提出了一种新颖的并行工具调用范式,即DTA-Llama(先分后聚Llama)。首先,我们将传统的基于树的工具搜索路径转换为有向无环图(DAG)结构,生成一个高质量的并行工具调用数据集。随后,DTA-Llama在该数据集上训练,学习迭代地将当前任务分解为多个并行工具调用子任务,并聚合调用结果以决定后续动作。此外,我们引入了一种受进程/线程机制启发的高效推理框架,用于将DTA-Llama应用于实际任务。实验结果表明,我们的方法在显著提升任务性能的同时,减少了令牌消耗和推理时间。使用我们方法的Llama2-7B可与GPT-3.5的官方并行函数调用方法相媲美。相关代码、数据集和模型权重可在https://corn0205.github.io获取。
英文摘要:
Although current Large Language Models (LLMs) exhibit impressive capabilities, performing complex real-world tasks still requires tool learning. Mainstream methods, such as CoT/ReAct, rely on step-by-step tool invocation to interact with external environments, but they are limited in perceptual scope and lack adequate task-planning capability. To address these limitations, other studies introduce the first Search-based Decision Tree (DFSDT), which still suffers from the high computational cost. In this paper, we introduce a novel parallel tool invocation paradigm, DTA-Llama (Divide-Then-Aggregate Llama). First, we transform traditional tree-based tool search paths into Directed Acyclic Graph (DAG) structure, generating a high-quality parallel tool invocation dataset. The DTA-Llama is then trained on the dataset to learn to iteratively divide the current task into several parallel tool invocation sub-tasks and aggregate the invocation results to decide the next actions. Furthermore, we introduce an efficient inference framework inspired by the Process/Threads mechanism when applying the DTA-Llama to practical tasks. Experimental results show that our approach substantially enhances task performance while reducing token consumption and inference time. Llama2-7B, using our method, is comparable to the official parallel function calling method of GPT-3.5. The relevant code, dataset, and model weights are available at https://corn0205.github.io/
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。