Aligning Large Language Models (LLMs) with human preferences usually presents a difficult choice between two extremes. On one hand, you can spend massive computational resources fine-tuning the entire model using techniques like PPO or DPO. On the other hand, you can use inference-time search strategies like "Best-of-K" sampling, which are easier to implement but computationally expensive and wasteful.
This paper introduces Controlled Decoding (CD), a modular middle ground that steers frozen base models using a lightweight, independently trained "prefix scorer."
The Alignment Bottleneck
Standard alignment techniques like Reinforcement Learning from Human Feedback (RLHF) typically update the weights of the generative model itself. While effective, this "generator improvement" approach has several drawbacks:
- Inflexibility: Changing the reward function (e.g., shifting from helpfulness to conciseness) requires retraining the entire model.
- Resource Intensity: Fine-tuning massive, state-of-the-art models is prohibitively expensive for many practitioners.
- Inference Inefficiency: Simple alternatives like Best-of-K (sampling $K$ full sequences and picking the best) require generating vast amounts of discarded text, making them slow and costly at inference time.
Controlled Decoding asks a fundamental question: How can we align a model's output to specific rewards when we have no control over its pre-trained representations?
The Controlled Decoding Approach
The core innovation of CD is the prefix scorer ($V_\theta$). This lightweight module is trained to learn a "value function"—essentially predicting the expected final reward of a sequence given only its current prefix.
The authors propose two primary ways to train this scorer:
- CD-FUDGE: An on-policy method that uses Monte Carlo rollouts from the base model to estimate future rewards.
- CD-Q: A novel off-policy method inspired by Deep Q-Learning (DQN). It uses the Bellman identity to learn from a static dataset, making it highly sample-efficient and less dependent on active, expensive rollouts.
At inference time, CD uses this scorer to steer the frozen base model.
This steering happens in two primary ways:
- Tokenwise Sampling: The system adjusts the probability of the very next token by combining the base model's logits with the prefix scorer's predictions.
- Blockwise Best-of-K: Instead of sampling $K$ full sequences, the model samples $K$ short "blocks" (e.g., 4–32 tokens), picks the best block according to the scorer, and continues generation from there. This bridges the gap between granular token-level control and sequence-level quality.
Experimental Setup
The researchers evaluated CD across three distinct tasks to test its versatility:
- DSTC8 Reddit Conversations: Optimizing for specific response lengths.
- Anthropic HH (Helpfulness and Harmlessness): A standard benchmark for human preference alignment.
- TL;DR (Reddit Summarization): Testing the model's ability to generate high-quality, human-preferred summaries.
Key Findings and Capabilities
The Efficiency of "Blockwise" Decoding The most striking insight is that blockwise decoding acts as a massive efficiency multiplier. By making routing decisions every $M$ tokens rather than waiting until the end of the sequence, the model achieves the same reward as sequence-level Best-of-50 sampling using only $K=6$ samples.
Superior Trade-offs and Win Rates In length-control experiments, Blockwise CD-Q outperformed all training-time baselines (PPO, DPO, IPO) in terms of the reward-to-KL-divergence tradeoff. It stayed "closer" to the original model's distribution while achieving higher rewards. On the Anthropic HH benchmark, Blockwise CD-Q significantly outperformed standard RL techniques like IPO and PPO. The authors noted that CD-Q produced much smoother, less noisy reward predictions than CD-FUDGE, explaining its superior performance.
Plug-and-Play Transferability Because the prefix scorer is a separate module, it is highly transferable. A scorer trained on a smaller base model (e.g., PaLM 2-XXS) can be used to steer a completely different, unseen model (e.g., PaLM 2-S) without any additional training.
Multi-Objective "Mixing" If a practitioner wants a model that is both helpful and concise, they can simply take a linear combination of two different prefix scorers at inference time. This allows for "live" adjustment of model behavior without retraining.
Limitations and Future Directions
While powerful, Controlled Decoding has limitations. The prefix scorer's accuracy is ultimately capped by the quality of the training data; highly noisy reward signals make it difficult for the scorer to provide clean steering. Additionally, while much more efficient than standard Best-of-K, CD still requires $K$ forward passes of both the scorer and the base model for each block, carrying more computational overhead than a standard single-pass fine-tuned model.
Future work may explore combining CD with speculative decoding to mask the computational cost of the $K$ samples, or integrating more advanced RL techniques (like "Rainbow" DQN improvements) to further stabilize the prefix scorer's training.
Summary updated