Expected Calibration Error (ECE) quantifies model miscalibration by computing the weighted average of the absolute difference between confidence and accuracy across discrete probability bins. A perfectly calibrated model has an ECE of zero, meaning a prediction made with 90% confidence is correct exactly 90% of the time. The metric partitions predictions into M equal-interval bins, calculates the gap between the average confidence and the empirical accuracy within each bin, and weights this gap by the bin's relative frequency.
Glossary
Expected Calibration Error (ECE)

What is Expected Calibration Error (ECE)?
Expected Calibration Error (ECE) is a primary scalar summary statistic for measuring the miscalibration of a probabilistic model's confidence estimates.
As a key component of confidence calibration and uncertainty quantification, ECE provides a single, interpretable number for comparing model reliability. While widely used for its simplicity, the metric has known pathologies, including sensitivity to the chosen number of bins and an inability to distinguish between overconfidence and underconfidence. Variants like Adaptive ECE address the fixed-bin width limitation by defining bins to ensure an equal number of samples per bin, offering a more robust assessment of a model's epistemic uncertainty.
Key Characteristics of ECE
Expected Calibration Error (ECE) is the primary scalar metric for quantifying a model's miscalibration. It discretizes probability predictions into bins and computes the weighted average of the absolute difference between accuracy and confidence within each bin.
The Binning Mechanism
ECE partitions predictions into M equally-spaced bins based on confidence scores (e.g., 0-0.1, 0.1-0.2). For each bin:
- Accuracy is the fraction of correctly classified samples.
- Confidence is the mean predicted probability. The absolute difference |acc(B_m) - conf(B_m)| is weighted by the bin's relative size. This prevents a model that is perfectly calibrated on 99% of data but wildly off on 1% from hiding its error.
Reliability Diagrams
ECE is visualized through a reliability diagram, which plots accuracy against confidence for each bin. A perfectly calibrated model (ECE=0) follows the identity line y=x. Deviations reveal systematic biases:
- Below the diagonal: Model is overconfident (confidence > accuracy).
- Above the diagonal: Model is underconfident (confidence < accuracy). Modern neural networks typically exhibit a characteristic overconfidence bias, especially on out-of-distribution inputs.
ECE vs. Brier Score
While both measure calibration, they capture distinct failure modes:
- ECE measures the maximum calibration gap and is non-differentiable due to hard bin assignments, making it unsuitable as a direct training loss.
- Brier Score is a strictly proper scoring rule that decomposes into refinement and calibration terms. It is differentiable but can be dominated by discrimination performance.
- Adaptive ECE variants use equal-mass binning to ensure each bin has sufficient samples, addressing ECE's sensitivity to bin count.
Temperature Scaling
A post-hoc calibration method that directly minimizes ECE by learning a single scalar parameter T > 0 applied to the logits before softmax:
- T = 1: Original probabilities unchanged.
- T > 1: Softens probabilities, reducing overconfidence.
- T < 1: Sharpens probabilities, increasing confidence. Temperature scaling is optimized on a held-out validation set using NLL loss and does not affect the model's ranking or accuracy—it only adjusts the confidence magnitudes.
Classwise ECE
Standard ECE computes calibration only for the predicted class, ignoring miscalibration across all other classes. Classwise ECE extends the metric by computing calibration errors for every class independently and averaging them:
- Detects when a model is systematically overconfident about a specific background class.
- Critical for safety-critical applications where the confidence of a "no-finding" class must be precisely calibrated.
- Requires more samples per bin to maintain statistical reliability.
Limitations and Pitfalls
ECE has known statistical pathologies:
- Fixed bin width can leave many bins empty in low-data regimes, producing unstable estimates.
- Non-differentiability prevents direct optimization via gradient descent.
- Paradox of equal ECE: A model that always predicts 50% confidence with 50% accuracy achieves ECE=0, despite being useless for decision-making. Always pair ECE with a discrimination metric like accuracy or AUC.
ECE vs. Related Calibration Metrics
A technical comparison of Expected Calibration Error against other key metrics used to evaluate the probabilistic calibration of classification models.
| Feature | Expected Calibration Error (ECE) | Maximum Calibration Error (MCE) | Brier Score |
|---|---|---|---|
Primary Objective | Measures the weighted average absolute difference between confidence and accuracy across bins | Measures the maximum absolute difference between confidence and accuracy in any single bin | Measures the mean squared error between predicted probabilities and actual binary outcomes |
Mathematical Formulation | ECE = Σ (|B_m|/n) · |acc(B_m) - conf(B_m)| | MCE = max |acc(B_m) - conf(B_m)| | BS = (1/N) · Σ (p_i - y_i)² |
Sensitivity to Outliers | Moderate; large errors in small bins are weighted down by bin size | Extreme; dominated entirely by the single worst-calibrated bin | Low; squared error penalizes large deviations but averages across all samples |
Decomposability | Cannot be decomposed into refinement and calibration components | Cannot be decomposed; purely a worst-case metric | Decomposable into refinement loss and calibration loss components |
Proper Scoring Rule | |||
Optimal Value | 0.0 (perfect calibration) | 0.0 (no miscalibration in any bin) | 0.0 (perfect deterministic prediction) |
Primary Use Case | Overall calibration assessment for safety-critical applications and model comparison | Worst-case risk analysis where any single overconfident prediction is unacceptable | Joint evaluation of discrimination and calibration; model training objective |
Bin Dependency | High; results vary significantly with binning strategy (equal-width vs. equal-mass) | High; sensitive to bin boundaries and number of bins | None; bin-free metric computed directly on individual predictions |
Frequently Asked Questions
Precise answers to the most common technical questions about Expected Calibration Error (ECE), its calculation, and its role in modern model risk management.
Expected Calibration Error (ECE) is a scalar summary statistic that quantifies the miscalibration of a probabilistic classifier by measuring the weighted average absolute difference between a model's predicted confidence and its empirical accuracy. To calculate ECE, predictions are first partitioned into M equally-spaced confidence bins (e.g., 0-0.1, 0.1-0.2, ..., 0.9-1.0). For each bin B_m, the accuracy is computed as the fraction of correctly classified samples, and the confidence is the mean predicted probability within that bin. ECE is then the weighted average of the absolute difference between accuracy and confidence across all bins: ECE = Σ (|B_m|/n) * |acc(B_m) - conf(B_m)|, where n is the total number of samples. A perfectly calibrated model yields an ECE of 0, meaning a prediction made with 70% confidence is correct exactly 70% of the time. This metric is critical in Confidence Calibration workflows and serves as a primary diagnostic in Hallucination Risk Assessment for large language models.
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
Expected Calibration Error (ECE) is a foundational metric for model reliability. These related concepts form the toolkit for measuring, decomposing, and improving the alignment between a model's confidence and its accuracy.
Reliability Diagram
The primary visual diagnostic for calibration. It plots predicted accuracy against observed accuracy across bins. A perfectly calibrated model follows the identity line (y=x). Deviations reveal systematic overconfidence (bars below the line) or underconfidence (bars above the line). The area between the curve and the diagonal is a visual proxy for ECE.
Maximum Calibration Error (MCE)
A complementary metric to ECE that measures the worst-case deviation between confidence and accuracy across all bins. While ECE provides a weighted average, MCE identifies the single most miscalibrated bin. Critical for high-risk applications where any large miscalibration is unacceptable, regardless of average performance.
Adaptive Calibration Error (ACE)
An improvement over standard ECE that uses adaptive binning instead of fixed-width bins. ACE ensures each bin contains an equal number of predictions, preventing empty or sparse bins that distort ECE calculations. This produces a more robust estimate, especially in models with skewed confidence distributions.
Temperature Scaling
A post-hoc calibration method that applies a single scalar parameter T (temperature) to soften or sharpen the model's output logits before the softmax function. When T > 1, probabilities are smoothed (reducing overconfidence). When T < 1, they are sharpened. Optimized on a held-out validation set to minimize ECE.
Brier Score
A strictly proper scoring rule that measures the mean squared error between predicted probabilities and actual binary outcomes. Unlike ECE, which bins predictions, the Brier Score evaluates each individual prediction. It decomposes into refinement loss and calibration loss, providing a unified view of both discrimination and calibration quality.
Platt Scaling
A parametric calibration technique that fits a logistic regression model on top of a classifier's raw scores. It transforms scores into calibrated probabilities by learning two parameters (A and B) that map the original outputs to well-calibrated posterior probabilities. Originally developed for SVM outputs, now widely used for neural networks.

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