Constrained Adaptive Rejection Sampling
Not on the map. Why?
Abstract (arXiv)
Language Models (LMs) are increasingly used in applications where generated outputs must satisfy strict semantic or syntactic constraints. Existing approaches to constrained generation fall along a spectrum: greedy constrained decoding methods enforce validity during decoding but distort the LM's distribution, while rejection sampling (RS) preserves fidelity but wastes computation by discarding invalid outputs. Both extremes are problematic in domains such as program fuzzing, where both validity and diversity of samples are essential. We present Constrained Adaptive Rejection Sampling (CARS), an approach that strictly improves the sample-efficiency of RS without distributional distortion. CARS begins with unconstrained LM sampling and adaptively rules out constraint-violating continuations by recording them in a trie and subtracting their probability mass from future draws. This adaptive pruning ensures that prefixes proven invalid are never revisited, acceptance rates improve monotonically, and the resulting samples exactly follow the constrained distribution. In experiments on a variety of domains -- e.g., program fuzzing and molecular generation -- CARS consistently achieves higher efficiency -- measured in the number of LM forward passes per valid sample -- while also producing stronger sample diversity than both GCD and methods that approximate the LM's distribution.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 27 of its 53 references that are in the map. First posted on arXiv 2 Oct 2025.
Builds on
27 of 53 references.
References · 27
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2017Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learningcited by 679
- 2018Junction Tree Variational Autoencoder for Molecular Graph Generationcited by 647
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
- 2017Grammar Variational Autoencodercited by 283
- 2020Hierarchical Generation of Molecular Graphs using Structural Motifscited by 204
- 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 186
- 2022COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamicscited by 159
- 2022Prompting Is Programming: A Query Language for Large Language Modelscited by 110
- 2024Let Me Speak Freely? A Study on the Impact of Format Restrictions on Performance of Large Language Modelscited by 90
- 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 79
- 2020Retro*: Learning Retrosynthetic Planning with Neural Guided A* Searchcited by 75
15 more
- 2025JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Modelscited by 66
- 2023Tractable Control for Autoregressive Language Generationcited by 65
- 2022Gradient-Based Constrained Sampling from Language Modelscited by 64
- 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
- 2024Grammar-Aligned Decodingcited by 54
- 2025Syntactic and Semantic Control of Large Language Models via Sequential Monte Carlocited by 45
- 2025Flexible and Efficient Grammar-Constrained Decodingcited by 42
- 2024Planetarium: A Rigorous Benchmark for Translating Text to Structured Planning Languagescited by 32
- 2024Adaptable Logical Control for Large Language Modelscited by 30
- 2024IterGen: Iterative Semantic-aware Structured LLM Generation with Backtrackingcited by 28
- 2022Data-Efficient Graph Grammar Learning for Molecular Generationcited by 26
- 2025Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Samplingcited by 20
- 2025Constrained Sampling for Language Models Should Be Easy: An MCMC Perspectivecited by 14
- 2023Structured Voronoi Samplingcited by 4
- 2024Approximately Aligned Decodingcited by 3
Built on by
Citing papers per year: 2025: 1; 2026: 2.
3 papers.
- 2026Lookahead-then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free Grammarscited by 6
- 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Modelscited by 1
- 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decodingcited by 0
- 2026The Parser Already Knows: Lightweight Bias Correction in Constrained Decoding10 Aug 2026
- 2026Lookahead-then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free Grammars31 Jan 2026
- 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Models5 Dec 2025