mlsanityData to 14 Oct 2026

Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Sampling

arXiv 2504.05410 ↗First posted 7 Apr 2025cs.CL cs.AI cs.LGcited by 21

Not on the map. Why?

Abstract (arXiv)

The dominant approach to generating from language models subject to some constraint is locally constrained decoding (LCD), incrementally sampling tokens at each time step such that the constraint is never violated. Typically, this is achieved through token masking: looping over the vocabulary and excluding non-conforming tokens. There are two important problems with this approach. (i) Evaluating the constraint on every token can be prohibitively expensive -- LM vocabularies often exceed 100,000 tokens. (ii) LCD can distort the global distribution over strings, sampling tokens based only on local information, even if they lead down dead-end paths. This work introduces a new algorithm that addresses both these problems. First, to avoid evaluating a constraint on the full vocabulary at each step of generation, we propose an adaptive rejection sampling algorithm that typically requires orders of magnitude fewer constraint evaluations. Second, we show how this algorithm can be extended to produce low-variance, unbiased estimates of importance weights at a very small additional cost -- estimates that can be soundly used within previously proposed sequential Monte Carlo algorithms to correct for the myopic behavior of local constraint enforcement. Through extensive empirical evaluation in text-to-SQL, molecular synthesis, goal inference, pattern matching, and JSON domains, we show that our approach is superior to state-of-the-art baselines, supporting a broader class of constraints and improving both runtime and performance. Additional theoretical and empirical analyses show that our method's runtime efficiency is driven by its dynamic use of computation, scaling with the divergence between the unconstrained and constrained LM, and as a consequence, runtime improvements are greater for better models.

Key facts. Cited by 21 papers in the map (data through 14 Oct 2026). Builds on 64 of its 103 references that are in the map. First posted on arXiv 7 Apr 2025.

Builds on

64 of 103 references.

References · 64

  1. 2022Training language models to follow instructions with human feedbackcited by 15,971
  2. 2021Training Verifiers to Solve Math Word Problemscited by 10,109
  3. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
  4. 2023Let's Verify Step by Stepcited by 3,789
  5. 2020Learning to summarize from human feedbackcited by 2,588
  6. 2022Do As I Can, Not As I Say: Grounding Language in Robotic Affordancescited by 2,348
  7. 2019Fine-Tuning Language Models from Human Preferencescited by 2,150
  8. 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,745
  9. 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,141
  10. 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
  11. 2023Math-Shepherd: Verify and Reinforce LLMs Step-by-step without Human Annotationscited by 928
  12. 2021Measuring Coding Challenge Competence With APPScited by 902
38 more
  1. 2022Solving math word problems with process- and outcome-based feedbackcited by 901
  2. 2024Generative Verifiers: Reward Modeling as Next-Token Predictioncited by 480
  3. 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
  4. 2020GeDi: Generative Discriminator Guided Sequence Generationcited by 378
  5. 2021FUDGE: Controlled Text Generation With Future Discriminatorscited by 376
  6. 2017Six Challenges for Neural Machine Translationcited by 335
  7. 2024DeepSeek-Prover: Advancing Theorem Proving in LLMs through Large-Scale Synthetic Datacited by 234
  8. 2023Efficient Guided Generation for Large Language Modelscited by 200
  9. 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
  10. 2023LINC: A Neurosymbolic Approach for Logical Reasoning by Combining Language Models with First-Order Logic Proverscited by 168
  11. 2021Constrained Language Models Yield Few-Shot Semantic Parserscited by 163
  12. 2022COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamicscited by 161
  13. 2022Synchromesh: Reliable code generation from pre-trained language modelscited by 156
  14. 2021NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristicscited by 154
  15. 2020NeuroLogic Decoding: (Un)supervised Neural Text Generation with Predicate Logic Constraintscited by 149
  16. 2024Stream of Search (SoS): Learning to Search in Languagecited by 145
  17. 2022Natural Language to Code Translation with Executioncited by 124
  18. 2018Correcting Length Bias in Neural Machine Translationcited by 120
  19. 2019On NMT Search Errors and Model Errors: Cat Got Your Tongue?cited by 114
  20. 2024Critique-out-Loud Reward Modelscited by 106
  21. 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 101
  22. 2023Amortizing intractable inference in large language modelscited by 97
  23. 2024Probabilistic Inference in Language Models via Twisted Sequential Monte Carlocited by 90
  24. 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 80
  25. 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Modelscited by 75
  26. 2023Grounded Decoding: Guiding Text Generation with Grounded Models for Embodied Agentscited by 67
  27. 2023Tractable Control for Autoregressive Language Generationcited by 65
  28. 2019Elements of Sequential Monte Carlocited by 64
  29. 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
  30. 2024Grammar-Aligned Decodingcited by 54
  31. 2024Automata-based constraints for language model decodingcited by 51
  32. 2021Few-Shot Semantic Parsing with Language Models Trained On Codecited by 50
  33. 2025Flexible and Efficient Grammar-Constrained Decodingcited by 43
  34. 2022Controllable Text Generation with Neurally-Decomposed Oraclecited by 41
  35. 2025CRANE: Reasoning with constrained LLM generationcited by 38
  36. 2022Validating Large Language Models with ReLMcited by 33
  37. 2024Planetarium: A Rigorous Benchmark for Translating Text to Structured Planning Languagescited by 33
  38. 2024Adaptable Logical Control for Large Language Modelscited by 30

50 most cited of 64 All 64 (JSON)

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 5; 2026: 16.

21 papers.

Sort:

By area:

  1. 2025Sample More to Think Less: Group Filtered Policy Optimization for Concise Reasoningcited by 75
  2. 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspectivecited by 14
  3. 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposalscited by 8
  4. 2026Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlocited by 5
  5. 2025Auditing Pay-Per-Token in Large Language Modelscited by 4
  6. 2025Constrained Adaptive Rejection Samplingcited by 3
  7. 2026Ensembling Language Models with Sequential Monte Carlocited by 3
  8. 2026Reject, Resample, Repeat: Understanding Parallel Reasoning in Language Model Inferencecited by 3
  9. 2026The Format Taxcited by 3
  10. 2026How Open Must Language Models be to Enable Reliable Scientific Inference?cited by 2
  11. 2026Adaptive Multilevel Twisted Sequential Monte Carlo for Rare Events Estimation in Language Modelscited by 2
  12. 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Modelscited by 1
9 more
  1. 2026Decoupling Exploration and Policy Optimization: Uncertainty Guided Tree Search for Hard Explorationcited by 1
  2. 2026Large Databases Need Small, Open-Weight Language Modelscited by 1
  3. 2026Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliancecited by 1
  4. 2026Greedy or not, here I come: Language production under vocabulary constraints in humans and resource-rational modelscited by 0
  5. 2026We Hebben Een Serieus Translatie: Modeling Intercomprehension as Probabilistic Inferencecited by 0
  6. 2026Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Codecited by 0
  7. 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decodingcited by 0
  8. 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learningcited by 0
  9. 2026Provably Tractable NFA-Constrained Language Generation via HMMscited by 0