[论文解读] Lookahead-then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free Grammars
LAVE 是一种针对扩散式语言模型的受限解码方法,利用并行令牌预测的前瞻来验证 CFG 约束,在多种模型和基准上实现近 100% 的句法正确性,且运行时开销可忽略。
Diffusion Large Language Models (dLLMs) have demonstrated promising generative capabilities and are increasingly used to produce formal languages defined by context-free grammars, such as source code and chemical expressions. However, as probabilistic models, they still struggle to generate syntactically valid outputs reliably. A natural and promising direction to address this issue is to adapt constrained decoding techniques to enforce grammatical correctness during generation. However, applying these techniques faces two primary obstacles. On the one hand, the non-autoregressive nature of dLLMs renders most existing constrained decoding approaches inapplicable. On the other hand, current approaches specifically designed for dLLMs may allow intermediate outputs that are impossible to complete into valid sentences, which significantly limits their reliability in practice. To address these challenges, we present LAVE, a constrained decoding approach specifically designed for dLLMs. Our approach leverages a key property of dLLMs, namely their ability to predict token distributions for all positions in parallel during each forward pass. Whenever a new token is proposed by model, LAVE performs lookahead using these distributions to efficiently and reliably verify the validity of the proposed token. This design ensures reliable constraints by reliably preserving the potential for intermediate outputs to be extended into valid sentences. Extensive experiments across four widely used dLLMs and three representative benchmarks demonstrate that LAVE consistently outperforms existing baselines and achieves substantial improvements in syntactic correctness, while incurring negligible runtime overhead.
研究动机与目标
- 识别扩散式语言模型(dLLMs)在 CFG 约束解码中的可靠性差距。
- 开发一套针对 dLLMs 的非自回归生成的受限解码方法。
- 确保中间输出在 CFG 下仍可扩展成有效句子。
- 证明所提方法在各种文法下提升句法和功能正确性。
- 评估多模型和基准下方法的运行时开销与鲁棒性。
提出的方法
- 利用 dLLMs 的并行令牌预测通过对当前未完成输出进行完整前缀采样来执行前瞻。
- 使用语法解析器验证是否任意前瞻完整前缀都能扩展为有效句子(IsExtendable)。
- 只有当至少一个采样的完整前缀可扩展时才接受提议的令牌;否则拒绝并重新采样。
- 维护一个已验证前缀的缓存(y_cache),以在解码遇到停滞时引导恢复。
- 引入轻量级的缓存增强恢复,替换当前上下文为可验证前缀,并在必要时将下一个令牌分布限制为可接受的令牌。
- 提供带有参数的实现细节:前瞻大小 N 和尝试预算 τ,并使用 Earley 解析进行 CFG 验证。
实验结果
研究问题
- RQ1RQ1: 相较于基线,LAVE 在多大程度上确保 dLLM 输出的句法正确性?
- RQ2RQ2: LAVE 在多大程度上提升了 dLLM 输出的功能正确性?
- RQ3RQ3: LAVE 引入的运行时开销有多大?
- RQ4RQ4: LAVE 的各组成部分如何贡献于整体性能?
- RQ5RQ5: 超参数如何影响 LAVE 的性能?
主要发现
- LAVE 在四个 dLLM 和三个基于 CFG 的基准测试中始终优于基线,在句法正确性方面表现出色。
- 在许多设置中,句法正确性提升接近 100%,相较于以往的受限解码方法有显著提升。
- 在许多情景下,功能正确性也有所提升,且通常超过替代方法的增益。
- LAVE 的运行时开销被报告为可忽略。
- 消融研究表明各组件对性能有积极贡献,且 LAVE 对超参数变动具鲁棒性。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。