Look Before You Leap: Towards Decision-Aware and Generalizable Tool-Usage for Large Language Models
Anchun Gui♠♣ Jian Li♣∗ Yong Dai♣ Nan Du♣ Han Xiao♠ ♠Xiamen University ♣Tencent AI Lab Equal contribution. Work was done during Anchun’s internship at Tencent AI Lab. Corresponding author.
Abstract
Tool-augmented large language models (LLMs) are attracting widespread attention when accessing up-to-date knowledge and alleviating hallucination issues. Nowadays, advanced closed-source LLMs (e.g., ChatGPT) have demonstrated surprising tool-usage capabilities through prompting and in-context learning techniques. To empower the capabilities of open-source LLMs (e.g., LLaMA) in manipulating tools, current efforts focus on either template-driven or token-triggered tool-usage. However, the former hampers LLMs’ flexibility to address diverse user’s queries due to constrained tool interactions, while the latter limits the generalizability when engaging with new tools, since tool-usage learning is based on task- and tool-specific datasets. To alleviate these concerns, in this paper, we propose a decision-aware and generalizable tool-usage framework (DEER). Specifically, we first construct the tool-usage samples with multiple decision branches via an automatic generation pipeline, thereby inspiring the decision-making awareness of LLMs under diverse scenarios. Meanwhile, we propose a novel tool sampling strategy to enhance the generalizability of LLMs over unseen tools. Extensive experime
中文速览
让大语言模型(LLM)学会灵活调用外部工具,是解决它"胡说八道"和知识过时这两大顽疾的关键路径,但现有开源模型的工具调用方案要么死板地按固定模板走流程、不懂得在不必要时放弃调用工具,要么泛化能力差、换一批新工具就歇菜。针对这两个痛点,研究者提出了 DEER 框架:先通过自动化数据生成流水线构建带有多条决策分支的训练样本——模型得先判断"要不要查工具"、再判断"有没有合适的工具",让它真正学会"三思而后行";同时设计了跨类、同类、随机三种混合工具采样策略,让模型在训练时反复面对没见过的工具组合,从而大幅提升泛化能力。实验结果显示,DEER 在"是否搜索工具"和"是否调用工具"两项决策准确率上分别达到 98.6% 和 88.2%,全面超越 GPT-4(78.1% 和 87.6%),并在多个包含未见工具的测试集上持续领先,证明开源小模型完全可以在工具调用的智能决策和跨工具泛化上比肩乃至超过顶级闭源模型。
原文 arXiv:2402.16696;中英对照 + 大白话阅读 https://aha.fim.ai/paper/2402.16696v3