TL;DR
Best-of-$N$ sampling is a standard technique for generating preference data to train LLM reward models, but how do you choose the optimal $N$? This paper uncovers a fundamental tradeoff: while a larger $N$ widens the reward margins between chosen and rejected responses, it exponentially degrades the "connectivity" of the data by over-concentrating on extreme outcomes. The authors turn this insight into practical design principles, showing you should use a larger $N$ when human labels are scarce, but a smaller $N$ when data is abundant or generation compute is limited.
What Problem Does This Paper Address?
To align Large Language Models (LLMs) using Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO), practitioners need pairwise preference data. A common way to build these datasets is Best-of-$N$ (BoN) sampling: generate $N$ candidate responses from a base model, have an oracle (human or AI judge) pick the best one, and pair it with a rejected response (either chosen at random or the absolute worst of the batch).
Despite its widespread use, the theoretical foundations of learning from BoN data have been murky. Specifically:
- What reward function does a standard Bradley-Terry (BT) objective actually extract from BoN data?
- How should we choose the candidate pool size $N$ and the prompt/response distribution to maximize sample efficiency?
The common intuition has been that "larger $N$ is always better" because the chosen response is higher quality. This paper proves that intuition is incomplete.
Methods
The authors analyze BoN data by specializing a recent distribution-agnostic framework that evaluates preference learning through two main lenses: pairwise margins (how distinct the rewards of compared items are) and comparison connectivity (how well the dataset covers the web of possible comparisons).
They study four variants of BoN data:
- Best-vs-Independent / Best-vs-Worst-Independent: Idealized reference settings where the rejected response is sampled independently from the base distribution.
- Best-vs-Random / Best-vs-Worst: Practical settings where the chosen and rejected responses are coupled because they come from the same pool of $N$ samples.
For the independent settings, they derive exact, closed-form reward targets and prove they preserve the true latent reward ranking. For the practical coupled settings, they show that while exact Bradley-Terry representability technically fails due to the coupling, the learned rewards closely approach the clean reference targets as $N$ grows.
Datasets
The paper validates its theoretical claims using both synthetic and real-world datasets:
- Synthetic Data: A setup where the ground-truth reward is defined by cosine similarity between embeddings generated by a two-layer neural network.
- Real-World Preference Data: Prompts from UltraFeedback, with responses generated by Llama-3.1-8B-Instruct. The target reward model used as the ground-truth oracle is Skywork-Reward-V2.
- Distribution Reshaping Tasks: PKU-SafeRLHF (for safety alignment) and GSM8K (for math reasoning), used to test how altering the base distribution's shape affects downstream reward model accuracy.
Key Insights and Ideas
- The $N$ Tradeoff (Margin vs. Connectivity): Increasing $N$ acts as a double-edged sword. On one hand, it pushes the chosen response to the top of the reward distribution, widening the pairwise margin and making individual comparisons highly informative. On the other hand, it causes the data to concentrate heavily on a tiny subset of pairs (converging toward a star graph structure), which exponentially degrades connectivity and leaves intermediate comparisons completely unrepresented.
- The Resource Bottleneck Principle: The optimal $N$ depends entirely on what resource limits your pipeline. If preference labels are the bottleneck (e.g., expensive human annotators), use a larger $N$ to get the most out of every label. If generation compute is the bottleneck and labels are cheap (e.g., automated LLM judges), use a smaller $N$ (like $N=2$) and collect more triplets.
- The Between-Mass Principle: The margin between two responses grows faster if the base distribution places more probability mass between them in the reward ranking.
Key Results
- The Crossover Effect: In synthetic experiments, when the number of training samples ($n$) is small, larger $N$ yields higher accuracy. However, when $n$ is large, smaller $N$ catches up and eventually outperforms larger $N$. For instance, at $n = 131,072$, $N=2$ beats $N=8$ by up to 10% in accuracy because the loss in connectivity outweighs the margin benefit.
- Compute Efficiency on UltraFeedback: On real-world data, when data is abundant, smaller $N$ achieves identical accuracy to larger $N$ while saving massive amounts of generation compute. For example, $N=16$ at $n=2048$ achieves the same accuracy as $N=2$ at $n=8192$, but the latter requires only half as much total generation compute.
- Smart Distribution Reshaping: For safety tasks (PKU-SafeRLHF), upsampling mediocre/lower-score responses (increasing the "between mass" separating harmful and acceptable outputs) improved test accuracy by 2.9% over the baseline.
Limitations and Future Work
The authors note several open directions and limitations:
- The analysis is restricted to the reward-learning stage; it remains an open question how these BoN data-design tradeoffs propagate downstream to policy optimization (e.g., PPO/DPO) and iterative training loops.
- The framework assumes preferences are governed by an underlying Bradley-Terry model structure, though practical human preferences can sometimes violate these assumptions.
Summary updated