Abstract: Sampling temperature is a key hyperparameter in Large Language Models (LLMs) used to control output randomness. While practitioners often tune this value based on anecdotal "vibe-based" engineering, its actual impact on problem-solving accuracy has lacked rigorous empirical study. This paper presents a systematic evaluation of nine foundational LLMs across a range of temperatures (0.0 to 1.6) and prompting techniques. The results reveal a "Stability Plateau" where accuracy remains statistically unchanged between 0.0 and 1.0, followed by an "Incoherence Threshold" where performance collapses. The findings suggest that for objective tasks, a temperature of 0.0 is optimal for reproducibility without sacrificing quality.
Introduction
In the LLM ecosystem, developers frequently adjust sampling temperature based on the heuristic that lower values are better for logic and higher values for creativity. However, it has been unclear whether the "creativity" introduced by higher temperatures helps a model explore better solution paths or simply introduces noise. This study aims to replace gut instinct with empirical data to determine the optimal temperature for structured problem-solving.
Experimental Methodology
The researchers conducted a massive grid search across several dimensions:
- Models: Nine models including GPT-4, Claude 3 Opus, Gemini 1.5 Pro, and open-weights models like Llama 2 and Mistral Large.
- Prompting Techniques: Five strategies were tested: Baseline, Domain Expertise, Self-recitation, Chain-of-Thought (CoT), and a "Composite" prompt.
- Temperature Sweep: Temperatures were tested from 0.0 to 1.6 in 0.1 increments.
- Datasets: A multi-domain Multiple-Choice Question-and-Answer (MCQA) exam was compiled from ten benchmarks covering science, math, logic, medicine, and law.
Statistical significance was assessed using the non-parametric Kruskal-Wallis test to handle the bimodal nature of accuracy data.
Results and Key Insights
The Stability Plateau
The most significant finding is that for almost every model and prompt combination, accuracy remained remarkably flat between temperatures 0.0 and 1.0. For example, a Kruskal-Wallis test on GPT-3.5 results yielded a p-value of 0.403, indicating no significant difference in performance across this range.
While text similarity metrics (like BLEU and TF-IDF) dropped as temperature increased—confirming that the models were generating diverse reasoning paths—these variations did not translate into improved or degraded final answers in the multiple-choice format.
The Incoherence Threshold
Performance does not remain stable indefinitely. The study identified an "Incoherence Threshold" starting around 1.1 to 1.2. Beyond this point, accuracy drops precipitously as the model's output becomes increasingly erratic.
By a temperature of 1.6, outputs typically degrade into "word salad," rendering the model useless for problem-solving.
Discussion and Recommendations
The choice of prompting technique, such as Chain-of-Thought, had a far more substantial impact on accuracy than any temperature adjustment within the stable range. Because accuracy does not improve with higher temperatures, there is no performance penalty for setting the temperature to 0.0. Doing so ensures deterministic behavior, which is critical for production stability and debugging.
Limitations
The study focused on single-turn MCQA tasks. Future research is needed to determine if temperature plays a more vital role in open-ended generation (e.g., long-form coding) or multi-step agentic workflows where exploration might prevent logical deadlocks.
Conclusion
For objective problem-solving, the "perfect" temperature is a myth. Developers should default to 0.0 to gain reproducibility for free and focus their engineering efforts on optimizing prompts rather than hyperparameters.
Summary updated