Introduction
Best-of-n (BoN) sampling has emerged as a robust and computationally efficient strategy for aligning Large Language Models (LLMs) with human preferences at inference time. By drawing $n$ samples and selecting the one with the highest reward, practitioners can significantly improve model performance. However, a critical aspect of alignment is monitoring the "drift" or KL divergence between the aligned policy and the original reference model to ensure the preservation of base capabilities. For years, the community has relied on the analytical expression $\log(n) - (n-1)/n$ to estimate this divergence. This paper demonstrates that this widely used formula is often a loose upper bound and introduces a more accurate estimator.
The Fallacy of the Standard Formula
The traditional formula for KL divergence in BoN sampling assumes that every sample drawn is unique. While this might hold for extremely high-entropy distributions, real-world language models often assign high probabilities to a small subset of "good" tokens. When $n$ is large, the probability of sampling the same high-reward response multiple times increases. These "collisions" mean the model is not exploring as much of the probability space as the standard formula suggests, resulting in a lower actual KL divergence.
As shown in the figure above, the standard formula (blue dashed line) continues to grow logarithmically with $n$, whereas the exact KL divergence (black dots) plateaus. This discrepancy indicates that BoN is more "KL-efficient" than previously believed, preserving the model's original distribution better than the theoretical "worst-case" suggests.
Methodology and Proposed Estimator
The authors provide a rigorous mathematical foundation for BoN by deriving the exact Probability Mass Function (PMF) of the aligned policy. They prove that the standard formula is strictly an upper bound and identify the "$\delta$-bound" regime where it is most accurate—specifically when all outcome probabilities are infinitesimally small.
To provide a more practical tool for researchers, the paper introduces a new estimator, $D_{KL}(\epsilon_n)$, based on the probability of the selected sample under the reference model. This estimator accounts for the likelihood of sample collisions, providing a much tighter fit to the true divergence across various tasks.
Empirical Validation
The theoretical findings were validated using both synthetic toy models and real-world LLM tasks. Experiments utilized the Alpaca instruction-following dataset and Google’s Gemma 9B IT model. Tasks included machine translation (English to German/French) and sentence transformation.
In empirical tests, the proposed estimator consistently tracked the true KL divergence, even in low-entropy regimes where the standard formula failed significantly. The results confirm that BoN offers a superior tradeoff between reward and KL divergence compared to alternative methods like "Rewind-and-Repeat" (rejection sampling).
Key Insights
- Win Rate Ceiling: The authors prove that the win rate of a BoN policy against its reference model is fundamentally upper-bounded by $n/(n+1)$.
- Efficiency of BoN: BoN is surprisingly optimal, often matching the reward-vs-KL performance of more complex reinforcement learning techniques.
- The Uniqueness Fallacy: Recognizing that models often repeat high-probability outcomes is key to understanding why BoN is safer for model capabilities than once thought.
Conclusion
This research provides much-needed theoretical clarity on one of the most popular alignment strategies in the LLM era. By debunking the standard KL divergence formula and providing a tighter estimator, the authors enable a more precise understanding of the safety and capability tradeoffs inherent in Best-of-n sampling. Future work remains to formally prove the universal nature of the proposed estimator and to explore its application in token-level decoding strategies.
Summary updated