GuidedSampling: Steering LLMs Towards Diverse Candidate Solutions at Inference-Time

Divij Handa, Mihir Parmar, Aswin Rrv, Md Nayem Uddin, Hamid Palangi, Chitta Baral

TL;DR

GUIDEDSAMPLING is a novel inference-time algorithm that addresses the redundancy of traditional Repeated Sampling (RS) by decoupling the process into two distinct phases: concept exploration and solution generation. By forcing Large Language Models (LLMs) to first brainstorm diverse high-level strategies before writing out full solutions, it improves pass@50 accuracy by an average of ~21.6% across complex reasoning benchmarks. Furthermore, fine-tuning models on GUIDEDSAMPLING trajectories significantly boosts their baseline reasoning capabilities and out-of-domain generalization.

What Problem Does This Paper Address?

When tackling complex mathematical, scientific, or coding problems, a common way to boost LLM performance is through Repeated Sampling (RS)—simply generating multiple solutions and picking the best one (e.g., via majority voting). However, because LLMs are traditionally trained to produce a single correct response, their outputs under RS lack diversity. They often get stuck in a conceptual rut, repeatedly applying the same flawed theorem or approach across dozens of samples.

While advanced search methods like Tree-of-Thought (ToT) introduce deliberate exploration, they are computationally heavy because they require the model to evaluate intermediate steps continuously. The authors introduce GUIDEDSAMPLING to achieve the exploratory benefits of tree search but at a fraction of the computational cost, ensuring that inference compute is spent exploring genuinely different solution paths.

Methods

GUIDEDSAMPLING splits the inference process into two clean, sequential phases:

  1. Exploration Phase: Instead of jumping straight to a solution, the LLM is prompted to generate a high-level "concept" or theorem (e.g., "Integration by Parts" or "Trie Data Structure"). Crucially, this phase is iterative: the $k$-th concept is sampled by conditioning on the question and all previously generated concepts. This iterative conditioning forces the model to explore alternative strategies.
  2. Generation Phase: For each unique concept discovered in the exploration phase, the model generates $M$ candidate solutions, explicitly guided by that concept.
Figure 2: GUIDEDSAMPLING enhances exploration during inference by first generating a set of diverse concepts or theorems to guide subsequent generations of solutions. Unlike repeated sampling (RS), where the model generates the final solution, GUIDEDSAMPLING separates these phases.

Beyond inference, the authors leverage these trajectories for Post-Training. They fine-tune models using two paradigms:

  • Final-Answer Only (FA): Training the model to map the problem directly to the correct verified solution.
  • Concept-Augmented Answer (CAA): Training the model to output the list of diverse concepts before generating the final solution, internalizing the exploration strategy.

Datasets

The approach was evaluated across four demanding reasoning benchmarks:

  • MATH: For multi-step mathematical problem-solving.
  • GPQA-Diamond: A graduate-level, Google-proof science QA dataset.
  • HumanEval: For Python code generation.
  • OlympiadBench: High-difficulty, olympiad-level scientific and mathematical problems.
  • CommonSenseQA: Used specifically to test the boundaries of the method on less structured, intuitive reasoning.

For post-training, the authors sampled a 10k subset from OpenMathInstruct-2 to generate synthetic training trajectories.

Key Insights and Ideas

  • The Redundancy Trap: In a case study from the MATH dataset, traditional RS generated 1,000 solutions, but 892 of them stubbornly relied on the "AM-GM inequality"—consistently leading to an incorrect answer. GUIDEDSAMPLING limited this trap to just 77 samples, allocating the remaining compute to alternative theorems like the Cauchy-Schwarz inequality.
  • The Concept Generation Bottleneck: GUIDEDSAMPLING is only as good as the model's ability to brainstorm. For instance, Qwen2.5-3B-Instruct struggled to generate diverse concepts for coding tasks (averaging only 1.13 concepts per problem on HumanEval), which actually degraded its performance. However, when the authors "cross-pollinated" the concepts—using Llama-3.2 to generate concepts and Qwen to write the code—Qwen's performance soared, proving the bottleneck lies in exploration, not generation.
  • Cross-Domain Generalization: Fine-tuning a model on math-based GUIDEDSAMPLING trajectories didn't just make it better at math; it significantly improved its performance on coding (HumanEval) and science (GPQA-Diamond). This suggests that learning to internalize diverse conceptual exploration is a generalizable reasoning skill.

Key Results

  • Inference Gains: GUIDEDSAMPLING consistently outperformed RS across most model-benchmark combinations. On average, it yielded pass@50 improvements of 21.8% on MATH, 11.87% on GPQA-Diamond, and 11.28% on HumanEval for the best-performing base models.
Figure 4: GUIDEDSAMPLING forces exploration during inference-time, resulting in 16.01% aver- age pass@k improvement compared to repeated sampling. We observe an average improvement of 21.8% on MATH, 11.87% on GPQA-Diamond, 11.28% on HumanEval, and 3.08% on Olympiad- Bench. For GUIDEDSAMPLING, we choose the optimal value of K (from Fig. 5) that maximizes the performance. First row: Llama-3.2-3B-Instruct, Second row: Qwen2.5-3B-Instruct. Third row: Gemma-3-27b-it
  • Post-Training Success: Models fine-tuned on GUIDEDSAMPLING trajectories outperformed those trained on traditional RS or ToT data. The CAA setting provided an average 7.13% pass@5 improvement over the RS baseline.
  • Compute Efficiency: GUIDEDSAMPLING achieved a pass@50 score of 60.2% with an average of 104.75 LLM calls, handily beating Tree-of-Thought, which lagged at 37.1% despite consuming 154 calls.

Limitations and Future Work

  • Domain Sensitivity: The method struggles in domains where "concepts" are vague or poorly defined. On CommonSenseQA, GUIDEDSAMPLING underperformed RS by 3.28% because commonsense reasoning relies more on implicit, unstructured knowledge rather than explicit theorems.
  • Hyperparameter Tuning: The optimal balance between the number of concepts ($K$) and samples per concept ($M$) remains task-specific and must be determined empirically.
  • The Verification Challenge: While GUIDEDSAMPLING successfully populates the candidate pool with diverse, correct answers, picking the correct minority answer out of a sea of diverse responses remains an open challenge that requires a robust, independent verifier.

Summary updated

BibTeX
@inproceedings{handa2026guidedsampling,
  author = {Divij Handa and Mihir Parmar and Aswin RRV and Md Nayem Uddin and Hamid Palangi and Chitta Baral},
  title = {{GuidedSampling: Steering LLMs Towards Diverse Candidate Solutions at Inference-Time}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=TD9jC48sts},
}
Figure