[论文解读] Draft-Conditioned Constrained Decoding for Structured Generation in LLMs
DCCD 引入一个两步、训练无关的推理方法,先生成无约束草稿再进行条件化受约束解码,提升严格结构化准确性与参数效率,适用于不同模型规模与约束类型。
Large language models (LLMs) are increasingly used to generate executable outputs, JSON objects, and API calls, where a single syntax error can make the output unusable. Constrained decoding enforces validity token-by-token via masking and renormalization, but it can distort generation when the model assigns low probability mass to valid continuations, pushing decoding toward locally valid yet semantically incorrect trajectories. We propose \emph{Draft-Conditioned Constrained Decoding (DCCD)}, a simple two-step, training-free inference procedure that decouples semantic planning from structural enforcement: an unconstrained draft is generated first, and constrained decoding is then applied, conditioned on this draft, to guarantee validity. We analyze DCCD through a KL-projection view, showing that draft conditioning increases feasible mass and reduces the cumulative "projection tax" induced by hard constraints, with an optional best-of-$K$ draft selection. Across structured reasoning benchmarks, DCCD improves strict structured accuracy by up to +24 percentage points over standard constrained decoding (e.g., 15.2\% to 39.0\% on GSM8K with a 1B model), and enables smaller model pairs to match or exceed much larger constrained baselines, yielding substantial gains in parameter efficiency.
研究动机与目标
- 理解在标准受约束解码下,硬约束如何扭曲结构化生成。
- 提出一种两步、基于草稿的条件方法,以在约束执行前增加可行质量。
- 量化在不同模型规模和约束类型下对严格结构化准确性与参数效率的改进。
- 评估测试时间的扩展性以及基于草稿的选择策略。
- 提供可复现的代码与关于为什么以及何时 DCCD 有效的洞见。
提出的方法
- 模型无关的两步推理:草稿生成(无约束)随后进行草稿条件的受约束解码。
- KL 投影视角分析约束引起的失真与可行质量。
- 定义草稿条件的可行质量和两模型组合(草稿模型与投影模型)。
- 算法1:生成 K 个草稿,基于每个草稿进行受约束解码的计算,以累积对数可行质量来选择最佳草稿。
- 可选的最佳草稿组合选择以提高鲁棒性。
- 在 GSM8K、MATH500、GSM-Symbolic、FOLIO(带 JSON 结构、语法和 prover 校验表单)上的经验评估。
实验结果
研究问题
- RQ1DCCD 相对于提示法和标准受约束解码,在不同模型尺寸下是否能提高严格结构化准确性?
- RQ2在两模型组合下,DCCD 是否能实现比单一模型受约束解码更高的参数效率?
- RQ3测试时的草稿采样对 DCCD 的性能与扩展性相对于受约束解码有何影响?
- RQ4在不同约束类型(JSON 结构、表达式语法、prove 校验表单)和推理基准下,改进是否具有一致性?
主要发现
| 数据集 | 模型大小 | 算法 | GSM8K | GSM Symbolic | Math500 | FOLIO |
|---|---|---|---|---|---|---|
| GSM8K | 1B | CP | 7.51 | 6.00 | 6.40 | 0.00 |
| GSM8K | 1B | CF | 13.80 | 9.00 | 11.60 | 0.00 |
| GSM8K | 1B | CD | 15.24 | 0.00 | 6.00 | 19.70 |
| GSM8K | 1B | DCCD | 39.04 | 9.00 | 19.80 | 21.67 |
| GSM8K | 1.5B | CP | 13.27 | 11.00 | 15.00 | 0.00 |
| GSM8K | 1.5B | CF | 48.22 | 23.00 | 21.60 | 0.00 |
| GSM8K | 1.5B | CD | 49.36 | 12.00 | 15.00 | 14.78 |
| GSM8K | 1.5B | DCCD | 73.92 | 23.00 | 38.20 | 18.23 |
| GSM8K | 3B | CP | 59.14 | 19.00 | 30.00 | 1.00 |
| GSM8K | 3B | CF | 71.80 | 25.00 | 32.40 | 0.00 |
| GSM8K | 3B | CD | 73.24 | 17.00 | 33.40 | 20.69 |
| GSM8K | 3B | DCCD | 84.53 | 36.00 | 46.80 | 21.67 |
| GSM8K | 7B | CP | 80.06 | 31.00 | 40.40 | 0.00 |
| GSM8K | 7B | CF | 82.26 | 29.00 | 44.20 | 0.00 |
| GSM8K | 7B | CD | 81.58 | 26.00 | 43.60 | 19.70 |
| GSM8K | 7B | DCCD | 91.28 | 41.00 | 52.80 | 31.53 |
| GSM8K | 8B | CP | 76.80 | 17.00 | 27.00 | 0.00 |
| GSM8K | 8B | CF | 70.20 | 14.00 | 24.80 | 0.49 |
| GSM8K | 8B | CD | 80.89 | 19.00 | 28.60 | 23.15 |
| GSM8K | 8B | DCCD | 83.02 | 30.00 | 35.00 | 27.09 |
| GSM8K | 14B | CP | 91.13 | 44.00 | 47.00 | 0.00 |
| GSM8K | 14B | CF | 90.52 | 49.00 | 45.80 | 0.49 |
| GSM8K | 14B | CD | 86.43 | 37.00 | 47.60 | 18.72 |
| GSM8K | 14B | DCCD | 95.15 | 53.00 | 58.60 | 25.62 |
- DCCD 在不同模型规模(1B–14B)和约束类型上,相较于 CP、CF、CD,持续提升严格结构化准确性。
- DCCD 实现参数高效的模型组合,优于较大单模型的受约束基线,显示每参数的准确性更高。
- 测试时对草稿的采样比重复进行基于约束的采样带来更大收益,且收益随时间增加直到某个点。
- DCCD 提高响应的置信度分布并降低投影代价,尤其在容量较低的模型中。
- 在不同数据集上,例如对 GSM8K 的 1B 模型,在 JSON 约束下严格准确性从 15.24% 提升到 39.0%;1.5B 模型从 49.36% 提升到 73.92%。
- DCCD 的两模型方法使较小模型能够达到甚至超过更大受约束基线,展示了显著的参数效率。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。