Table of Contents
Fetching ...

Soft Best-of-n Sampling for Model Alignment

Claudio Mayrink Verdun, Alex Oesterling, Himabindu Lakkaraju, Flavio P. Calmon

TL;DR

This work tackles aligning language models to human preferences without fine-tuning by introducing Soft Best-of-$n$ sampling, a temperature-controlled generalization of Best-of-$n$ that yields a smooth interpolation between the base distribution $P$ and the reward-tilted distribution $P^*_{\lambda}$. It establishes non-asymptotic, sharp guarantees: the KL divergence between $P_{n,\lambda}$ and $P^*_{\lambda}$ scales as $O(1/n)$ (with explicit constants) and the expected reward converges at a matching rate; a lower bound via TV distance shows these rates are tight up to constants. The paper also analyzes an additive reward model to expose fundamental limitations of blockwise sampling and to motivate efficient symbolwise approaches. Together, these results justify using Soft Best-of-$n$ as a principled decoding strategy to navigate the KL-reward frontier and guide practical alignment with human preferences while balancing computational costs.

Abstract

Best-of-$n$ (BoN) sampling is a practical approach for aligning language model outputs with human preferences without expensive fine-tuning. BoN sampling is performed by generating $n$ responses to a prompt and then selecting the sample that maximizes a reward function. BoN yields high reward values in practice at a distortion cost, as measured by the KL-divergence between the sampled and original distribution. This distortion is coarsely controlled by varying the number of samples: larger $n$ yields a higher reward at a higher distortion cost. We introduce Soft Best-of-$n$ sampling, a generalization of BoN that allows for smooth interpolation between the original distribution and reward-maximizing distribution through a temperature parameter $λ$. We establish theoretical guarantees showing that Soft Best-of-$n$ sampling converges sharply to the optimal tilted distribution at a rate of $O(1/n)$ in KL and the expected (relative) reward. For sequences of discrete outputs, we analyze an additive reward model that reveals the fundamental limitations of blockwise sampling.

Soft Best-of-n Sampling for Model Alignment

TL;DR

This work tackles aligning language models to human preferences without fine-tuning by introducing Soft Best-of- sampling, a temperature-controlled generalization of Best-of- that yields a smooth interpolation between the base distribution and the reward-tilted distribution . It establishes non-asymptotic, sharp guarantees: the KL divergence between and scales as (with explicit constants) and the expected reward converges at a matching rate; a lower bound via TV distance shows these rates are tight up to constants. The paper also analyzes an additive reward model to expose fundamental limitations of blockwise sampling and to motivate efficient symbolwise approaches. Together, these results justify using Soft Best-of- as a principled decoding strategy to navigate the KL-reward frontier and guide practical alignment with human preferences while balancing computational costs.

Abstract

Best-of- (BoN) sampling is a practical approach for aligning language model outputs with human preferences without expensive fine-tuning. BoN sampling is performed by generating responses to a prompt and then selecting the sample that maximizes a reward function. BoN yields high reward values in practice at a distortion cost, as measured by the KL-divergence between the sampled and original distribution. This distortion is coarsely controlled by varying the number of samples: larger yields a higher reward at a higher distortion cost. We introduce Soft Best-of- sampling, a generalization of BoN that allows for smooth interpolation between the original distribution and reward-maximizing distribution through a temperature parameter . We establish theoretical guarantees showing that Soft Best-of- sampling converges sharply to the optimal tilted distribution at a rate of in KL and the expected (relative) reward. For sequences of discrete outputs, we analyze an additive reward model that reveals the fundamental limitations of blockwise sampling.
Paper Structure (15 sections, 18 theorems, 106 equations, 1 figure)

This paper contains 15 sections, 18 theorems, 106 equations, 1 figure.

Key Result

Lemma 1

Let $n \geq 1$, $\lambda > 0$, $r_\lambda(x)= r(x)/\lambda$, and $X_1,..., X_n\overset{i.i.d.}{\sim}P$. For any $x \in \mathcal{X}$, the distribution $P_{n,\lambda}$ of the sample resulting from Soft Best-of-$n$ sampling satisfies

Figures (1)

  • Figure 1: Soft Best-of-$n$ and BoN sampling, compared with the optimal Pareto frontier of exponential tilting for KL-reward tradeoffs. Soft Best-of-$n$ sampling generalizes BoN and allows for control between KL and reward, allowing us to achieve near-optimal performance for all $n$. Alphabet of size 3 with distribution $[0.75, 0.2, 0.05]$ and reward $[0.016, 0.164, 0.820]$.

Theorems & Definitions (34)

  • Definition 1
  • Definition 2
  • Lemma 1
  • proof : Proof sketch of Lemma \ref{['lem:p-char']}
  • Theorem 1
  • proof : Proof sketch of Theorem \ref{['thm:KL-bound']}
  • Corollary 1
  • Theorem 2
  • proof : Proof sketch of Theorem \ref{['thm:KL-lowerbound']}
  • Theorem 3
  • ...and 24 more