RL for LLM Agents

Best-of-n Sampling vs Reinforcement Learning: A Fair Comparison

A training-free baseline with a clean KL bound, rejection-sampling fine-tuning, and when RL is worth its cost.

RL for LLM Agents · 5 min read

You can improve outputs without training: sample n candidates, score them, and keep the best. How does that compare with RL, and how can the two work together?

Best-of-n sampling

Draw n responses from the model, score each with a reward model or verifier, and return the highest-scoring one. It needs no weight updates and works with any scorer. The cost is n times the generation work at inference time.

How far does it move the model?

Selecting the best of n shifts the output distribution toward high-reward responses. A known analytic bound says its KL divergence from the base policy is at most log n minus (n − 1)/n. So going from n = 4 to n = 16 buys more reward at a modest, quantifiable cost in divergence, which is why it is a strong baseline for RLHF-style optimization.

Rejection sampling fine-tuning

You can also train on the winners: generate many candidates, keep the best or verified ones, and fine-tune on them. This distills the benefit of best-of-n into the model so inference needs just one sample, and it is simpler and more stable than full RL.

When to prefer which

  • Use best-of-n when inference compute is cheap relative to training or when you need a quick, reliable gain.
  • Use rejection-sampling fine-tuning to move that gain into the weights.
  • Use RL when you need the model to discover behaviors that rarely appear in samples from the base policy.
  • Always compare an RL result against a best-of-n baseline at matched compute.

More guides from this book