Expected Calibration Error (ECE) is a scalar summary statistic that measures the miscalibration of a probabilistic model. It is computed by partitioning all predictions into M equally spaced confidence bins, and then calculating the weighted average of the absolute difference between the model's accuracy and its average confidence within each bin. A perfectly calibrated model has an ECE of zero, meaning a prediction assigned a 70% confidence score is correct exactly 70% of the time.
Glossary
Expected Calibration Error (ECE)

What is Expected Calibration Error (ECE)?
Expected Calibration Error (ECE) is the primary empirical metric for quantifying a model's calibration by measuring the discrepancy between its stated confidence and its actual accuracy.
The metric is formally defined as ECE = Σ (|B_m| / n) * |acc(B_m) - conf(B_m)|, where n is the total number of samples. While widely used for its intuitive simplicity, ECE is sensitive to the chosen binning scheme and can be biased by imbalanced datasets. It serves as a critical diagnostic for confidence calibration signals, directly informing whether a model's self-assessed certainty can be trusted in high-stakes, autonomous decision-making systems.
Key Characteristics of ECE
Expected Calibration Error (ECE) is the primary empirical metric for evaluating a model's calibration. It quantifies the discrepancy between a model's reported confidence and its actual accuracy by partitioning predictions into bins and computing a weighted average of the absolute difference within each bin.
The Binning Mechanism
ECE operates by sorting all predictions into M equally-spaced confidence bins (e.g., 0-10%, 10-20%). For each bin, it calculates the absolute difference between the average confidence and the observed accuracy. The final ECE is the weighted average of these gaps, where the weight is the proportion of samples in each bin. A perfectly calibrated model has an ECE of 0.
Reliability Diagrams
ECE is most often visualized through a reliability diagram, which plots accuracy against confidence. Key features:
- Perfect calibration appears as a diagonal line (y=x)
- Overconfidence manifests as points below the diagonal (high confidence, low accuracy)
- Underconfidence shows points above the diagonal
- The ECE value is the weighted area between the plotted curve and the diagonal
Mathematical Formulation
ECE is formally defined as: ECE = Σ (|B_m| / n) * |acc(B_m) - conf(B_m)|
Where:
- B_m is the set of samples in bin m
- n is the total number of samples
- acc(B_m) is the empirical accuracy in bin m
- conf(B_m) is the average predicted probability in bin m
This formulation ensures that bins with more samples contribute proportionally more to the final error score.
Limitations and Pathologies
Despite its widespread use, ECE has known weaknesses:
- Fixed binning bias: The choice of bin count (typically 10 or 15) is arbitrary and affects the score
- Class imbalance blindness: ECE can be misleadingly low on highly imbalanced datasets where a model predicts the majority class with high confidence
- No sharpness measure: ECE only measures calibration, not the usefulness of the probability estimates (a model predicting the base rate for every sample has perfect ECE but zero utility)
- Adaptive variants like AdaECE and Classwise ECE have been proposed to address these issues
Relationship to Proper Scoring Rules
ECE is a measure of calibration error, not a proper scoring rule. It should be used alongside metrics like:
- Brier Score: Decomposes into calibration and refinement components
- Negative Log-Likelihood (NLL): A strictly proper scoring rule that penalizes both poor calibration and poor discrimination
- Expected Normalized Calibration Error (ENCE): A regression-specific adaptation
While ECE is intuitive and widely reported, proper scoring rules provide a more theoretically grounded evaluation of probabilistic predictions.
Modern Mitigation: Temperature Scaling
The most effective post-hoc calibration method for reducing ECE in neural networks is temperature scaling, a single-parameter variant of Platt scaling. It works by:
- Dividing all logits by a scalar temperature T before the softmax
- T > 1 softens probabilities, reducing overconfidence
- T < 1 sharpens probabilities, reducing underconfidence
- The optimal T is found by minimizing NLL on a held-out validation set
Crucially, temperature scaling does not affect the model's accuracy or rank-ordering of predictions—it only recalibrates the confidence scores.
Frequently Asked Questions
Explore the core concepts behind Expected Calibration Error (ECE), the primary metric for evaluating the reliability of probabilistic predictions in machine learning models.
Expected Calibration Error (ECE) is a primary metric for measuring model calibration by partitioning predictions into bins and computing the weighted average of the difference between accuracy and confidence in each bin. The calculation involves a discrete approximation: predictions are sorted and divided into M equal-width interval bins (e.g., 10 bins representing 0-10% confidence, 10-20%, etc.). For each bin B_m, the average confidence and the actual accuracy are calculated. The ECE is the weighted average of the absolute difference between these two values across all bins, where the weight is the proportion of samples in that bin. A perfectly calibrated model has an ECE of 0, meaning its confidence matches its accuracy exactly. A high ECE indicates overconfidence (confidence > accuracy) or underconfidence (accuracy > confidence). This metric is critical for risk-sensitive applications like medical diagnosis and autonomous driving, where a model's self-assessment of uncertainty must be trustworthy.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Mastering Expected Calibration Error requires understanding the broader ecosystem of metrics, techniques, and signals that govern model trustworthiness. These concepts form the technical foundation for building AI systems whose confidence scores are statistically reliable.
Confidence Score
A quantitative metric, typically a probability between 0 and 1, assigned by a model to indicate the likelihood that its prediction is correct. In classification, this is often the softmax output. For generative models, it may be a token-level probability. ECE directly measures how well these scores align with actual empirical accuracy—a model with perfect calibration will have a confidence of 0.8 and be correct exactly 80% of the time for all predictions assigned that score.
Temperature Scaling
A post-hoc calibration method that applies a single scalar parameter T to soften or sharpen the output logits before the softmax function. When T > 1, the distribution flattens, reducing overconfidence. When T < 1, it sharpens, correcting underconfidence. The optimal T is learned on a held-out validation set by minimizing the Negative Log-Likelihood (NLL) . Temperature scaling is the simplest and most widely-used approach to reduce ECE without affecting model accuracy.
Reliability Diagram
The standard visualization for ECE. Predictions are partitioned into M equal-width bins (typically 10) based on confidence. For each bin, the mean confidence is plotted against the observed accuracy. A perfectly calibrated model produces a diagonal line (y = x). Deviations above the diagonal indicate underconfidence; deviations below indicate overconfidence. The ECE is the weighted average of these bin-wise gaps.
Epistemic vs. Aleatoric Uncertainty
ECE primarily captures epistemic uncertainty—the reducible error from limited data or model capacity. This is distinct from aleatoric uncertainty, which is the irreducible noise inherent in the data itself (e.g., overlapping classes). A model can have low ECE while still having high aleatoric uncertainty. Advanced calibration techniques decompose these two sources to provide more nuanced confidence estimates.
Conformal Prediction
A distribution-free framework that provides rigorous mathematical guarantees on coverage. Instead of a single confidence score, it outputs a prediction set containing the true label with a user-specified probability (e.g., 95%). Unlike ECE, which measures average calibration, conformal prediction offers instance-level validity. It serves as a complementary approach when the goal is guaranteed error control rather than probabilistic calibration.
Calibration Drift
The degradation of a model's calibration over time as the data distribution shifts in production. A model with excellent ECE at deployment may become severely miscalibrated as user behavior, seasonality, or real-world conditions change. Monitoring ECE on live inference data is a critical MLOps practice. Drift detection triggers retraining or recalibration of the temperature parameter to restore statistical alignment between confidence and accuracy.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us