arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2607.07026cs.LG
收藏

通过有限自动机上的高效推理实现扩散语言模型的约束解码

Constrained Decoding for Diffusion Language Models via Efficient Inference over Finite Automata

Stanford University(斯坦福大学)

Meihua Dang, Stefano Ermon

AI总结:

研究扩散语言模型的约束解码问题,提出基于有限自动机高效推理的算法,能保证约束满足,支持多种解码方式,经实验验证在多种任务上提升准确率且推理开销小。

摘要:

约束解码对于大语言模型至关重要,现有系统针对自回归模型设计,扩散语言模型打破了其假设。本文提出一种精确且易处理的算法,用于从以有限自动机表示的约束下的平均场后验中采样。将有限自动机视为图形模型以获得易处理表示,保证约束满足,支持多种解码方式,还应用深度缩减技术降低采样深度。实验表明该方法在多种任务上显著提高准确率且推理开销小。

英文摘要:

Constrained decoding is essential for serving LLMs, ensuring that generated outputs follow specific structures such as JSON schema-formatted function calls. Existing systems are designed for autoregressive models and assume left-to-right generation, masking out invalid next tokens at each step. Diffusion language models, however, break this assumption: they sample multiple positions simultaneously from a fully-factorized mean-field distribution at each denoising step. In this paper, we present an exact and tractable algorithm for sampling from the constrained mean-field posterior under any constraint expressible as a finite automaton. Viewing finite automata as graphical models, we obtain tractable representations of the constrained distribution that enable efficient inference. The approach guarantees constraint satisfaction by construction, supports both greedy and sampling-based decoding, and is compatible with parallel and block-wise decoding under arbitrary remasking schedules. Applying depth-reduction techniques from arithmetic circuit theory, we further reduce sampling depth from linear to logarithmic in the sequence length. Empirical evaluations on Dream-7B and LLaDA-8B show substantial accuracy gains across various tasks including function calling (xLAM, BFCL), planning (Sudoku, Countdown), text-to-SQL (Spider), and math reasoning (GSM-Symbolic), with little inference overhead relative to unconstrained decoding. For example, on BFCL-Live, our approach improves Dream-7B's greedy decoding accuracy from 63.9% to 71.5%, and stochastic sampling accuracy from 22.3% to 69.0%, where the unconstrained baseline collapses, with under 5% wall-clock overhead.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑