A calibrated model's confidence matches reality: among its 80 percent predictions, about 80 percent should come true. Break a model's calibration with one slider, then repair it with temperature scaling.
Confidence is not accuracy
Accuracy asks how often the model is right. Calibration asks whether the model knows how often it is right. A weather model that says "70 percent chance of rain" is calibrated if it rains on about 70 percent of the days it says that, regardless of how sharp its forecasts are. The probabilities here come from a sigmoid over logits, and the distortion you will create bends that sigmoid without touching the underlying ranking.
How this playground stays honest: 1,000 (logit, label) pairs are generated once with a seeded generator (seed 31), and each label is drawn from the known true probability sigmoid(logit). The model's reported score is sigmoid(logit / trueT). Because the label process is known, every chart and every number below is computed live from these 1,000 predictions. Nothing is faked.
Reliability Diagram
raw model scores · 10 bins · n = 1,000Confidence Histogram
raw model scoresYour Mission
The model reports sigmoid(logit / trueT) while labels follow sigmoid(logit). Below 1 the logits are inflated, so the model claims more certainty than it has.
Temperature scaling divides the model's logits by T before the sigmoid. Find the T that flattens the reliability gap and minimizes ECE.
Charts show
Raw model ECE
0.016
goal: reach 0.080
ECE after your T
0.016
target: 0.031 or below
Noise floor
0.016
ECE of perfectly calibrated scores on this finite sample; target = floor + 0.015
Best T found
?
move T while the model is miscalibrated
Why the best T recovers the known distortion
labels follow P(y = 1 | z) = sigmoid(z) model reports p = sigmoid(z / trueT) <- the distortion you dialed in your fix q = sigmoid((z / trueT) / T) <- temperature scaling exact inversion trueT * T = 1 => q = sigmoid(z) (perfectly calibrated)
Temperature scaling exactly inverts this family of miscalibration. Dividing the logits by trueT and then by T composes into a single scale factor trueT times T. When that product hits 1, the distortion cancels and the reported probability equals the true label rate. That is why the ECE-minimizing T sits at 1 / trueT (up to the sampling noise of 1,000 labels), so 1 / T recovers the distortion you dialed in.
Your T × trueT
1.00
target: 1.00
trueT (the knob)
1.00
known distortion
1 / (best T)
?
recovered distortion
Recovery check
?
1 / (best T) vs trueT, within 10 percent
Going Deeper