Finding the optimal "temperature" for Large Language Model (LLM) sampling usually requires expensive labeled validation data or blind guesswork. This paper introduces TURN, a zero-shot method that automatically identifies the ideal temperature by locating the "Entropy Turning Point"—a specific threshold where a model’s output quality begins to collapse into chaos.
The Temperature Dilemma in Multi-Sample Inference
When using LLMs for complex reasoning tasks like math or coding, researchers often rely on "multi-sample inference." Instead of asking the model once, they generate $N$ solutions and use strategies like Majority Voting (picking the most common answer) or Best-of-N (using a reward model to pick the best one).
The success of these strategies hinges entirely on the sampling temperature ($T$):
- Too low: The model is "boring" and repetitive; it lacks the diversity needed to eventually generate a correct answer in the pool.
- Too high: The model becomes "hallucinatory" and incoherent, leading to a "quality collapse" where none of the samples are useful.
Currently, engineers either use a fixed default (like $T=0.7$) or perform an exhaustive "grid search" using labeled validation data to find the sweet spot. However, labeled data is often unavailable for new tasks, and the optimal temperature shifts depending on the model's size, its training history, and the specific task at hand.
The TURN Method: Finding the Entropy Turning Point
To solve this, the authors propose TURN (Turning Point Temperature Selection), which treats a model's internal entropy as a self-assessment tool to find the optimal temperature without labeled data.
- Mapping the Entropy Curve: The method samples a small number of unlabeled prompts across a range of temperatures (e.g., 0.1 to 1.4).
- Identifying the Turning Point (EntP): As $T$ increases, the log-scale of token-level entropy follows a specific pattern: it is initially concave (growing slowly) and then becomes convex (spiking sharply). The point where this transition occurs is the Entropy Turning Point (EntP).
- The TURN Algorithm: The optimal temperature is typically right at this turning point. The authors add a small "adaptation factor" ($\beta$) based on the aggregation method: $\beta=0$ for Majority Voting and $\beta=0.1$ for Best-of-N (since Best-of-N can tolerate slightly more noise for higher diversity).
To explain why this entropy spike happens, the researchers developed a stochastic model showing that in sequential generation, a single "improper" token significantly increases the probability of subsequent errors, leading to an exponential blow-up in uncertainty.
Key Insights and Results
The researchers evaluated TURN across 13 different LLMs (including Llama-3.1, Mistral-7B, Qwen2.5, and DeepSeek-Math) using two primary benchmarks: MATH (evaluated via Majority Voting) and MBPP (evaluated via Best-of-N).
- The "Aha!" Correlation: As shown in the figure above, the accuracy of a model at the EntP is almost perfectly correlated ($r = 0.9998$) with the maximum accuracy found through exhaustive, labeled grid searching. The model's own uncertainty curve is a near-perfect proxy for its peak performance.
- Specialization Increases Heat Tolerance: Fine-tuned or "task-specific" models (like those trained specifically for math) have higher optimal temperatures. Because they are more "certain" of the task distribution, they can explore higher diversity without falling into quality collapse as quickly as general-purpose base models.
- Sample Efficiency: You don't need thousands of samples to find the EntP. The authors found that as few as 40 samples provide enough data to stabilize the entropy curve.
- Performance: TURN successfully identified a temperature within the "$\epsilon$-optimal" range (within 2% of peak performance) for 12 out of 13 models on the MATH dataset and 11 out of 13 on MBPP. The average "performance drop" compared to the absolute best possible temperature found via grid search was a mere 0.32% for MATH and 0.59% for MBPP.
Limitations and Future Work
While TURN eliminates the need for labeled data, it still requires running inference across multiple temperature steps to map the initial curve, which carries a compute cost for very large models. Additionally, the $\beta$ adaptation factor (0.1 for Best-of-N) is currently a heuristic derived from the MATH dataset; future work could involve calculating this factor dynamically.
Finally, the paper focuses on reasoning-heavy tasks like math and code. It remains to be seen if the "Entropy Turning Point" is as clear of a signal in creative writing or subjective dialogue tasks where "correctness" is less binary.
Summary updated