Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Sampling
Ben LipkinBLBenjamin LeBrunJacob Hoover ViglyJLJoão LoulaDavid R. MacIverLDLi Du
Jason Eisner
Ryan Cotterell
Vikash Mansinghka
Timothy J. O'DonnellALAlexander K. LewTVTim Vieira Ben Lipkin
BLBenjamin LeBrun
Jacob Hoover Vigly
JLJoão Loula
David R. MacIver
LDLi Du

Jason Eisner

Ryan Cotterell

Vikash Mansinghka

Timothy J. O'Donnell
ALAlexander K. Lew
TVTim Vieira
+12
This paper addresses two problems in locally constrained decoding (LCD) for language models: costly full-vocabulary constraint checks and distribution distortion from local token sampling. The authors introduce adaptive weighted rejection sampling, which requires far fewer constraint evaluations and extends to give low-variance, unbiased importance-weight estimates. These estimates are soundly usable in existing sequential Monte Carlo methods to correct myopic local behavior. Across text-to-SQL, molecular synthesis, goal inference, pattern matching, and JSON domains, the approach outperforms state-of-the-art baselines in runtime and performance, with efficiency gains scaling with model quality.

OpenReview · March 20, 2025