mlsanityData to 14 Oct 2026

Constrained Decoding of Diffusion LLMs with Context-Free Grammars

arXiv 2508.10111 ↗First posted 13 Aug 2025cs.LG cs.FL cs.PLcited by 14

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have shown promising performance across diverse domains. Many practical applications of LLMs, such as code completion and structured data extraction, require adherence to syntactic constraints specified by a formal language. Yet, due to their probabilistic nature, LLM output is not guaranteed to adhere to such formal languages. Prior work has proposed constrained decoding as a means to restrict LLM generation to particular formal languages. However, existing works are not applicable to the emerging paradigm of diffusion LLMs, when used in practical scenarios such as the generation of formally correct C++ or JSON output. In this paper we address this challenge and present the first constrained decoding method for diffusion models, one that can handle formal languages captured by context-free grammars. We begin by reducing constrained decoding to the more general additive infilling problem, which asks whether a partial output can be completed to a valid word in the target language. This problem also naturally subsumes the previously unaddressed multi-region infilling constrained decoding. We then reduce this problem to the task of deciding whether the intersection of the target language and a regular language is empty and present an efficient algorithm to solve it for context-free languages. Empirical results on various applications, such as C++ code infilling and structured data extraction in JSON, demonstrate that our method achieves near-perfect syntactic correctness while consistently preserving or improving functional correctness. Importantly, our efficiency optimizations ensure that the computational overhead remains practical.

Key facts. Cited by 14 papers in the map (data through 14 Oct 2026). Builds on 30 of its 52 references that are in the map. First posted on arXiv 13 Aug 2025.

Builds on

30 of 52 references.

References · 30

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2023GPT-4 Technical Reportcited by 18,396
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
  5. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  6. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
  7. 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,998
  8. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  9. 2025Large Language Diffusion Modelscited by 912
  10. 2024A Survey on Large Language Models for Code Generationcited by 658
  11. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  12. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
18 more
  1. 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
  2. 2022Efficient Training of Language Models to Fill in the Middlecited by 255
  3. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
  4. 2025DiffuCoder: Understanding and Improving Masked Diffusion Models for Code Generationcited by 187
  5. 2022Synchromesh: Reliable code generation from pre-trained language modelscited by 156
  6. 2024CodeGemma: Open Code Models Based on Gemmacited by 150
  7. 2024SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agentscited by 133
  8. 2023What Formal Languages Can Transformers Express? A Surveycited by 124
  9. 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 101
  10. 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
  11. 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
  12. 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 41
  13. 2025Type-Constrained Code Generation with Language Modelscited by 35
  14. 2025DINGO: Constrained Inference for Diffusion LLMscited by 16
  15. 2025Enhancing Code Generation for Low-Resource Languages: No Silver Bulletcited by 10
  16. 2024Constrained Decoding for Fill-in-the-Middle Code Language Models via Efficient Left and Right Quotienting of Context-Sensitive Grammarscited by 8
  17. 2018Live Functional Programming with Typed Holescited by 7
  18. 2024Subsequence Matching and Analysis Problems for Formal Languagescited by 1

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 2; 2026: 12.

14 papers.

Sort:

By area:

Similar, not cited

Close in wording, no citation either way

  1. 2026Locally Coherent Parallel Decoding in Diffusion Language Models
  2. 2024Grammar-Aligned Decoding
  3. 2025Free Draft-and-Verification: Toward Lossless Parallel Decoding for Diffusion Large Language Models
  4. 2025Fast-dLLM: Training-free Acceleration of Diffusion LLM by Enabling KV Cache and Parallel Decoding
  5. 2025Accelerating Diffusion LLM Inference via Local Determinism Propagation
  6. 2026d3LLM: Ultra-Fast Diffusion LLM using Pseudo-Trajectory Distillation
  7. 2025Beyond Confidence: Adaptive and Coherent Decoding for Diffusion Language Models
  8. 2026HaloBlock: Faster and Better Decoding for Diffusion Large Language Models