CLAIOct 10, 2023

Don't Fine-Tune, Decode: Syntax Error-Free Tool Use via Constrained Decoding

arXiv:2310.07075v38 citationsh-index: 11
Originality Highly original
AI Analysis

This addresses the issue of unreliable tool use in LLMs for developers and users, offering a cost-effective alternative to fine-tuning.

The paper tackles the problem of large language models making syntax errors when using external tools by proposing TOOLDEC, a constrained decoding algorithm that eliminates all syntax errors and improves tool use accuracy from 0% to 52% for generalist models, matching specialized fine-tuned models.

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.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes