mlsanityData to 14 Oct 2026

Constrained Sampling for Language Models Should Be Easy: An MCMC Perspective

arXiv 2506.05754 ↗First posted 6 Jun 2025cs.AI cs.CL cs.LGcited by 14

Not on the map. Why?

Abstract (arXiv)

Constrained decoding enables Language Models (LMs) to produce samples that provably satisfy hard constraints. However, existing constrained-decoding approaches often distort the underlying model distribution, a limitation that is especially problematic in applications like program fuzzing, where one wants to generate diverse and valid program inputs for testing purposes. We propose a new constrained sampling framework based on Markov Chain Monte Carlo (MCMC) that simultaneously satisfies three core desiderata: constraint satisfying (every sample satisfies the constraint), monotonically converging (the sampling process converges to the true conditional distribution), and efficient (high-quality samples emerge in few steps). Our method constructs a proposal distribution over valid outputs and applies a Metropolis-Hastings acceptance criterion based on the LM's likelihood, ensuring principled and efficient exploration of the constrained space. Empirically, our sampler outperforms existing methods on both synthetic benchmarks and real-world program fuzzing tasks.

Key facts. Cited by 14 papers in the map (data through 14 Oct 2026). Builds on 25 of its 57 references that are in the map. First posted on arXiv 6 Jun 2025.

Builds on

25 of 57 references.

References · 25

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  2. 2022Diffusion-LM Improves Controllable Text Generationcited by 1,027
  3. 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 427
  4. 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
  5. 2022Efficient Training of Language Models to Fill in the Middlecited by 255
  6. 2017Lexically Constrained Decoding for Sequence Generation Using Grid Beam Searchcited by 237
  7. 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
  8. 2018Fast Lexically Constrained Decoding with Dynamic Beam Allocation for Neural Machine Translationcited by 182
  9. 2021Constrained Language Models Yield Few-Shot Semantic Parserscited by 163
  10. 2022COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamicscited by 161
  11. 2021NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristicscited by 154
  12. 2020NeuroLogic Decoding: (Un)supervised Neural Text Generation with Predicate Logic Constraintscited by 149
13 more
  1. 2016Guided Open Vocabulary Image Captioning with Constrained Beam Searchcited by 105
  2. 2024Let Me Speak Freely? A Study on the Impact of Format Restrictions on Performance of Large Language Modelscited by 96
  3. 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 80
  4. 2025JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Modelscited by 71
  5. 2023Tractable Control for Autoregressive Language Generationcited by 65
  6. 2022Gradient-Based Constrained Sampling from Language Modelscited by 64
  7. 2025Flexible and Efficient Grammar-Constrained Decodingcited by 43
  8. 2018Evaluating Fuzz Testingcited by 32
  9. 2024Adaptable Logical Control for Large Language Modelscited by 30
  10. 2025Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Samplingcited by 21
  11. 2023Zero and Few-shot Semantic Parsing with Ambiguous Inputscited by 16
  12. 2024Controllable Generation via Locally Constrained Resamplingcited by 11
  13. 2022CodePAD: Sequence-based Code Generation with Pushdown Automatoncited by 7

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 3; 2026: 11.

14 papers.

Sort:

By area: