[Paper Review] Temperature check: theory and practice for training models with softmax-cross-entropy losses
This paper develops a theory of early learning dynamics for models trained with softmax-cross-entropy loss, showing that the inverse temperature $β = 1/T$ critically influences training speed and generalization, independent of initial logit magnitude. Empirical results across CIFAR10, ImageNet, and IMDB show that tuning $\beta$ in $[10^{-2}, 10^1]$ significantly improves performance, with optimal $\beta$ often far from 1, indicating that temperature is a key hyperparameter for model performance.
The softmax function combined with a cross-entropy loss is a principled approach to modeling probability distributions that has become ubiquitous in deep learning. The softmax function is defined by a lone hyperparameter, the temperature, that is commonly set to one or regarded as a way to tune model confidence after training; however, less is known about how the temperature impacts training dynamics or generalization performance. In this work we develop a theory of early learning for models trained with softmax-cross-entropy loss and show that the learning dynamics depend crucially on the inverse-temperature $β$ as well as the magnitude of the logits at initialization, $||β{\bf z}||_{2}$. We follow up these analytic results with a large-scale empirical study of a variety of model architectures trained on CIFAR10, ImageNet, and IMDB sentiment analysis. We find that generalization performance depends strongly on the temperature, but only weakly on the initial logit magnitude. We provide evidence that the dependence of generalization on $β$ is not due to changes in model confidence, but is a dynamical phenomenon. It follows that the addition of $β$ as a tunable hyperparameter is key to maximizing model performance. Although we find the optimal $β$ to be sensitive to the architecture, our results suggest that tuning $β$ over the range $10^{-2}$ to $10^1$ improves performance over all architectures studied. We find that smaller $β$ may lead to better peak performance at the cost of learning stability.
Motivation & Objective
- To understand how the softmax temperature $T$ (or its inverse $\beta$) affects learning dynamics and generalization in deep neural networks trained with cross-entropy loss.
- To disentangle the effects of temperature $\beta$ from initial logit magnitude $\|\mathbf{Z}^0\|_2$ on training performance.
- To investigate whether generalization improvements with temperature are due to model confidence or dynamical effects during early training.
- To empirically validate theoretical predictions on learning timescales and identify optimal $\beta$ ranges across diverse architectures and datasets.
- To establish $\beta$ as a tunable hyperparameter that can significantly improve model performance beyond standard settings of $T=1$.
Proposed method
- Theoretical analysis of early learning dynamics using linearization around initialization, with gradients scaled by $\tilde{\eta} = \eta \beta^2$ to decouple $\beta$ effects.
- Derivation of two key timescales: $\tau_z \sim \|\mathbf{Z}^0\|_2 / \tilde{\eta}$ for learning onset and $\tau_{nl} \sim \beta / \tilde{\eta}$ for nonlinear departure.
- Use of a correlated initialization strategy to independently control $\beta$ and $\|\mathbf{Z}^0\|_2$ while keeping the neural tangent kernel $\hat{\Theta}$ fixed.
- Large-scale empirical evaluation on Wide ResNet (CIFAR10), ResNet-50 (ImageNet), and GRUs (IMDB) with SGD and JAX/Neural Tangles.
- Systematic ablation of $\beta$ across $10^{-2}$ to $10^1$ and analysis of training stability, convergence speed, and test accuracy.
- Measurement of gradient magnitudes and timescales to validate theoretical predictions on learning dynamics.
Experimental results
Research questions
- RQ1How does the inverse temperature $\beta$ influence the timescale of early learning in models trained with softmax-cross-entropy loss?
- RQ2To what extent does generalization performance depend on $\beta$ versus the initial logit magnitude $\|\mathbf{Z}^0\|_2$?
- RQ3Is the improvement in generalization with non-unit $\beta$ due to changes in model confidence or dynamical effects during training?
- RQ4What is the optimal range of $\beta$ for maximizing performance across diverse architectures and datasets?
- RQ5How does the learning rate scale with $\beta$ to maintain stable training, and what is the resulting optimal $\beta$?
Key findings
- Generalization performance is strongly dependent on $\beta$, with optimal values often far from 1, indicating that $\beta$ is a critical hyperparameter.
- Performance is largely independent of initial logit magnitude $\|\mathbf{Z}^0\|_2$, except when $\|\mathbf{Z}^0\|_2 \gg 1$, where performance degrades.
- Smaller $\beta$ leads to faster initial learning and potentially higher peak performance but also increased training instability, especially without batch normalization.
- The optimal learning rate scales as $\eta^* \sim 1/\beta$, and the early learning timescale is $\tau_z^* \sim \|\mathbf{Z}^0\|_2 / \beta$.
- Empirical results show consistent performance gains when tuning $\beta$ over $[10^{-2}, 10^1]$, with no single optimal value across all architectures.
- The dependence of generalization on $\beta$ is a dynamical phenomenon, not due to changes in model confidence, as confirmed by ablation and calibration analysis.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.