Tools serve as pivotal interfaces that enable humans to understand and reshape the environment. With the advent of foundation models, AI systems can utilize tools to expand their capabilities and interact with the real world. Existing tool learning methodologies, encompassing supervised fine-tuning and prompt engineering approaches, often induce large language models to utilize tools indiscriminately, as complex tasks often exceed their own competencies. However, introducing tools for simple tasks, which the models themselves can readily resolve, can inadvertently propagate errors rather than enhance performance. This leads to the research question: can we teach language models when and how to use tools? To meet this need, we propose Tool leaRning wIth exeCution fEedback (TRICE), a two-stage end-to-end framework that enables the model to continually learn through feedback derived from tool execution, thereby learning when and how to use tools effectively. Experimental results, backed by further analysis, show that TRICE can make the large language model selectively use tools by improving the accuracy of tool usage while enhancing insufficient tool learning and mitigating excessive reliance on tools. Code and datasets are available in https://github.com/zjunlp/trice.
翻译:工具作为关键接口,使人类能够理解和改造环境。随着基础模型的出现,人工智能系统可以利用工具扩展自身能力并与现实世界交互。现有的工具学习方法(包括监督微调和提示工程方法)往往诱导大型语言模型不加区分地使用工具,因为复杂任务常常超出其自身能力。然而,为模型本身能够轻松解决的简单任务引入工具,不仅无法提升性能,反而可能无意中传播错误。这引出了一个研究问题:我们能否教会语言模型何时以及如何使用工具?为满足这一需求,我们提出TRICE(工具学习与执行反馈),这是一个两阶段端到端框架,使模型能够通过工具执行产生的反馈持续学习,从而有效掌握工具的使用时机与方法。实验结果及进一步分析表明,TRICE能够使大型语言模型通过提升工具使用准确率、增强不足的工具学习能力并缓解对工具的过度依赖,从而选择性使用工具。代码和数据集可在https://github.com/zjunlp/trice获取。