Abstract
Large language model (LLM) scaling inference is key to unlocking greater performance, and leveraging diversity has proven an effective way to enhance it. Motivated by the observed relationship between solution accuracy and meaningful response diversity, we systematically study the effect of prompt diversity in scaling inference. We theoretically explain why diversified sampling improves Best-of-N scaling, showing that responses generated from diverse prompts after Best-of-N selection exhibit significantly lower error rates than those produced from stationary prompts. Building on this analysis, we derive a diversity-fidelity trade-off principle, that guides the design of sampling strategies introducing diversity. From this guidance, we instantiate a family of effective perturbation styles. We theoretically and empirically characterize when diversified exploration remains effective, demonstrating that it works under a variety of conditions, and we further show that under majority voting, diversity may vanish. Finally, we systematically evaluate how effective sampling diversity is and show that, when applied appropriately in different contexts, it yields relative gains of 10.8% in EM@100 for reasoning, 9.6% for mathematics, and 9.5% in Pass@100 for code generation. Overall, this work provides a systematic analysis that offers a theoretical and empirical foundation for understanding how sampling diversity affects LLM inference-time scaling.
Introduction: The Challenge of Inference-Time Scaling
As Large Language Models (LLMs) approach diminishing returns in pre-training, researchers are increasingly focusing on "inference-time scaling"—the use of additional computation during generation to improve output quality. A primary technique for this is Best-of-N (BoN) sampling, where a model generates $N$ candidate responses and a verifier selects the optimal one.
However, standard BoN often encounters a "local cluster" problem. When sampling repeatedly from a stationary prompt, the model often becomes trapped in a narrow solution space, producing many similar but incorrect variations. While intuition suggested that diversity helps, this research provides the formal theory explaining why it works and how to optimize it.
Methodology: Hybrid Diversity and the Fidelity Trade-off
The authors propose a framework for Hybrid Diversity, which augments standard decoding randomness (e.g., temperature) with auxiliary diversity sources like prompt perturbations.
Central to this framework is the Diversity-Fidelity Trade-off. To be effective, perturbations must satisfy two conditions:
- Diversity (Dispersion): They must be sufficiently distinct to force the model into new "solution modes."
- Fidelity: They must remain faithful to the original task to avoid degrading the quality of individual attempts.
To achieve this, the researchers tested several perturbation strategies, including task-level variations (adding roles or strategic instructions) and query-level variations (using a "thinker" model to generate specific ideas or rephrasings for a question).
Empirical Insights: The Non-Linear Sweet Spot
A critical finding of the study is the non-linear relationship between prompt relevance and performance. As shown in the evaluation of code generation tasks, performance follows a distinct rise-then-fall pattern based on the similarity of the perturbed prompt to the original task.
Irrelevant perturbations (such as "Jabberwocky" poetry) or verbatim repeats of the question offer minimal benefit. The "sweet spot" lies in moderately relevant, task-aligned ideas that provide a fresh perspective without distracting the model from the core objective.
Furthermore, the study highlights a tension between diversity and Majority Voting. While diversity significantly aids Best-of-N selection by expanding the pool of potential correct answers, it can degrade majority voting by spreading the probability mass across too many distinct responses, making consensus harder to reach.
Results and Performance Gains
The systematic evaluation across reasoning, mathematics, and code generation benchmarks demonstrated that diversified sampling consistently outperforms direct sampling:
- Reasoning (MMLU-Pro): 10.8% relative gain in EM@100.
- Mathematics (MATH): 9.6% relative gain in EM@100.
- Code Generation (MBPP): 9.5% relative gain in Pass@100.
Interestingly, the researchers found that smaller, weaker models often benefited more from diversified sampling than larger models like GPT-4o. This suggests that prompt diversity is a highly effective method for maximizing the performance of efficient, smaller-scale hardware.
Conclusion and Future Work
This work establishes a theoretical and empirical foundation for sampling diversity in LLM inference. While highly effective, the approach does introduce computational overhead due to the need for "thinker" models in query-level perturbations. Additionally, the success of these strategies remains dependent on the reliability of the verifier used in the Best-of-N process. Future research will likely focus on better coordinating the generation and verification phases to mitigate the consensus issues observed in majority voting.
Summary updated