不要微调,直接解码:通过约束解码实现无语法错误的工具使用
Don't Fine-Tune, Decode: Syntax Error-Free Tool Use via Constrained Decoding
AI总结:
提出TOOLDEC解码算法,利用有限状态机强制LLMs遵循工具语法,消除所有语法错误,显著提升通用模型在工具使用任务上的性能,媲美专用微调模型。
摘要:
指令微调的大型语言模型(LLMs)在许多任务中表现出色,但由于复杂且不熟悉的语法约束,常常无法使用外部工具。虽然大量的微调和提示可以缓解这个问题,但这些方法成本高昂且难以泛化。此外,由于语法约束在微调期间只是被隐式学习,模型仍然会频繁出现语法错误。基于这些约束可以通过约束解码更好地显式满足这一事实,我们提出了TOOLDEC,一种使用有限状态机强制LLMs遵循工具语法的解码算法。我们的实验表明,TOOLDEC消除了所有语法错误,在各种基础模型和基准测试上取得了显著更好的性能。更令人惊讶的是,当应用于如Mistral-Instruct等通用即用型LLMs时,TOOLDEC将其工具使用准确率从初始的0%提高到令人印象深刻的52%,与如ToolLLM等专用微调模型的性能相匹配。
英文摘要:
Instruction-tuned large language models (LLMs) excel at many tasks but often fail to use external tools due to complicated and unfamiliar syntax constraints. While extensive fine-tuning and prompting can mitigate the issue, these approaches are expensive and hard to generalize. Furthermore, because syntax constraints are only learned implicitly during fine-tuning, models still make frequent syntax errors. Motivated by the fact that these constraints can be better satisfied explicitly with constrained decoding, we propose TOOLDEC, a decoding algorithm using finite state machines to force LLMs to follow tool syntax. Our experiments show that TOOLDEC eliminates all syntax errors, achieving significantly better performance on various base models and benchmarks. More surprisingly, when applied to generalist out-of-the-box LLMs such as Mistral-Instruct, TOOLDEC improves its accuracy in tool use from the initial 0% to an impressive 52%, matching the performance of specialized fine-tuned models such as ToolLLM.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。