← AI Terminology

Best-of-N Sampling

Best-of-N sampling generates N candidate completions and picks the one with the highest score under a reward model, verifier, or heuristic.

It is a widely used inference-time method for alignment and quality.
Why It Matters in AI
When you can afford multiple samples, selection beats trusting a single draw. Best-of-N is easy to implement, parallelises well, and often closes much of the gap to heavier RL — at a clear compute cost.
Key Points
Aspect Description
Risk Over-optimising a flawed scorer (Goodhart)
Scorer RM, PRM, unit tests, compilers, LLM-as-judge
Related Rejection sampling, RLAIF, speculative methods
Scaling Quality rises with N then plateaus; cost linear in N
Pipeline Sample N → score each → return argmax
Use cases Chat quality, code that must pass tests, math
Simple Analogy
Writing N draft emails and letting a trusted editor pick the best one before you hit send.
Common Usage Examples
  • Generate N=8 replies, rank with preference RM
  • Code: keep first sample that passes tests (variant)
  • OpenAI/Anthropic-style quality tiers via more samples
  • Plot win rate vs N
Summary
In short: Best-of-N generates many candidates and keeps the highest-scoring one — a straightforward inference trade of compute for quality.