Lune

ICML2024Top-tier venue

Probabilistic Inference in Language Models via Twisted Sequential Monte Carlo

Stephen Zhao, Rob Brekelmans, Alireza Makhzani, Roger Baker Grosse

Abstract

Numerous capability and safety techniques of Large Language Models (LLMs), including RLHF, automated red-teaming, prompt engineering, and infilling, can be cast as sampling from an unnormalized target distribution defined by a given reward or potential function over the full sequence. In this work, we leverage the rich toolkit of Sequential Monte Carlo (SMC) for these probabilistic inference problems. In particular, we use learned twist functions to estimate the expected future value of the potential at each timestep, which enables us to focus inference-time computation on promising partial sequences. We propose a novel contrastive method for learning the twist functions, and establish connections with the rich literature of soft reinforcement learning. As a complementary application of our twisted SMC framework, we present methods for evaluating the accuracy of language model inference techniques using novel bidirectional SMC bounds on the log partition function. These bounds can be used to estimate the KL divergence between the inference and target distributions in both directions. We apply our inference evaluation techniques to show that twisted SMC is effective for sampling undesirable outputs from a pretrained model (a useful component of harmlessness training and automated red-teaming), generating reviews with varied sentiment, and performing infilling tasks.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

44 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Plug and Play Language Models: A Simple Approach to Controlled Text Generation cites The Curious Case of Neural Text Degeneration
  • A Distributional Approach to Controlled Text Generation cites Plug and Play Language Models: A Simple Approach to Controlled Text Generation
  • A Distributional Approach to Controlled Text Generation cites The Curious Case of Neural Text Degeneration
  • Learning to summarize with human feedback cites The Curious Case of Neural Text Degeneration
  • Self-Consuming Generative Models with Curated Data Provably Optimize Human Preferences cites Learning to summarize with human feedback
  • Self-Consuming Generative Models with Curated Data Provably Optimize Human Preferences cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • Decoding-Time Language Model Alignment with Multiple Objectives cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • Derivative-Free Guidance in Continuous and Discrete Diffusion Models with Soft Value-based Decoding cites Plug and Play Language Models: A Simple Approach to Controlled Text Generation
  • Inference-time scaling of diffusion models through classical search cites Derivative-Free Guidance in Continuous and Discrete Diffusion Models with Soft Value-based Decoding
  • Reasoning with Sampling: Your Base Model is Smarter Than You Think cites Inference-time scaling of diffusion models through classical search
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers44

  1. Derivative-Free Guidance in Continuous and Discrete Diffusion Models with Soft Value-based DecodingXiner Li, Yulai Zhao, Chenyu Wang, Gabriele Scalia et al.NeurIPS 2025 · 147 citations
  2. Decoding-Time Language Model Alignment with Multiple ObjectivesRuizhe Shi, Yifang Chen, Yushi Hu, Alisa Liu et al.NeurIPS 2024 · 111 citations
  3. Reasoning with Sampling: Your Base Model is Smarter Than You ThinkAayush Karan, Yilun DuICLR 2026 · 87 citations
  4. Inference-time scaling of diffusion models through classical searchXiangcheng Zhang, Haowei Lin, Haotian Ye, James Y. Zou et al.ICLR 2026 · 57 citations
  5. Self-Consuming Generative Models with Curated Data Provably Optimize Human PreferencesDamien Ferbach, Quentin Bertrand, Avishek Joey Bose, Gauthier GidelNeurIPS 2024 · 41 citations

Builds on16

  1. Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
  2. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  3. Plug and Play Language Models: A Simple Approach to Controlled Text GenerationSumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung et al.ICLR 2020 · 1,166 citations
  4. A Distributional Approach to Controlled Text GenerationMuhammad Khalifa, Hady Elsahar, Marc DymetmanICLR 2021 · 135 citations
  5. Learning to summarize with human feedbackNisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel M. Ziegler et al.NeurIPS 2020 · 124 citations

Related papers

  1. Step-by-Step Reasoning for Math Problems via Twisted Sequential Monte CarloShengyu Feng, Xiang Kong, Shuang Ma, Aonan Zhang et al.ICLR 2025
  2. Safety Alignment of Large Language Models via Contrasting Safe and Harmful DistributionsXiaoyun Zhang, Zhengyue Zhao, Wenxuan Shi, Kaidi Xu et al.AAAI 2026 · 4 citations
  3. DeAL: Decoding-time Alignment for Large Language ModelsJames Y. Huang, Sailik Sengupta, Daniele Bonadiman, Yi-An Lai et al.ACL 2025
  4. Reverse Constitutional AI: A Framework for Controllable Toxic Data Generation via Probability-Clamped RLAIFYuan Fang, Yiming Luo, Aimin Zhou, Fei TanACL Findings 2026 · 1 citation
  5. RL with KL penalties is better viewed as Bayesian inferenceTomasz Korbak, Ethan Perez, Christopher L. BuckleyEMNLP Findings 2022 · 8 citations
Dusk over the sea between two cliffs drawn in fine vertical lines