Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Sampling
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
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2021Training Verifiers to Solve Math Word Problemscited by 10,109
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2023Let's Verify Step by Stepcited by 3,789
- 2020Learning to summarize from human feedbackcited by 2,588
- 2022Do As I Can, Not As I Say: Grounding Language in Robotic Affordancescited by 2,348
- 2019Fine-Tuning Language Models from Human Preferencescited by 2,150
- 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,745
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,141
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2023Math-Shepherd: Verify and Reinforce LLMs Step-by-step without Human Annotationscited by 928
- 2021Measuring Coding Challenge Competence With APPScited by 902
38 more
- 2022Solving math word problems with process- and outcome-based feedbackcited by 901
- 2024Generative Verifiers: Reward Modeling as Next-Token Predictioncited by 480
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2020GeDi: Generative Discriminator Guided Sequence Generationcited by 378
- 2021FUDGE: Controlled Text Generation With Future Discriminatorscited by 376
- 2017Six Challenges for Neural Machine Translationcited by 335
- 2024DeepSeek-Prover: Advancing Theorem Proving in LLMs through Large-Scale Synthetic Datacited by 234
- 2023Efficient Guided Generation for Large Language Modelscited by 200
- 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
- 2023LINC: A Neurosymbolic Approach for Logical Reasoning by Combining Language Models with First-Order Logic Proverscited by 168
- 2021Constrained Language Models Yield Few-Shot Semantic Parserscited by 163
- 2022COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamicscited by 161
- 2022Synchromesh: Reliable code generation from pre-trained language modelscited by 156
- 2021NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristicscited by 154
- 2020NeuroLogic Decoding: (Un)supervised Neural Text Generation with Predicate Logic Constraintscited by 149
- 2024Stream of Search (SoS): Learning to Search in Languagecited by 145
- 2022Natural Language to Code Translation with Executioncited by 124
- 2018Correcting Length Bias in Neural Machine Translationcited by 120
- 2019On NMT Search Errors and Model Errors: Cat Got Your Tongue?cited by 114
- 2024Critique-out-Loud Reward Modelscited by 106
- 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 101
- 2023Amortizing intractable inference in large language modelscited by 97
- 2024Probabilistic Inference in Language Models via Twisted Sequential Monte Carlocited by 90
- 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 80
- 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Modelscited by 75
- 2023Grounded Decoding: Guiding Text Generation with Grounded Models for Embodied Agentscited by 67
- 2023Tractable Control for Autoregressive Language Generationcited by 65
- 2019Elements of Sequential Monte Carlocited by 64
- 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
- 2024Grammar-Aligned Decodingcited by 54
- 2024Automata-based constraints for language model decodingcited by 51
- 2021Few-Shot Semantic Parsing with Language Models Trained On Codecited by 50
- 2025Flexible and Efficient Grammar-Constrained Decodingcited by 43
- 2022Controllable Text Generation with Neurally-Decomposed Oraclecited by 41
- 2025CRANE: Reasoning with constrained LLM generationcited by 38
- 2022Validating Large Language Models with ReLMcited by 33
- 2024Planetarium: A Rigorous Benchmark for Translating Text to Structured Planning Languagescited by 33
- 2024Adaptable Logical Control for Large Language Modelscited by 30
50 most cited of 64 All 64 (JSON)
Built on by
Citing papers per year: 2025: 5; 2026: 16.
21 papers.
Sort:
By area:
- 2025Sample More to Think Less: Group Filtered Policy Optimization for Concise Reasoningcited by 75
- 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspectivecited by 14
- 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposalscited by 8
- 2026Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlocited by 5
- 2025Auditing Pay-Per-Token in Large Language Modelscited by 4
- 2025Constrained Adaptive Rejection Samplingcited by 3
- 2026Ensembling Language Models with Sequential Monte Carlocited by 3
- 2026Reject, Resample, Repeat: Understanding Parallel Reasoning in Language Model Inferencecited by 3
- 2026The Format Taxcited by 3
- 2026How Open Must Language Models be to Enable Reliable Scientific Inference?cited by 2
- 2026Adaptive Multilevel Twisted Sequential Monte Carlo for Rare Events Estimation in Language Modelscited by 2
- 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Modelscited by 1
9 more
- 2026Decoupling Exploration and Policy Optimization: Uncertainty Guided Tree Search for Hard Explorationcited by 1
- 2026Large Databases Need Small, Open-Weight Language Modelscited by 1
- 2026Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliancecited by 1
- 2026Greedy or not, here I come: Language production under vocabulary constraints in humans and resource-rational modelscited by 0
- 2026We Hebben Een Serieus Translatie: Modeling Intercomprehension as Probabilistic Inferencecited by 0
- 2026Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Codecited by 0
- 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decodingcited by 0
- 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learningcited by 0
- 2026Provably Tractable NFA-Constrained Language Generation via HMMscited by 0
- 2026Provably Tractable NFA-Constrained Language Generation via HMMs30 Sep 2026
- 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learning30 Sep 2026
- 2026Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliance28 Aug 2026
- 2026Adaptive Multilevel Twisted Sequential Monte Carlo for Rare Events Estimation in Language Models22 Aug 2026
- 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decoding10 Aug 2026
- 2026Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Code15 Jul 2026
- 2026We Hebben Een Serieus Translatie: Modeling Intercomprehension as Probabilistic Inference13 Jul 2026
- 2026Large Databases Need Small, Open-Weight Language Models30 Jun 2026
- 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposals1 Jun 2026
- 2026Greedy or not, here I come: Language production under vocabulary constraints in humans and resource-rational models14 May 2026
- 2026Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlo7 Apr 2026
- 2026The Format Tax4 Apr 2026
9 more
- 2026How Open Must Language Models be to Enable Reliable Scientific Inference?27 Mar 2026
- 2026Decoupling Exploration and Policy Optimization: Uncertainty Guided Tree Search for Hard Exploration23 Mar 2026
- 2026Reject, Resample, Repeat: Understanding Parallel Reasoning in Language Model Inference9 Mar 2026
- 2026Ensembling Language Models with Sequential Monte Carlo5 Mar 2026
- 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Models5 Dec 2025
- 2025Auditing Pay-Per-Token in Large Language Models5 Oct 2025
- 2025Constrained Adaptive Rejection Sampling2 Oct 2025
- 2025Sample More to Think Less: Group Filtered Policy Optimization for Concise Reasoning13 Aug 2025
- 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspective6 Jun 2025
- 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspectivecited by 14
- 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposalscited by 8
- 2026Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlocited by 5
- 2025Auditing Pay-Per-Token in Large Language Modelscited by 4
- 2025Constrained Adaptive Rejection Samplingcited by 3
- 2026Ensembling Language Models with Sequential Monte Carlocited by 3
- 2026The Format Taxcited by 3
- 2026How Open Must Language Models be to Enable Reliable Scientific Inference?cited by 2
- 2026Adaptive Multilevel Twisted Sequential Monte Carlo for Rare Events Estimation in Language Modelscited by 2
- 2026Large Databases Need Small, Open-Weight Language Modelscited by 1
- 2026Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliancecited by 1
- 2026Greedy or not, here I come: Language production under vocabulary constraints in humans and resource-rational modelscited by 0
12 most cited of 16 All 16 (JSON)
- 2026Provably Tractable NFA-Constrained Language Generation via HMMs30 Sep 2026
- 2026Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliance28 Aug 2026
- 2026Adaptive Multilevel Twisted Sequential Monte Carlo for Rare Events Estimation in Language Models22 Aug 2026
- 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decoding10 Aug 2026
- 2026Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Code15 Jul 2026
- 2026We Hebben Een Serieus Translatie: Modeling Intercomprehension as Probabilistic Inference13 Jul 2026
- 2026Large Databases Need Small, Open-Weight Language Models30 Jun 2026
- 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposals1 Jun 2026
- 2026Greedy or not, here I come: Language production under vocabulary constraints in humans and resource-rational models14 May 2026
- 2026Sampling for Quality: Training-Free Reward-Guided LLM Decoding via Sequential Monte Carlo7 Apr 2026
- 2026The Format Tax4 Apr 2026
- 2026How Open Must Language Models be to Enable Reliable Scientific Inference?27 Mar 2026
12 newest of 16 All 16 (JSON)