Constrained Sampling for Language Models Should Be Easy: An MCMC Perspective
Emmanuel Anaya Gonzalez, Sairam Vaidya, Kanghee Park, Ruyi Ji, Taylor Berg-Kirkpatrick, Loris D'Antoni
摘要
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 1 .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 6 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Mitigating Bias in Locally Constrained Decoding via Tractable Proposals 引用了 COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics
- Diffusion-LM Improves Controllable Text Generation 引用了 COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics
- Continuous Diffusion Models Can Obey Formal Syntax 引用了 Diffusion-LM Improves Controllable Text Generation
- Continuous Diffusion Models Can Obey Formal Syntax 引用了 Constrained Adaptive Rejection Sampling
- TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code Generation 引用了 Synchromesh: Reliable Code Generation from Pre-trained Language Models
- Taming Imperfect Process Verifiers: A Sampling Perspective on Backtracking 引用了 Synchromesh: Reliable Code Generation from Pre-trained Language Models
- Constrained Adaptive Rejection Sampling 引用了 COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics
- Constrained Adaptive Rejection Sampling 引用了 Coverage-based Greybox Fuzzing as Markov Chain
- Evaluating Fuzz Testing 引用了 Coverage-based Greybox Fuzzing as Markov Chain
引用它的顶会 Paper6
- Taming Imperfect Process Verifiers: A Sampling Perspective on BacktrackingDhruv Rohatgi, Abhishek Shetty, Donya Saless, Yuchen Li 等ICLR 2026 · 15 次引用
- Mitigating Bias in Locally Constrained Decoding via Tractable ProposalsMeihua Dang, Linxin Song, Honghua Zhang, Jieyu Zhao 等ICML 2026 · 4 次引用
- Constrained Adaptive Rejection SamplingPaweł Parys, Sairam Vaidya, Taylor Berg-Kirkpatrick, Loris D'AntoniICML 2026 · 3 次引用
- Continuous Diffusion Models Can Obey Formal SyntaxJinwoo Kim, Taylor Berg-Kirkpatrick, Loris D'AntoniICML 2026
- TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code GenerationHenrijs Princis, Arindam Sharma, Cristina DavidPLDI 2026
它引用的 Paper22
- Diffusion-LM Improves Controllable Text GenerationXiang Lisa Li, John Thickstun, Ishaan Gulrajani, Percy Liang 等NeurIPS 2022 · 1,546 次引用
- Coverage-based Greybox Fuzzing as Markov ChainMarcel Böhme, Van-Thuan Pham, Abhik RoychoudhuryCCS 2016 · 1,026 次引用
- Evaluating Fuzz TestingGeorge Klees, Andrew Ruef, Benji Cooper, Shiyi Wei 等CCS 2018 · 753 次引用
- COLD Decoding: Energy-based Constrained Text Generation with Langevin DynamicsLianhui Qin, Sean Welleck, Daniel Khashabi, Yejin ChoiNeurIPS 2022 · 217 次引用
- Synchromesh: Reliable Code Generation from Pre-trained Language ModelsGabriel Poesia, Alex Polozov, Vu Le, Ashish Tiwari 等ICLR 2022 · 200 次引用
相关 Paper
- Constraint Satisfaction Driven Natural Language Generation: A Tree Search Embedded MCMC ApproachMaosen Zhang, Nan Jiang, Lei Li, Yexiang XueEMNLP Findings 2020 · 14 次引用
- ChopChop: A Programmable Framework for Semantically Constraining the Output of Language ModelsShaan Nagy, Timothy Zhou, Nadia Polikarpova, Loris D'AntoniPOPL 2026 · 1 次引用
- Hybrid Language Processor Fuzzing via LLM-Based Constraint SolvingYupeng Yang, Shenglong Yao, Jizhou Chen, Wenke LeeUSENIX Security 2025
- LEGION: Best-First Concolic TestingDongge Liu, Gidon Ernst, Toby Murray, Benjamin I. P. RubinsteinASE 2020 · 19 次引用
- Gradient-based Constrained Sampling from Language ModelsSachin Kumar, Biswajit Paria, Yulia TsvetkovEMNLP 2022 · 22 次引用
