[论文解读] Counterfactually Auditable Lifecycle Certification for Autonomous Agents
引入 ToolBench 用于开源 LLM 的工具使用指令微调、DFSDT 推理策略,以及 ToolEval 的自动评估,在工具使用方面达到竞争力并对未见 API 具有鲁棒泛化。
Despite the advancements of open-source large language models (LLMs), e.g., LLaMA, they remain significantly limited in tool-use capabilities, i.e., using external tools (APIs) to fulfill human instructions. The reason is that current instruction tuning largely focuses on basic language tasks but ignores the tool-use domain. This is in contrast to the excellent tool-use capabilities of state-of-the-art (SOTA) closed-source LLMs, e.g., ChatGPT. To bridge this gap, we introduce ToolLLM, a general tool-use framework encompassing data construction, model training, and evaluation. We first present ToolBench, an instruction-tuning dataset for tool use, which is constructed automatically using ChatGPT. Specifically, the construction can be divided into three stages: (i) API collection: we collect 16,464 real-world RESTful APIs spanning 49 categories from RapidAPI Hub; (ii) instruction generation: we prompt ChatGPT to generate diverse instructions involving these APIs, covering both single-tool and multi-tool scenarios; (iii) solution path annotation: we use ChatGPT to search for a valid solution path (chain of API calls) for each instruction. To enhance the reasoning capabilities of LLMs, we develop a novel depth-first search-based decision tree algorithm. It enables LLMs to evaluate multiple reasoning traces and expand the search space. Moreover, to evaluate the tool-use capabilities of LLMs, we develop an automatic evaluator: ToolEval. Based on ToolBench, we fine-tune LLaMA to obtain an LLM ToolLLaMA, and equip it with a neural API retriever to recommend appropriate APIs for each instruction. Experiments show that ToolLLaMA demonstrates a remarkable ability to execute complex instructions and generalize to unseen APIs, and exhibits comparable performance to ChatGPT. Our ToolLLaMA also demonstrates strong zero-shot generalization ability in an out-of-distribution tool-use dataset: APIBench.
研究动机与目标
- 在现实、包含多工具场景中,促使开源 LLM 能熟练使用外部 API。
- 使用真实世界的 RESTful API,创建可扩展的自动数据生成管线(ToolBench)。
- 开发基于深度优先搜索的决策树(DFSDT),以改进工具使用的规划与推理。
- 提供自动评估框架(ToolEval)来衡量工具使用能力。
- 展示对未见 API 和分布外的工具使用基准的泛化。
提出的方法
- 通过从 RapidAPI 的 49 类中收集 16,464 个 RESTful API 来构建 ToolBench。
- 利用 ChatGPT 生成多样的单工具和多工具指令,并使用基于 DFSDT 的过程对解决路径进行注释。
- 通过多轮推理对指令-解决路径进行注释,在每一步调用一个 API 并记录思路、所选 API 和参数。
- 在 ToolBench 数据上对 LLaMA-2(7B)进行微调,获得具备更长上下文长度的 ToolLLaMA,以处理长的 API 响应。
- 训练一个神经 API 检索器,在给定指令时推荐相关 API,从而提高检索精度。
- 开发 ToolEval,一种具有通过率和胜率指标的自动评估器,用于评估工具使用性能和解决路径质量。
实验结果
研究问题
- RQ1在单工具和多工具设置中,开源 LLM 能否被训练成熟练掌握现实世界的 API?
- RQ2神经 API 检索器是否能从大量候选中有效识别与给定指令相关的 API?
- RQ3与 ReACT 相比,DFSDT 推理策略是否提升了规划、探索和最终成功率?
- RQ4ToolLLaMA 对未见 API 和分布外工具使用数据集(APIBench)的泛化能力如何?
- RQ5自动评估(ToolEval)在工具使用场景中是否能作为人类判断的可靠替代?
主要发现
- 在 ToolBench 上对 DFSDT 微调的 ToolLLaMA 在工具使用任务上的表现可与 ChatGPT 相媲美,接近 GPT-4。
- DFSDT 策略显著提高通过率和胜率,相较 ReACT,尤其是在更困难的多工具指令上。
- 神经 API 检索器显著提高 API 选择的精度,在某些情况下甚至可超过真实 API 集的检索结果。
- ToolLLaMA 对未见 API 和分布外数据集(APIBench)有鲁棒泛化,在若干设置下达到或超过基线。
- 在实践中使用 API 检索器(前五名 API)可以胜过 oracle API 集,凸显检索器扩展有用工具选择的能力。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。