The Hidden Cost of Structured Generation in LLMs: Draft-Conditioned Constrained Decoding
Abstract
Lay Summary
Many AI systems are now used to generate outputs that software can execute directly, such as database queries, function calls, and structured data files. These outputs must follow strict formats, as even a minor formatting error can cause a system to fail. Existing methods enforce these rules while the AI is generating its response, but this often disrupts its reasoning process and leads to answers that are correctly formatted but factually wrong. We propose a simple alternative. Instead of forcing the AI to think and format its answer simultaneously, we first allow it to produce an unrestricted draft that captures its reasoning. We then convert that draft into the required format, ensuring the final output complies with all structural rules. This separation allows the model to focus on solving the problem before worrying about formatting. Across a range of mathematical and logical reasoning tasks, our method produces substantially more correct structured outputs than existing approaches. These results suggest that separating “thinking” from “formatting” can make AI systems more reliable when they are used as components of software tools and automated workflows.