Glossary term · · 3 min read
Expected Calibration Error
A model routes customer tickets to three departments and reports a percentage confidence for each decision. You check 40 tickets: average confidence is 80%, and 80% of the decisions are correct. Do these numbers describe the model’s reliability well? Matching averages alone can hide a problem: the model overstates confidence in one group and understates it in another.
Expected Calibration Error (ECE) summarizes these discrepancies. It divides decisions into confidence intervals, compares average confidence with the proportion of correct decisions in each interval, then averages the absolute differences, accounting for the number of decisions. This is an approximate measure of Calibration, the agreement between stated probabilities and the frequency of correct answers. We describe the version for confidence in the selected category, presented by Guo and colleagues in §2, Equation 3 of On Calibration of Modern Neural Networks.

How much each group weighs
This is our own educational example. A human has checked the actual departments for every ticket:
| Confidence of each decision | Number of tickets | Correct decisions | Absolute difference |
|---|---|---|---|
| 90% | 30 | 24/30 = 80% | 10 percentage points |
| 50% | 10 | 8/10 = 80% | 30 percentage points |
Use ten equal intervals: (0%, 10%], …, (90%, 100%]. The left endpoint is excluded and the right included, so 90% falls into (80%, 90%]. Empty intervals contribute nothing to the sum.
The first group contains 30/40 decisions and the second 10/40. Therefore:
ECE = (30/40 × 10) + (10/40 × 30) = 15 percentage points.
An ordinary average of the two differences would give 20. It would treat the small group just like the group three times its size. ECE averages over decisions, accounting for the groups they belong to. This does not mean 15% of answers are wrong: here 8/40, or 20%, are wrong.
Change the intervals, not the model
What happens if everything is merged into one interval? Average confidence is (30 × 90% + 10 × 50%)/40 = 80%, matching accuracy, 32/40. ECE drops to zero even though no decision or confidence has changed. Opposing deviations have disappeared within the combined average. Try it below.
In the demonstration, you change only the partition of the 0–100% range. We show occupied intervals, their share of tickets, and each interval’s contribution to ECE.
Limitation: the result depends on interval boundaries and the available sample; zero does not prove perfect calibration. ECE for the selected category also does not evaluate all probabilities for the remaining categories. When comparing models, report the partition and sample size. Supplement S1 discusses how the approximation relates to the ideal measure.
Check the final result on separate examples with known answers that were not used to choose corrections: this is a Test Set. Cross-entropy asks a different question: how much loss the probability assigned to the actual correct answer incurs, rather than differences between averages within intervals.
The text and illustration were prepared with AI assistance. The data are an invented numerical example, not a study of a particular LLM.