Controllable Generation via Locally Constrained Resampling
Not on the map. Why?
Abstract (arXiv)
Autoregressive models have demonstrated an unprecedented ability at modeling the intricacies of natural language. However, they continue to struggle with generating complex outputs that adhere to logical constraints. Sampling from a fully-independent distribution subject to a constraint is hard. Sampling from an autoregressive distribution subject to a constraint is doubly hard: We have to contend not only with the hardness of the constraint but also the distribution's lack of structure. We propose a tractable probabilistic approach that performs Bayesian conditioning to draw samples subject to a constraint. Our approach considers the entire sequence, leading to a more globally optimal constrained generation than current greedy methods. Starting from a model sample, we induce a local, factorized distribution which we can tractably condition on the constraint. To generate samples that satisfy the constraint, we sample from the conditional distribution, correct for biases in the samples and resample. The resulting samples closely approximate the target distribution and are guaranteed to satisfy the constraints. We evaluate our approach on several tasks, including LLM detoxification and solving Sudoku puzzles. We show that by disallowing a list of toxic expressions our approach is able to steer the model's outputs away from toxic generations, outperforming similar approaches to detoxification. We conclude by showing that our approach achieves a perfect accuracy on Sudoku compared to <50% for GPT4-o and Gemini 1.5.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 34 of its 56 references that are in the map. First posted on arXiv 17 Oct 2024.
Builds on
34 of 56 references.
References · 34
- 2015Deep Residual Learning for Image Recognitioncited by 52,096
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2020RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Modelscited by 1,255
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,141
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2023Logic-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoningcited by 391
- 2020GeDi: Generative Discriminator Guided Sequence Generationcited by 378
- 2021FUDGE: Controlled Text Generation With Future Discriminatorscited by 376
- 2017A Semantic Loss Function for Deep Learning with Symbolic Knowledgecited by 270
- 2019Differentiation of Blackbox Combinatorial Solverscited by 226
- 2023Efficient Guided Generation for Large Language Modelscited by 200
- 2019SATNet: Bridging deep learning and logical reasoning using a differentiable satisfiability solvercited by 173
22 more
- 2021Challenges in Detoxifying Language Modelscited by 169
- 2022COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamicscited by 161
- 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
- 2020Einsum Networks: Fast and Scalable Learning of Tractable Probabilistic Circuitscited by 103
- 2022Semantic Probabilistic Layers for Neuro-Symbolic Learningcited by 103
- 2023Amortizing intractable inference in large language modelscited by 97
- 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 80
- 2023Evaluating Large Language Models on Controlled Generation Taskscited by 73
- 2022Exploring the Limits of Domain-Adaptive Training for Detoxifying Large-Scale Language Modelscited by 68
- 2023Tractable Control for Autoregressive Language Generationcited by 65
- 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
- 2022Controllable Text Generation with Neurally-Decomposed Oraclecited by 41
- 2022SIMPLE: A Gradient Estimator for k-Subset Samplingcited by 34
- 2024Adaptable Logical Control for Large Language Modelscited by 30
- 2022Neuro-Symbolic Entropy Regularizationcited by 27
- 2024Scaling Tractable Probabilistic Circuits: A Systems Perspectivecited by 23
- 2024Where is the signal in tokenization space?cited by 21
- 2016SDDs are Exponentially More Succinct than OBDDscited by 19
- 2023Long Horizon Temperature Scalingcited by 18
Built on by
Citing papers per year: 2025: 9; 2026: 2.
11 papers.
- 2025Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Samplingcited by 21
- 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspectivecited by 14
- 2025Neurosymbolic Diffusion Modelscited by 13
- 2025Fast and Expressive Multi-Byte Prediction with Probabilistic Circuitscited by 9
- 2025TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code Generationcited by 5
- 2025Semantic Probabilistic Control of Language Modelscited by 4
- 2025ABS: Enforcing Constraint Satisfaction On Generated Sequences Via Automata-Guided Beam Searchcited by 3
- 2025Calibrated Predictive Lower Bounds on Time-to-Unsafe-Sampling in LLMscited by 3
- 2026Entropy-Aligned Decoding of LMs for Better Writing and Reasoningcited by 1
- 2025Norm-Q: Effective Compression Method for Hidden Markov Models in Neuro-Symbolic Applicationscited by 0
- 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learningcited by 0
- 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learning30 Sep 2026
- 2026Entropy-Aligned Decoding of LMs for Better Writing and Reasoning5 Jan 2026
- 2025TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code Generation27 Nov 2025
- 2025Fast and Expressive Multi-Byte Prediction with Probabilistic Circuits14 Nov 2025
- 2025Norm-Q: Effective Compression Method for Hidden Markov Models in Neuro-Symbolic Applications29 Sep 2025
- 2025Calibrated Predictive Lower Bounds on Time-to-Unsafe-Sampling in LLMs16 Jun 2025
- 2025ABS: Enforcing Constraint Satisfaction On Generated Sequences Via Automata-Guided Beam Search11 Jun 2025
- 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspective6 Jun 2025
- 2025Neurosymbolic Diffusion Models19 May 2025
- 2025Semantic Probabilistic Control of Language Models4 May 2025
- 2025Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Sampling7 Apr 2025