mlsanityData to 14 Oct 2026

Grammar-Aligned Decoding

arXiv 2405.21047 ↗First posted 31 May 2024cs.AI cs.CL cs.LGcited by 54

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) struggle with reliably generating highly structured outputs, such as program code, mathematical formulas, or well-formed markup. Constrained decoding approaches mitigate this problem by greedily restricting what tokens an LLM can output at each step to guarantee that the output matches a given constraint. Specifically, in grammar-constrained decoding (GCD), the LLM's output must follow a given grammar. In this paper, we demonstrate that GCD techniques (and in general constrained decoding techniques) can distort the LLM's distribution, leading to outputs that are grammatical but appear with likelihoods that are not proportional to the ones given by the LLM, and so ultimately are low-quality. We call the problem of aligning sampling with a grammar constraint, grammar-aligned decoding (GAD), and propose adaptive sampling with approximate expected futures (ASAp), a decoding algorithm that guarantees the output to be grammatical while provably producing outputs that match the conditional probability of the LLM's distribution conditioned on the given grammar constraint. Our algorithm uses prior sample outputs to soundly overapproximate the future grammaticality of different output prefixes. Our evaluation on code generation and structured NLP tasks shows how ASAp often produces outputs with higher likelihood (according to the LLM's distribution) than existing GCD techniques, while still enforcing the desired grammatical constraints.

Key facts. Cited by 54 papers in the map (data through 14 Oct 2026). Builds on 14 of its 28 references that are in the map. First posted on arXiv 31 May 2024.

Builds on

14 of 28 references.

References · 14

  1. 2022Diffusion-LM Improves Controllable Text Generationcited by 1,027
  2. 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
  3. 2017Lexically Constrained Decoding for Sequence Generation Using Grid Beam Searchcited by 237
  4. 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
  5. 2018Fast Lexically Constrained Decoding with Dynamic Beam Allocation for Neural Machine Translationcited by 182
  6. 2021Constrained Language Models Yield Few-Shot Semantic Parserscited by 163
  7. 2022COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamicscited by 161
  8. 2021NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristicscited by 154
  9. 2020NeuroLogic Decoding: (Un)supervised Neural Text Generation with Predicate Logic Constraintscited by 149
  10. 2016Guided Open Vocabulary Image Captioning with Constrained Beam Searchcited by 105
  11. 2022Gradient-Based Constrained Sampling from Language Modelscited by 64
  12. 2023Zero and Few-shot Semantic Parsing with Ambiguous Inputscited by 16
2 more
  1. 2022CodePAD: Sequence-based Code Generation with Pushdown Automatoncited by 7
  2. 2024On the Challenges of Fuzzing Techniques via Large Language Modelscited by 4

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 5; 2025: 17; 2026: 32.

54 papers.

Sort:

By area:

  1. 2025Syntactic and Semantic Control of Large Language Models via Sequential Monte Carlocited by 46
  2. 2025Flexible and Efficient Grammar-Constrained Decodingcited by 43
  3. 2025CRANE: Reasoning with constrained LLM generationcited by 38
  4. 2025Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Samplingcited by 21
  5. 2025DINGO: Constrained Inference for Diffusion LLMscited by 16
  6. 2025Self-Steering Language Modelscited by 13
  7. 2024Controllable Generation via Locally Constrained Resamplingcited by 11
  8. 2026SEVerA: Verified Synthesis of Self-Evolving Agentscited by 8
  9. 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposalscited by 8
  10. 2024Grammar-based Game Description Generation using Large Language Modelscited by 7
  11. 2024Mind the Data Gap: Bridging LLMs to Enterprise Data Integrationcited by 7
  12. 2025Correctness-Guaranteed Code Generation via Constrained Decodingcited by 7
38 more
  1. 2024Using a Feedback Loop for LLM-based Infrastructure as Code Generationcited by 5
  2. 2025Constrained Decoding for Safe Robot Navigation Foundation Modelscited by 5
  3. 2025TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code Generationcited by 5
  4. 2026Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlocited by 5
  5. 2025XML Prompting as Grammar-Constrained Interaction: Fixed-Point Semantics, Convergence Guarantees, and Human-AI Protocolscited by 4
  6. 2025The Future of Generative AI in Software Engineering: A Vision from Industry and Academia in the European GENIUS Projectcited by 4
  7. 2024Approximately Aligned Decodingcited by 3
  8. 2025Constrained Adaptive Rejection Samplingcited by 3
  9. 2025Metamodel-Guided Model Generation with Layered Constraintscited by 3
  10. 2026Hard Constraints Meet Soft Generation: Guaranteed Feasibility for LLM-based Combinatorial Optimizationcited by 3
  11. 2026Semantic Layers for Reliable LLM-Powered Data Analytics: A Paired Benchmark of Accuracy and Hallucination Across Three Frontier Modelscited by 3
  12. 2026The Structured Output Benchmark: A Multi-Source Benchmark for Evaluating Structured Output Quality in Large Language Modelscited by 3
  13. 2026Typed Decision Models: An Early Evidence Audit and Evaluation Checklistcited by 3
  14. 2025Positional Fragility in LLMs: How Offset Effects Reshape Our Understanding of Memorization Riskscited by 2
  15. 2026Future Validity is the Missing Statistic: From Impossibility to Phi-Estimation for Grammar-Faithful Speculative Decodingcited by 2
  16. 2026Naive Prompt Optimization: Rethinking the Need for Complex Prompt Searchcited by 2
  17. 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Modelscited by 1
  18. 2026SEAR: Schema-Based Evaluation and Routing for LLM Gatewayscited by 1
  19. 2026One Token Away from Collapse: The Fragility of Instruction-Tuned Helpfulnesscited by 1
  20. 2026From Unstructured Recall to Schema-Grounded Memory: Reliable AI Memory via Iterative, Schema-Aware Extractioncited by 1
  21. 2026When Correct Isn't Usable: Improving Structured Output Reliability in Small Language Modelscited by 1
  22. 2026Shaping Schema via Language Representation as the Next Frontier for LLM Intelligence Expandingcited by 1
  23. 2026Extending Confidence-Based Text2Cypher with Grammar and Schema Aware Filteringcited by 1
  24. 2026TruncProof: A Guardrail for LLM-based JSON Generation under Token-Length Constraintscited by 1
  25. 2025textttSEM-CTRL: Semantically Controlled Decodingcited by 0
  26. 2025Empirical Computation: Prompting versus Programmingcited by 0
  27. 2026Continuous Diffusion Models Can Obey Formal Syntaxcited by 0
  28. 2026Specification-Aware Distribution Shaping for Robotics Foundation Modelscited by 0
  29. 2026LLM-Powered Workflow Optimization for Multidisciplinary Software Development: An Automotive Industry Case Studycited by 0
  30. 2026ATLAS-RTC: Closing the Loop on LLM Agent Output with Token-Level Runtime Controlcited by 0
  31. 2026Context-Instrumental Data Distillation for Kubernetes Manifest Generation: Method and Experimental Evaluationcited by 0
  32. 2026Format Sensitivity Index: Token-Controlled Prompt Wrapper Robustness and Schema Compliance in LLM Benchmarkingcited by 0
  33. 2026GRID: Grammar-Railed Decoding for Enterprise SQL Generationcited by 0
  34. 2026Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Codecited by 0
  35. 2026Natural-Language to SysMLv2 Translation via Conformance-Driven Iterative Refinementcited by 0
  36. 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decodingcited by 0
  37. 2026Meta-Ctrl: Guaranteed Plan Generation by Decoupling Syntactic and Semantic Constraintscited by 0
  38. 2026Beam Search, Self-Consistency, and the Limits of Inference-Time Scaling for Grammar-Constrained Text-to-SQL in Small Language Modelscited by 0

50 most cited of 54 All 54 (JSON)

Similar, not cited

Close in wording, no citation either way

  1. 2025Constrained Decoding of Diffusion LLMs with Context-Free Grammars
  2. 2026Attention Meets Reachability: Structural Equivalence and Efficiency in Grammar-Constrained LLM Decoding
  3. 2023Don't Fine-Tune, Decode: Syntax Error-Free Tool Use via Constrained Decoding
  4. 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generation
  5. 2025p-less Sampling: A Robust Hyperparameter-Free Approach for LLM Decoding
  6. 2025(G)I-DLE: Generative Inference via Distribution-preserving Logit Exclusion with KL Divergence Minimization for Constrained Decoding
  7. 2024DeAL: Decoding-time Alignment for Large Language Models
  8. 2026EPIC: Efficient and Parallel Inference under CFG Constraints for Diffusion Language Models