TL;DR
Giving Large Language Models (LLMs) extra "thinking time" during inference drastically improves their reasoning, and beam search—pruning bad partial thoughts step-by-step—is a favorite practical tool for doing so. Yet until now, we lacked a rigorous mathematical explanation of why beam search scales so well, or where its hidden traps lie. This paper provides the first theoretical guarantees for test-time beam search, exposing a subtle statistical flaw in the standard algorithm and introducing a simple filtering fix that shifts compute costs on long reasoning chains from exponential to polynomial.
What Problem Does This Paper Address?
To solve complex problems without retraining a model, engineers rely on test-time compute: sampling multiple responses and picking a winner. Sequence-level methods like Best-of-$N$ (generating $N$ full answers and scoring them with a reward model) work well for short tasks, but hit a wall on long reasoning chains. Because tiny mistakes compound token by token, the odds of stumbling upon a flawless long sequence drop exponentially with the sequence length $L$.
Beam search sidesteps this by maintaining a small "beam" of $b$ promising partial prefixes, pruning bad paths early before invoking an external reward model at the very end. Empirically, it works wonders. Theoretically, it has been a black box because step-by-step pruning creates tangled dependencies across time, and intermediate steps are often scored by heuristic model confidence rather than true outcome rewards. How does beam search actually scale when compute is tight and verifiers are noisy?
Methods
The authors study a realistic black-box sampling setup—meaning no direct access to exact internal model logits. At each step, the algorithm draws $N$ next-token samples per surviving prefix and estimates token probabilities via empirical frequencies.
In Vanilla Beam Search, trajectories are scored by summing these estimated log-probabilities, keeping the top-$b$ prefixes at each step, and finally using an external reward model to pick the best completed sequence.
To fix a fatal flaw they uncover in this standard setup, the authors introduce Confidence-Filtered Beam Search (CF-Beam). Before ranking and pruning to the top-$b$ prefixes, CF-Beam applies a simple threshold $\beta_t$: any sampled token whose empirical frequency falls below $\beta_t$ is immediately discarded.
Because theoretical thresholds rely on knowing the optimal token's true probability, the authors also design Empirical CF-Beam, which sets the threshold dynamically as a fraction ($\gamma = 0.3$) of the most frequent sampled next token, alongside a Self-Consistent CF-Beam variant that drops the external reward model altogether in favor of total sequence log-likelihood.
Datasets
In the main text, algorithms are evaluated using a synthetic LLM simulator paired with a noisy reward model (with mean-squared error $\epsilon_{\text{RM}}^2 = 0.01$) across varying rollout difficulty levels and sequence lengths. The authors note an evaluation of Empirical CF-Beam on a pretrained LLM in Appendix H.2, though the specific real-world datasets used there are not detailed in the main paper.
Key Insights and Ideas
- The Tail-Noise Trap in Vanilla Beam Search: Because LLM vocabularies are massive, vast numbers of bad tokens sit in the low-probability tail. With finite samples, rare tail tokens occasionally get sampled, creating noisy probability spikes that can crowd out and permanently eliminate the true optimal path. Because of this, Vanilla Beam Search requires at least $\Omega((C^\star)^2)$ samples per step to survive, where $C^\star$ is the token-level coverage coefficient (the inverse probability of sampling the optimal token—a measure of step difficulty).
- Filtering Slashes Sample Complexity: By sweeping away low-frequency flukes before top-$b$ selection, CF-Beam drops the per-step sample requirement from quadratic, $\Omega((C^\star)^2)$, to nearly linear, $\widetilde{O}(C^\star)$.
- Polynomial vs. Exponential Horizon Scaling: Sequence-level methods like Best-of-$N$ and Best-of-Majority suffer from search costs tied to sequence-level coverage—the product of step difficulties across the whole trajectory, which explodes exponentially with reasoning length $L$. CF-Beam's search failure rate depends on token-level coverage and scales only polynomially in $L$ (giving a total query budget of $\widetilde{O}(b L^3 C_{\max}^\star)$, or $\widetilde{O}(L b C_{\max}^\star)$ without an external reward model).
- Likelihood Must Align With Reward: Intermediate pruning without a step-level reward model isn't magic; the authors prove that if the base model's step-by-step likelihood doesn't favor the optimal prefix by a small margin ("prefix competitiveness"), beam search can fail three-quarters of the time regardless of sample budget.
Key Results
- Hardness Scaling: In synthetic experiments varying per-rollout success probability $p \in \{0.01, 0.05, 0.3\}$, both Oracle and Empirical CF-Beam show their largest accuracy gains over Vanilla Beam Search, Best-of-$N$, Majority Voting, and Best-of-Majority in the hardest regime ($p = 0.01$), where sparse probabilities make tail noise worst. For instance, at $p=0.01$ with a total budget of 200 queries, CF-Beam variants pass 0.9 accuracy while Vanilla Beam Search and sequence-level baselines remain below 0.6.
- Horizon Robustness: Holding per-step success probability at 0.8 and a fixed total budget of 100 while stretching horizon length $L$ up to 40, sequence-level methods collapse rapidly toward zero accuracy as $L$ passes 20–30, whereas beam-based methods stay resilient, with CF-Beam maintaining the highest accuracy (~0.6–0.8+ across horizons).
Limitations and Future Work
CF-Beam's biggest caveat is its reliance on prefix competitiveness: the assumption that the base LLM's own token likelihoods correlate with the final ground-truth reward at intermediate steps. If the true optimal answer requires an initially counterintuitive, low-likelihood detour, beam search will prune it away before the final reward model ever sees it. For future work, the authors suggest exploring prompt-adaptive algorithms that dynamically switch between beam search and sequence-level sampling, as well as incorporating external process verifiers that score partial reasoning steps directly.
Summary updated