Explore modules

Multiclass Temperature Scaling

Adjust confidence without changing a classifier's ranking while tracking stable log loss.

Free theory article

Adjust confidence without changing a classifier's ranking while tracking stable log loss.

Concept & interpretation

Temperature scaling is a simple yet effective technique to calibrate the probabilities output by a neural network. By dividing the logits by a learned scalar temperature parameter before applying the softmax function, we can adjust the model's confidence without altering its predictions.

Experimenting with Temperature

Open the interactive module at Multiclass Temperature Scaling and observe the effect of changing the temperature.

  1. Set Logits to "Moderate" and Temperature to "1". The probability for class 0 is approximately 0.705.
  2. Change Temperature to "4". The probability for class 0 drops to 0.444, making the distribution closer to uniform. The predicted class remains 0.
  3. Set Logits to "Sharp" and Temperature to "0.25". The model becomes extremely confident, with class 0 probability reaching 1.0 (within standard float precision) and the NLL dropping to near zero.
  4. Set Target class to "2". The model was highly confident in class 0, but the target was 2. The NLL explodes to 48.0, penalizing the overconfident wrong prediction.
Read the full free theory article