Temperature scaling is a simple method that allows to control the uncertainty of probabilistic models. It is mostly used in two contexts: improving the calibration of classifiers and tuning the stochasticity of large language models (LLMs). In both cases, temperature scaling is the most popular method for the job. Despite its popularity, a rigorous theoretical analysis of the properties of temperature scaling has remained elusive. We investigate here some of these properties. For classification, we show that increasing the temperature increases the uncertainty in the model in a very general sense (and in particular increases its entropy). However, for LLMs, we challenge the common claim that increasing temperature increases diversity. Furthermore, we introduce two new characterisations of temperature scaling. The first one is geometric: the tempered model is shown to be the information projection of the original model onto the set of models with a given entropy. The second characterisation clarifies the role of temperature scaling as a submodel of more general linear scalers such as matrix scaling and Dirichlet calibration: we show that temperature scaling is the only linear scaler that does not change the hard predictions of the model.
Figures & tables
Figure 1: Entropies of two tempered versions of a toy language model. Standard temperature scaling has the expected monotonic effect on entropy, but is impractical for LLMs. The “myopic" version, widely used in practice, has a much less intuitive behaviour.
Figure 2: Temperature scaling as an information projection. In both cases, the initial model p is projected onto the set Q of distributions of constant entropy h⋆=0.9 . The blue arrow is the path of all tempered models between p and its projection pβ⋆ . This path can be interpreted as the geodesic between p and pβ⋆ . (Left) The initial distribution p=(0.01,0.09,0.9) has a lower entropy than h⋆ , and is warmed up towards pβ⋆ with β⋆≈0.37 . (Right) The initial distribution p=(0.4,0.35,0.25) has a higher entropy than h⋆ , and is cooled down towards pβ⋆ with β⋆≈3.98 .
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Figure 3: Terms involved in the computation of the entropy of the myopically scaled model. (Left) The marginal and conditional entropies of Equation 44 . (Right) The two terms of the decomposition of Equation ( 45 ). The source of nonmotonicity is the term πβH(pβ(x2∣x1=1) , that is the product of an increasing and a decreasing functions.
Calibration is central to reliable semantic uncertainty quantification, yet prior work has largely focused on discrimination, neglecting calibration. As calibration and discrimination capture distinct aspects of uncertainty, focusing on discrimination alone yields an incomplete picture. We address this gap by systematically evaluating both aspects across a broad set of confidence measures. We show that current approaches, particularly fixed-temperature heuristics, produce systematically miscalibrated and poorly discriminative semantic confidence distributions. We demonstrate that optimising a single scalar temperature, which, we argue, provides a suitable inductive bias, is a surprisingly simple yet effective solution. Our exhaustive evaluation confirms that temperature scaling consistently improves semantic calibration, discrimination, and downstream entropy, outperforming both heuristic baselines and more expressive token-level recalibration methods on question-answering tasks.
Tom A. Lamb, Desi R. Ivanova, Philip H. S. Torr +1
University of Oxford · University of Toronto & Vijil
Preference alignment often makes large language models (LLMs) overconfident and poorly calibrated. Traditional post-hoc temperature scaling is inherently domain-dependent: a temperature fitted on one domain does not generalize across domains. This motivates us to modify model parameters during training to improve calibration. We propose maximizing the entropy of predictive distributions as the calibration objective, which directly targets overconfidence by discouraging overly concentrated predictions. Inspired by temperature scaling, we realize this through a bilevel optimization formulation, where the lower level trains the model under a parametric loss and the upper level selects loss hyperparameters to maximize entropy. To make the framework practical at LLM scale, we adopt an efficient first-order approximation that avoids explicit second-order computation. Across both multiple-choice and open-ended generative question answering, experiments demonstrate that our method yields well-calibrated LLMs with particular advantages in out-of-domain generalization.
Ruochen Jin, Zhanliang Wang, Zongyu Dai +2
Dartmouth College, Hanover, NH · University of Pennsylvania, Philadelphia, PA · National University of Singapore, Singapore
Reverse Kullback-Leibler (RKL) divergence is widely favored over forward KL (FKL) in large language models (LLM) distillation, yet this preference is largely based on comparisons that omit the temperature τ, overlooking its central role in softening teacher distributions and improving knowledge transfer. In this work, we revisit temperature in LLM distillation and show that it fundamentally changes the comparison between FKL and RKL. Our analysis reveals an asymmetric effect: temperature substantially enriches FKL with non-dominant token signals, whereas it mainly rescales RKL gradients, causing FKL to benefit much more from τ scaling than RKL. This asymmetry overturns the standard empirical conclusion: although RKL outperforms FKL at τ=1, FKL consistently surpasses RKL at higher temperatures across instruction-following benchmarks. Moreover, the impact of temperature is not limited to FKL; it improves a broader family of distillation objectives, enabling simple KL-based methods to achieve competitive performance against recent state-of-the-art LLM distillation approaches.
Hoang-Chau Luong, Lingwei Chen
Golisano College of Computing and Information Sciences Rochester Institute of Technology Rochester, NY, United States