Expected Calibration Error (ECE) is a scalar summary statistic that measures the miscalibration of a model by computing the weighted average of the absolute difference between its confidence (predicted probability) and its accuracy (observed frequency of correctness) across equally spaced probability bins. A perfectly calibrated model has an ECE of 0, indicating that its confidence exactly matches its empirical accuracy.
Glossary
Expected Calibration Error (ECE)

What is Expected Calibration Error (ECE)?
A primary scalar metric for evaluating the calibration of a classification model's predicted probabilities.
The metric is calculated by partitioning all predictions into M bins based on their confidence scores, then taking the weighted average of the discrepancy between each bin's average confidence and its actual accuracy. While ECE provides an intuitive, single-number summary of reliability, it is sensitive to the chosen binning scheme and can be misleading when class distributions are heavily imbalanced or when the model's accuracy is not monotonically related to its confidence.
Key Characteristics of ECE
Expected Calibration Error (ECE) is the primary empirical metric for diagnosing and quantifying the miscalibration of a classification model. It measures the gap between a model's reported confidence and its actual accuracy.
The Binning Mechanism
ECE partitions predictions into M equally-spaced confidence bins (e.g., 0-10%, 10-20%). For each bin, it computes the absolute difference between the average confidence and the observed accuracy within that bin. The final ECE is a weighted average of these gaps, where weights correspond to the proportion of samples in each bin. This discretization makes the metric computationally tractable and visually interpretable via reliability diagrams.
Mathematical Definition
Formally, ECE is defined as:
ECE = Σ (|B_m| / n) * |acc(B_m) - conf(B_m)|
Where:
nis the total number of samplesB_mis the set of samples in binmacc(B_m)is the fraction of correctly classified samples in binmconf(B_m)is the average predicted probability in binm
A perfectly calibrated model has an ECE of 0.
Reliability Diagram Visualization
ECE is almost always accompanied by a reliability diagram. This plot maps average confidence on the x-axis against observed accuracy on the y-axis. A perfectly calibrated model follows the identity line (y=x) . Any deviation above the line indicates underconfidence, while deviation below the line indicates overconfidence—a common pathology in modern deep neural networks.
Limitations and Pitfalls
Despite its popularity, ECE has known weaknesses:
- Bin Sensitivity: The choice of bin count (M) is arbitrary and significantly impacts the score. Too few bins mask miscalibration; too many create noisy, empty bins.
- Class Imbalance Blindness: ECE can be misleadingly low on highly imbalanced datasets where a model predicts the majority class with high confidence.
- Top-Label Focus: Standard ECE only evaluates the confidence of the single predicted class, ignoring the calibration of the full probability vector.
Adaptive Variants
To address fixed-width binning issues, Adaptive ECE (AdaECE) dynamically sizes bins to ensure each contains an equal number of samples. Another refinement, Classwise ECE, computes the calibration error independently for each class and averages the results, preventing a well-calibrated dominant class from hiding severe miscalibration in minority classes. These variants provide a more robust picture of model trustworthiness.
Relationship to Proper Scoring Rules
ECE is a measure of marginal calibration and is not a strictly proper scoring rule. This means minimizing ECE to zero does not guarantee a perfect model; a constant predictor outputting the base rate can achieve zero ECE. For a more complete evaluation, ECE should be paired with a proper scoring rule like the Brier Score or Negative Log-Likelihood (NLL) , which jointly assess calibration and discrimination.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about Expected Calibration Error and its role in evaluating model confidence.
Expected Calibration Error (ECE) is a scalar summary statistic that measures the miscalibration of a model's predicted probabilities by computing the weighted average of the absolute difference between accuracy and confidence across discrete bins. The calculation involves partitioning all predictions into M equally spaced confidence bins (e.g., 0-0.1, 0.1-0.2). For each bin B_m, the algorithm computes the average confidence and the observed accuracy. The ECE is then the sum over all bins of the proportion of samples in that bin multiplied by the absolute difference between the bin's accuracy and confidence: ECE = Σ (|B_m|/n) * |acc(B_m) - conf(B_m)|. A perfectly calibrated model has an ECE of 0, meaning a prediction made with 90% confidence is correct exactly 90% of the time. This metric is the primary diagnostic tool for confidence calibration and is often visualized using a reliability diagram.
ECE vs. Other Calibration Metrics
A comparative analysis of Expected Calibration Error against alternative metrics used to quantify the alignment between predicted confidence and empirical accuracy.
| Feature | Expected Calibration Error (ECE) | Brier Score | Reliability Diagram |
|---|---|---|---|
Metric Type | Calibration Error | Proper Scoring Rule | Visual Diagnostic |
Output Format | Scalar percentage | Scalar (0-1) | Graphical plot |
Decomposes Error | |||
Sensitive to Base Rate | |||
Requires Binning | |||
Number of Parameters | 1 (bin count) | 0 | 1 (bin count) |
Typical Benchmark Value | 0.03 | 0.10 | |
Primary Use Case | Diagnosing over/under-confidence | Overall probabilistic accuracy | Qualitative miscalibration inspection |
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 ECE requires understanding the broader ecosystem of calibration, uncertainty decomposition, and evaluation metrics. These concepts form the foundation for building trustworthy, self-aware models.
Confidence Calibration
The process of aligning a model's predicted probability of correctness with the actual empirical frequency of being correct. A perfectly calibrated model that predicts 70% confidence will be correct exactly 70% of the time. Expected Calibration Error (ECE) is the primary scalar metric used to quantify miscalibration by measuring the gap between confidence and accuracy across binned predictions. Post-hoc methods like temperature scaling and Platt scaling are commonly used to repair calibration without retraining.
Reliability Diagram
A visual diagnostic tool that plots expected sample accuracy against confidence to reveal calibration errors. Predictions are partitioned into M equal-width bins, and the average confidence within each bin is plotted against the observed accuracy. A perfectly calibrated model follows the identity line (y=x). The ECE is computed as the weighted average of the absolute differences between each bin's confidence and accuracy, making the reliability diagram the graphical counterpart to the ECE scalar.
Brier Score
A strictly proper scoring rule that measures the mean squared difference between the predicted probability and the actual binary outcome. Unlike ECE, which only assesses calibration, the Brier Score jointly evaluates both calibration and discrimination (refinement). It decomposes mathematically into a calibration loss term and a refinement term, providing a more complete picture of probabilistic forecast quality. A lower Brier Score indicates better overall performance.
Temperature Scaling
A post-hoc calibration method that divides the logits by a single scalar parameter T (temperature) to soften the softmax output without changing the model's accuracy or prediction ranking. When T > 1, the output distribution becomes smoother and less overconfident. The optimal T is learned by minimizing the Negative Log-Likelihood (NLL) on a held-out validation set. This single-parameter fix is the most common method for reducing ECE in modern neural networks.
Epistemic Uncertainty
Model uncertainty arising from a lack of knowledge or data, which can theoretically be reduced with more training samples or a better model architecture. While ECE measures calibration error, epistemic uncertainty quantifies the model's ignorance. High epistemic uncertainty often correlates with miscalibration in out-of-distribution regions. Methods like Deep Ensembles and Monte Carlo Dropout estimate this uncertainty by measuring prediction variance across multiple stochastic forward passes.
Maximum Calibration Error (MCE)
A related metric that measures the worst-case deviation between confidence and accuracy across all bins, rather than the weighted average computed by ECE. While ECE provides a global summary, MCE identifies the single most miscalibrated bin, which is critical for safety-sensitive applications where any large miscalibration is unacceptable. In high-stakes domains like medical diagnosis or autonomous driving, minimizing MCE is often prioritized over minimizing ECE.

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