[论文解读] ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases
ToolAlpaca 自动构建多样化的工具使用语料库,并对紧凑型语言模型进行微调,以实现通用的工具使用能力,在未见工具上与 GPT-3.5 相当,且仅使用约 ~3.9k 的模拟案例。
Enabling large language models to utilize real-world tools effectively is crucial for achieving embodied intelligence. Existing approaches to tool learning have either primarily relied on extremely large language models, such as GPT-4, to attain generalized tool-use abilities in a zero-shot manner, or utilized supervised learning to train limited scopes of tools on compact models. However, it remains uncertain whether smaller language models can achieve generalized tool-use abilities without tool-specific training. To address this question, this paper introduces ToolAlpaca, a novel framework designed to automatically generate a diverse tool-use corpus and learn generalized tool-use abilities on compact language models with minimal human intervention. Specifically, ToolAlpaca first automatically creates a highly diversified tool-use corpus by building a multi-agent simulation environment. The corpus contains 3938 tool-use instances from more than 400 real-world tool APIs spanning 50 distinct categories. Subsequently, the constructed corpus is employed to fine-tune compact language models, resulting in two models, namely ToolAlpaca-7B and ToolAlpaca-13B, respectively. Finally, we evaluate the ability of these models to utilize previously unseen tools without specific training. Experimental results demonstrate that ToolAlpaca achieves effective generalized tool-use capabilities comparable to those of extremely large language models like GPT-3.5, demonstrating that learning generalized tool-use ability is feasible for compact language models.
研究动机与目标
- 证明紧凑型语言模型在不进行工具特定训练的情况下,是否能够获得泛化的工具使用能力。
- 自动生成一个多样化、结构完善的工具使用语料库,适合对小型语言模型进行微调。
- 展示在 ToolAlpaca 语料库上进行微调,是否能实现对未见工具和真实世界 API 的泛化工具使用。
提出的方法
- 通过把公开 API 中的 400+ 个真实工具转换为标准化文档(名称、介绍、描述、功能文档、OpenAPI 规范),构建多样化的工具集。
- 通过三方代理的多轮对话仿真(用户、助手、工具执行者),在大语言模型驱动下生成 3,938 个工具使用实例。
- 利用生成的语料库对紧凑型语言模型(Vicuna-7B 和 Vicuna-13B)进行微调,并在未见的仿真工具和真实世界工具上进行评估。
- 使用 GPT-4 的机器评估以及对选定子集的人工评估,评估对多模态和未见工具的泛化。
- 量化工具集多样性对泛化性能的影响。

实验结果
研究问题
- RQ1紧凑型语言模型在不进行工具特定训练的情况下,是否能学习到泛化的工具使用能力?
- RQ2自动化、多样化的合成数据是否能够使紧凑型语言模型对未见工具和真实世界 API 具备泛化能力?
- RQ3工具集多样性如何影响泛化性能?
- RQ4ToolAlpaca 在未见工具上与大型语言模型(如 GPT-3.5)相比如何?
主要发现
- 对未见工具,微调后的 ToolAlpaca-7B 和 ToolAlpaca-13B 的通过率/准确性高于基础 Vicuna 模型。
- ToolAlpaca-13B 在未见工具上的表现达到与 GPT-3.5 相当的水平。
- 在 3.9k 个模拟案例上的训练能实现对真实世界 API 的泛化,其中 ToolAlpaca 的表现优于 Vicuna 基线。
- ToolAlpaca 在数据集外的多模态工具(GPT4Tools 测试集)上表现出强泛化能力。
- 即使实例数量相同,增加工具集的多样性也能提高验证性能。
- 多样性是使紧凑模型具备泛化工具学习能力的关键因素。

更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。