A neural classifier can choose the correct class often enough for an application while assigning probabilities that are too concentrated or too diffuse. Accuracy alone does not expose this mismatch. A system that acts differently at confidence thresholds also depends on the numerical probabilities attached to its predictions.
Temperature scaling is a post-training calibration method that adjusts the sharpness of classifier logits with one positive scalar. For a fixed input, it preserves the ordering of logits, so the predicted class remains unchanged when ordinary argmax decoding is used. What changes is the probability distribution produced after softmax.
This narrow behavior makes temperature scaling useful when the ranking of classes is acceptable but the confidence scale needs separate adjustment.
Temperature acts before softmax
Let a classifier produce logits z_1, ..., z_K for K classes. Standard softmax converts them to probabilities:
p_i = exp(z_i) / sum_j exp(z_j)Temperature scaling introduces a scalar T > 0:
p_i(T) = exp(z_i / T) / sum_j exp(z_j / T)A temperature above one reduces differences between scaled logits and produces a flatter probability distribution. A temperature below one enlarges those differences and produces a sharper distribution. At T = 1, the probabilities are unchanged.
Because division by the same positive scalar preserves logit order,
z_a > z_b <=> z_a / T > z_b / Tthe argmax class does not change. This is a property of scalar temperature scaling. Methods that use class-specific parameters or transform logits in other forms need not preserve the same ranking.
The effect is easier to see with three logits:
logits: [3.0, 1.0, 0.0]
T = 1: softmax([3.0, 1.0, 0.0])
T = 2: softmax([1.5, 0.5, 0.0])The first class remains the largest in both cases, but its probability moves closer to the others when T increases.
The scalar is fitted on held-out predictions
Temperature is normally fitted after the classifier parameters are fixed. The fitting data must be separate from the examples used to train the classifier if the resulting calibration estimate is intended to reflect unseen data.
For multiclass classification, a common fitting objective is negative log-likelihood on a held-out calibration set. If example n has true class y_n, the objective can be written as:
NLL(T) = -sum_n log p_y_n(T)Only T is optimized. The network weights and original logits remain fixed.
This separation matters operationally. Temperature scaling is not another round of model training and does not repair representations or decision boundaries. It maps an existing set of logits to a different confidence scale.
The fitted scalar also belongs to a particular model and data regime. Replacing the checkpoint, changing label definitions, or moving to a materially different input distribution can change the relationship between logits and observed outcomes. Reusing an old temperature in those cases is an assumption that needs evaluation rather than a mathematical guarantee.
Calibration and classification accuracy measure different behavior
A classifier can retain exactly the same top-one predictions after temperature scaling because the logit ranking is preserved. Its accuracy is therefore unchanged under deterministic argmax classification, apart from edge cases involving exact ties and implementation-specific tie handling.
Probability quality can still change substantially. Consider a group of predictions emitted near confidence 0.9. If the selected class is correct much less frequently than that confidence suggests, the probabilities are over-concentrated for that group. Increasing temperature can reduce confidence without moving the decision boundary.
This distinction is relevant to systems that consume probabilities rather than only class IDs. Examples include selective prediction, human-review thresholds, cascades that invoke another model below a confidence cutoff, and expected-cost decisions that combine probabilities with unequal action costs.
Changing calibration can change those downstream decisions even though classifier accuracy is fixed. A threshold such as 0.8 refers to the probability scale, so recalibration can move examples across it.
Reliability estimates depend on how they are measured
Calibration is often inspected by grouping predictions according to confidence and comparing average confidence with empirical accuracy inside each group. A reliability diagram visualizes that relationship.
A binned calibration statistic can be useful as a summary, but its value depends on choices such as bin boundaries, number of bins, and weighting. Two binning schemes can summarize the same predictions differently. A single scalar should therefore not be treated as a complete description of calibration behavior.
Negative log-likelihood avoids confidence bins and is directly compatible with fitting temperature, but it also captures more than a visual confidence-versus-frequency comparison. The metric used for fitting and the diagnostics used for evaluation should be stated explicitly rather than collapsed into a generic calibration score.
Evaluation also needs held-out data that resembles the conditions in which probabilities will be consumed. A well-fitted temperature on one distribution does not impose calibration on arbitrary shifted inputs.
One scalar cannot repair class-specific structure
Temperature scaling has only one degree of freedom. Every logit vector is divided by the same scalar, regardless of class or input. That constraint is the source of both its simplicity and its limits.
Suppose a classifier is too confident for one subset of classes but too uncertain for another. A single temperature cannot independently move those groups in opposite directions. It can only make all softmax distributions globally sharper or flatter according to their existing logit gaps.
Likewise, temperature scaling cannot correct a systematic ranking error. If class A has a larger logit than the correct class B, positive scalar division keeps A above B. The calibration layer does not create information that the classifier failed to encode in its ordering.
More flexible calibration mappings can alter class relationships, but that added flexibility changes the failure surface. Extra parameters need enough representative calibration data, and a mapping that can alter rankings may also alter classification accuracy. The appropriate method depends on which properties must remain fixed.
Calibration must be evaluated after deployment transformations
The probabilities used by an application should match the probabilities evaluated during calibration. Applying another logit transformation after temperature scaling changes the distribution that the calibration procedure fitted.
This can appear in pipelines that combine model scores, mask classes, renormalize a subset of labels, or apply separate confidence heuristics. If the final consumer sees transformed probabilities, evaluating only the intermediate calibrated softmax leaves a gap between measurement and use.
The same issue appears when inference code does not reproduce the logits used during fitting. Differences in preprocessing, checkpoint version, label ordering, or output transformation can invalidate the stored temperature even if the scalar itself is loaded correctly.
A useful implementation contract therefore includes the model identifier, label mapping, preprocessing path, temperature value, and the exact point in the scoring pipeline where scaling is applied. The scalar is small; the context that gives it meaning is not.
Threshold policies need a second validation pass
Calibration is often introduced because another component consumes confidence thresholds. Fitting T is only part of that change. The downstream policy needs evaluation again on probabilities produced with the fitted temperature.
If a review queue accepts predictions above a fixed cutoff, temperature scaling can change queue volume without changing any argmax predictions. If a cascade routes low-confidence examples to a larger model, its routing rate can move for the same reason. These are expected consequences of changing the confidence scale.
The threshold itself may have been selected against uncalibrated scores. Keeping it unchanged after calibration preserves a number, not necessarily the operating point it represented. Threshold selection and probability calibration are related configuration decisions and should be versioned together when the application depends on both.
Temperature scaling is most precise when its role stays narrow: it adjusts the global sharpness of a fixed classifier’s logits while retaining their ordering. That makes it a clean intervention for confidence calibration, but it also sets a firm boundary. Errors in ranking, class-specific distortions, and distribution shift remain separate problems that one scalar cannot resolve.