On the Effect of Sampling Diversity in Scaling LLM Inference

Tianchun Wang, Zichuan Liu, Yuanzhou Chen, Jonathan Light, Weiyang Liu, Haifeng Chen, Xiang Zhang, Wei Cheng

TL;DR

This paper demonstrates that introducing diversity at the prompt level significantly enhances Best-of-$N$ scaling for Large Language Models (LLMs) by preventing models from getting "trapped" in redundant solution clusters. By establishing a theoretical "diversity-fidelity trade-off," the authors show that while meaningful perturbations boost exploratory search performance, they can actually be counterproductive for majority-voting strategies.

What Problem Does This Paper Address?

As LLMs grow in capability, researchers are increasingly looking at "inference-time scaling"—using more compute during the generation process to get better results. A common technique is Best-of-$N$ sampling, where a model generates $N$ responses and a verifier selects the best one.

However, standard sampling often suffers from a lack of variety. When prompted with the same text repeatedly, models tend to produce solutions that are "trapped" within a local cluster of similar ideas, leading to redundant failures. While previous work has looked at temperature scaling to increase randomness, this paper tackles the more fundamental question: How does prompt-level diversity affect the scaling laws of LLM inference?

Figure 1: A brief sketch of (a) direct sampling without diversifi- cation and (b) diversified sampling.

Methods

The authors provide a theoretical foundation for why diversity helps, centering on two key hypotheses:

  1. Dispersion: Auxiliary diversity (like prompt perturbations) induces variations in success probability, leading to faster convergence as $N$ increases.
  2. Fidelity: New prompts must not globally worsen response quality compared to the original prompt.

From these, they derive a diversity-fidelity trade-off principle. To test this, they instantiated several perturbation strategies:

  • Task-level Perturbations: Independent of specific questions, these include Role Injection (e.g., "You are a mentor") and Strategic Instructions (e.g., "Use a functional programming style").
  • Query-level Perturbations: These are tied to the specific question. The authors introduced Random Idea Injection (RandIdeaInj), where a "thinker" model proposes solution ideas that are then injected into the prompt, and Random Query Rephraser (RandQReph).

They evaluated these across three variants: Single (the model perturbs its own prompt), Dual (a separate model acts as the thinker), and Diverse (a pool of different models provides varied perturbations).

Datasets

The study evaluated these strategies across six diverse benchmarks:

  • Reasoning: MMLU-Pro (a more challenging version of MMLU).
  • Mathematics: GSM-Hard and MATH (competitive-level problems).
  • Code Generation: HumanEval, MBPP, and APPS (challenging competition-level coding).

Key Insights and Ideas

  • The "Sweet Spot" of Relevance: Performance follows a non-linear, rise-then-fall pattern based on how relevant the perturbation is to the question. Irrelevant text (like the "Jabberwocky" poem) or verbatim repetitions offer no benefit. The peak occurs with "task-aligned" ideas that provide new perspectives without losing the original intent.
Effect of perturbation relevance on MATH and HumanEval.
  • Best-of-N vs. Majority Voting: This is a crucial "aha moment." Diversity is highly beneficial for Best-of-$N$ because it increases the probability that at least one correct solution exists in the set. However, for majority voting, diversity can be a failure mode. Because majority voting requires the model to converge on a single correct answer, spreading the probability mass across diverse modes can actually degrade performance.
  • Thinker Strength Matters: When using a "Dual" strategy, the quality of the scaling curve is directly influenced by the strength of the "thinker" model. Stronger models like DeepSeek-V3 provide more effective perturbations than weaker ones.
Scaling curves across different thinker models.
  • Cardinality Gains: Increasing the number of distinct injection ideas (perturbation cardinality) consistently raises the scaling curve, confirming that richer diversity leads to steeper gains.
Scaling curves as injection cardinality increases.

Key Results

The authors found that diversified sampling consistently outperformed direct sampling across all tasks using GPT-4o-mini:

  • Reasoning (MMLU-Pro): 10.8% improvement.
  • Mathematics (MATH): 8.2% improvement.
  • Coding (HumanEval): 4.7% improvement.
  • Synergy with CoT: Diversified perturbations remain effective when combined with Chain-of-Thought (CoT) reasoning, yielding up to a 7.4% relative gain on the APPS coding benchmark.

Limitations and Future Work

  • Majority Voting Failure: The authors explicitly identify majority voting as a scenario where their diversity strategies may fail to provide gains, as it requires convergence rather than exploration.
  • Model Size Sensitivity: The benefits of diversified sampling appear more pronounced for weaker models. Stronger models (like Qwen2.5-72B) show more limited marginal gains, suggesting they may already be exploring the solution space more effectively.
  • Computational Overhead: While the authors argue their method is more token-efficient than some prompt optimization techniques, generating multiple perturbations still adds to the total inference cost.
  • Future Directions: The paper suggests that future work should focus on better coordination between the generation and verification stages, especially in industrial settings where these tasks might be handled by different systems.

Summary updated

BibTeX
@misc{wang2025effect,
  author = {Tianchun Wang and Zichuan Liu and Yuanzhou Chen and Jonathan Light and Weiyang Liu and Haifeng Chen and Xiang Zhang and Wei Cheng},
  title = {{On the Effect of Sampling Diversity in Scaling LLM Inference}},
  year = {2025},
  eprint = {2502.11027},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.11027},
}
Figure