TL;DR
This paper explores the theoretical limit of "best-of-$N$" sampling for Large Language Models (LLMs)—denoted as best-of-$\infty$—using majority voting. To make this practical without requiring infinite compute, the authors introduce an adaptive sampling method that stops generating answers once a statistical consensus is reached. Furthermore, they demonstrate how to optimally combine multiple different LLMs into a weighted ensemble using a mixed-integer linear program (MILP), achieving higher accuracy than any single model could on its own.
The Challenge of Scaling Test-Time Compute
Scaling test-time compute by generating multiple answers and picking the best one is a proven strategy to improve LLM performance on complex reasoning tasks. A simple, highly effective approach is Best-of-$N$ (BoN) with majority voting. As $N$ increases, performance reliably improves, approaching a theoretical asymptotic limit the authors call "best-of-$\infty$".
However, generating hundreds of answers per question is computationally expensive and often wasteful. Easy questions might only need three generations to find a clear majority, while hard ones might require a hundred. Additionally, while it is known that different models possess complementary strengths, finding a mathematically tractable way to determine the optimal weights for combining multiple LLMs in a majority-vote ensemble has remained a challenge.
Proposed Methods
The authors tackle these inefficiencies and ensembling challenges through two main contributions:
1. Adaptive Sampling via Bayesian Modeling
Instead of using a fixed budget $N$ for every prompt, the system generates answers sequentially. Because the total number of possible unique answers an LLM might generate is unknown, the authors employ a Nonparametric Bayesian approach (specifically, a Dirichlet process prior). They calculate a "Bayes factor" to measure the statistical confidence that the current most frequent answer is the true majority. Once this confidence crosses a predefined threshold, generation terminates early, saving significant compute.
2. Optimal LLM Ensembling
The paper extends majority voting to a weighted combination of multiple LLMs. Finding the optimal weights to maximize accuracy is difficult because the objective function is non-concave, meaning standard gradient descent is ineffective. The authors cleverly prove that the decision boundaries for winning answers form geometric shapes called polytopes. This insight allows them to formulate the exact optimal weighting as a Mixed-Integer Linear Program (MILP), which can be solved efficiently with standard optimization solvers.
Key Findings and Results
The authors evaluated their methods on heavy-reasoning benchmarks, including AIME2024, AIME2025, GPQA-DIAMOND, and MATH500. To support this, they generated a massive new dataset of at least 80 answers per problem across 11 open-weight LLMs.
- Adaptivity Drastically Cuts Compute: By dynamically stopping when a consensus is reached, the adaptive algorithm achieves the asymptotic performance of a massive $N$ budget while using a fraction of the tokens. On the MATH500 dataset, the adaptive approach achieved the same accuracy with an average of just $N=3$ samples as a fixed $N=10$ approach.
- Ensemble Superiority: Even if an LLM has lower overall accuracy, it can significantly boost an ensemble's performance if its capabilities are complementary. On AIME2025, the best-of-$\infty$ performance for GPT-OSS-20B was 90.0%, and Nemotron-Nano-9B was 73.0%. Their optimally weighted ensemble hit 93.3%, proving the mixture outperforms its individual components.
- Sample Efficiency and Transferability: The MILP optimization requires only about 5 training problems to learn ensemble weights that generalize well. Furthermore, weights learned on AIME2024 transferred successfully to AIME2025, outperforming the best single model in 64.2% of the tested model combinations.
- Majority Voting over Reward Models: For pure reasoning tasks, simple majority voting often beats complex reward models or "LLM-as-a-judge" techniques, while remaining completely robust to reward hacking.
Limitations and Future Work
While the MILP formulation is tractable for typical scales (e.g., $\approx 10$ LLMs and $\approx 1000$ problems), general MILP solving is technically NP-hard and may struggle to scale if ensembling hundreds of models simultaneously. Additionally, majority voting relies on exact-match parsing to group identical answers, which can be imperfect when answer formats vary, potentially deflating performance artificially.
The authors are releasing their massive dataset of LLM generations to spur further research into test-time compute scaling, adaptive stopping criteria, and optimal routing strategies.
Summary updated