Abstract
While increasing training compute has significantly improved the performance of large language models (LLMs), similar gains have not been observed when scaling inference compute. We hypothesize that the primary issue lies in the uniformity of LLM outputs, which leads to inefficient sampling as models repeatedly generate similar but inaccurate responses. Motivated by an intriguing relationship between solution accuracy (Pass@10) and response diversity, we propose DivSampling -- a novel and versatile sampling technique designed to enhance the diversity of candidate solutions by introducing prompt perturbations. DivSampling incorporates two categories of perturbations: task-agnostic approaches, which are general and not tailored to any specific task, and task-specific approaches, which are customized based on task content. Our theoretical analysis demonstrates that, under mild assumptions, the error rates of responses generated from diverse prompts are significantly lower compared to those produced by stationary prompts. Comprehensive evaluations across various tasks -- including reasoning, mathematics, and code generation -- highlight the effectiveness of DivSampling in improving solution accuracy. This scalable and efficient approach offers a new perspective on optimizing test-time inference, addressing limitations in current sampling strategies.
Introduction: The Local Cluster Trap
As Large Language Models (LLMs) grow more capable, researchers are looking for ways to squeeze more performance out of them during inference (test-time) rather than just during training. A common strategy is Best-of-N sampling: generating $N$ different answers and selecting the best one using a verifier or unit tests.
However, standard sampling often gets "trapped." Because models are aligned to follow instructions precisely, they tend to produce very similar responses even at high temperature settings. These responses often cluster around a single, potentially incorrect, reasoning path. This paper identifies a critical gap: the lack of a systematic understanding of how to break these "local clusters" using prompt diversity and a mathematical foundation for why it works.
Methodology: DivSampling
The authors propose DivSampling, a framework that intentionally perturbs prompts to elicit varied responses. The methodology is built on three pillars:
- Theoretical Framework: The authors prove that diversified sampling lowers the "error asymptote" (the floor of unsolvable problems) and accelerates the convergence rate as the number of samples ($N$) increases.
- Diversity-Fidelity Trade-off: There is a "sweet spot" for perturbations. If a change is too minor (e.g., simple repetition), it fails to create diversity. If it is too drastic (e.g., injecting irrelevant text like "Jabberwocky"), it destroys the model's ability to solve the task (fidelity).
- Perturbation Strategies:
- Task-level: Injecting specific roles (e.g., "You are a mentor") or strategical instructions (e.g., "Use a modular approach").
- Query-level: Using a "thinker" model to generate random idea injections or rephrasings specific to the problem.
Key Insights: The "Rise-then-Fall" Pattern
A critical finding is the non-linear relationship between perturbation relevance and model performance. As shown in the evaluations on MATH and HumanEval benchmarks, performance follows a "rise-then-fall" curve relative to cosine similarity. The best results come from "moderately relevant" perturbations—ideas that are task-aligned but offer a fresh perspective.
Furthermore, the authors note that while diversity helps "Best-of-N" strategies, it can actually hinder Majority Voting. Diversification spreads out the probability mass; if the correct answer is not pushed to the top, the consensus may settle on a common error or fail to reach a majority entirely.
Experimental Results
The researchers evaluated DivSampling across six benchmarks (MMLU-Pro, GSM-Hard, MATH, HumanEval, MBPP, and APPS) using models like GPT-4o-mini and Llama-3.1-8B. Key results include:
- 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.
- Model Scaling: The "Diverse" strategy, which uses a pool of different models to generate ideas, consistently outperformed single-model strategies, reaching a Pass@100 of 95.12% on HumanEval.
Conclusion and Future Work
DivSampling provides a scalable way to improve LLM inference without retraining. However, its success depends on the presence of a reliable verifier (like unit tests). Future research will explore dynamic selection of perturbation styles based on query difficulty and methods to reduce the computational overhead of query-level perturbations.
Summary updated