Source-linked AI summary
Revisiting the Calibration of Modern Neural Networks
Matthias Minderer, Josip Djolonga, Rob Romijnders, Frances Hubis, Xiaohua Zhai, Neil Houlsby, Dustin Tran, Mario Lucic
TL;DR
The paper asks whether newer, more accurate neural networks are poorly calibrated, a question motivated by safety-critical uses where predictive uncertainty matters. It systematically compares recent image-classification models across accuracy, calibration, architectures, model sizes, pretraining, and distribution shifts, finding that recent models—especially non-convolutional ones—are often well calibrated and that architecture helps explain differences.
Problem
Reported miscalibration in accurate modern neural networks raises a safety-relevant question about whether newer architectures remain poorly calibrated.
Method
The paper systematically compares recent image-classification models, relating accuracy and calibration to architecture, model size, pretraining, and distribution shift.
Results
Recent image models are well calibrated across distribution shifts, with non-convolutional MLP-Mixer and Vision Transformer families among the best calibrated; size and pretraining do not fully explain family differences.
Takeaways & Limitations
The results suggest that improving model accuracy may continue to benefit calibration and that architecture is a major determinant of calibration properties.
Takeaways & Limitations
ECE estimation is biased by binning and finite sample size, so model rankings and accuracy–calibration conclusions can depend on the chosen ECE variant.
Abstract
from arXiv · showhide
Accurate estimation of predictive uncertainty (model calibration) is essential for the safe application of neural networks. Many instances of miscalibration in modern neural networks have been reported, suggesting a trend that newer, more accurate models produce poorly calibrated predictions. Here, we revisit this question for recent state-of-the-art image classification models. We systematically relate model calibration and accuracy, and find that the most recent models, notably those not using convolutions, are among the best calibrated. Trends observed in prior model generations, such as decay of calibration with distribution shift or model size, are less pronounced in recent architectures. We also show that model size and amount of pretraining do not fully explain these differences, suggesting that architecture is a major determinant of calibration properties.
1 Introduction
The paper revisits whether modern neural networks become poorly calibrated as they become more accurate, especially under newer architectures and training regimes. It systematically compares accuracy, calibration, and design features, finding that recent models can be both accurate and well calibrated.
- Recent state-of-the-art models, including MLP-Mixer and Vision Transformers, are well calibrated compared with past models and more robust to distribution shift.These models are non-convolutional architectures highlighted among the best current models.
- In-distribution calibration slightly worsens as model size increases, but the accompanying accuracy improvement outweighs this deterioration.
- Under distribution shift, calibration improves with model size, reversing the in-distribution trend.
- Accuracy and calibration are correlated under distribution shift, so optimizing accuracy may also benefit calibration.
- Model size, pretraining duration, and pretraining dataset size do not fully explain calibration differences between model families.The results point toward architecture as an important determinant of calibration.
2 Related Work
Prior work reported poor calibration in modern and larger neural networks, while this paper reassesses those trends using recent image models and distribution shifts. The review also distinguishes intrinsic calibration from post-hoc calibration methods and highlights consistent cross-metric findings.
- Expected Calibration Error measures the absolute difference between predictive confidence and accuracy, but its estimation can be biased and depends on estimator variants.The paper focuses on ECE while discussing its statistical pitfalls and mitigation strategies.
- Earlier studies reported that larger modern networks were worse calibrated even as classification error decreased.
- For recent models, the size-related calibration trend is negligible in-distribution and reverses under distribution shift.
- Calibration and accuracy both deteriorate under distribution shift, but some recent model families show very slow calibration decay.In these cases, accuracy decay may be more relevant in practice.
- Models with the best in-distribution calibration are also best calibrated across a range of out-of-distribution benchmarks.This suggests that designing models for in-distribution performance may also benefit out-of-distribution performance.
- The study examines intrinsic calibration properties rather than methods such as post-hoc rescaling, prediction averaging, or data augmentation.
3 Definitions and Notation
The paper defines calibration for multiclass predictors and focuses on the practical top-label condition. It measures miscalibration primarily with ECE, estimated by binning predictions according to their top confidence.
- A multiclass predictor maps each input X to a probability distribution over k labels in the simplex.
- A model is calibrated when predicted probabilities match observed label frequencies; for example, predictions of 0.3 should be correct 30% of the time.
- Top-label or argmax calibration requires this probability-frequency agreement only for the most likely predicted label.
- Expected Calibration Error quantifies miscalibration as disagreement between top-label confidence and accuracy.
- ECE is estimated by assigning samples to bins based on their top predicted probability, computing confidence and accuracy within each bin, and averaging the discrepancies.
4 Empirical Evaluation
The evaluation compares recent image-classification model families across in-distribution and out-of-distribution settings, examining accuracy, calibration, model size, pretraining, and temperature scaling. Recent non-convolutional families are highly calibrated and more robust to distribution shift, while model size and pretraining do not fully explain family differences.
- In-Distribution Calibration: Recent families including MLP-Mixer, ViT, and BiT combine high accuracy with strong in-distribution calibration compared with earlier models.This pattern holds before and after temperature scaling.
- In-Distribution Calibration: Temperature scaling separates model-family calibration trends and shows recent architectures remain better calibrated than past models after recalibration.It also reveals more consistent accuracy-calibration relationships within families.
- Model Size and Pretraining: Larger models usually have higher in-distribution calibration error but lower classification error, placing families on distinct accuracy-calibration Pareto sets.For a given accuracy, ViT models can be better calibrated than BiT models, so model size alone cannot explain the family difference.
- Model Size and Pretraining: Across a 300-fold increase in pretraining dataset size, BiT calibration remains essentially unchanged while accuracy increases, so pretraining amount does not fully explain family differences.For BiT-R50x1, post-scaling ECEs are 0.0185, 0.0182, and 0.0185 across IMAGENET, IMAGENET-21K, and JFT-300, respectively.
- Accuracy and Calibration Under Distribution Shift: Under IMAGENET-C distribution shift, calibration error generally increases, but its decay is slower for MLP-Mixer and ViT than for other families.This robustness appears both before and after temperature scaling.
- Accuracy and Calibration Under Distribution Shift: Out-of-distribution calibration largely follows in-distribution calibration and accuracy, with ImageNet Pareto-optimal models remaining Pareto-optimal on natural out-of-distribution datasets.The reported accuracy-calibration relationship is consistent across models within families and across datasets.
5 Pitfalls and Limitations
Calibration assessment is complicated by estimator bias, which can alter model rankings and even reverse apparent accuracy–calibration relationships. Jointly considering accuracy and calibration, alongside alternative metrics, provides more stable comparisons.
- Practical model choice: In selective prediction, the higher-accuracy BiT-R152x4 model has lower relative cost than better-calibrated BiT-R50x1 for practical rejection rates across tested abstention costs.The comparison combines misclassification and abstention costs over cost ratios and abstention rates.
- Measurement bias: ECE estimation has binning and finite-sample biases that can respectively under- and over-estimate true calibration error.Their magnitudes depend on multiple factors, including model accuracy and bin size.
- Measurement bias: Different ECE variants can produce opposite conclusions about the relationship between accuracy and calibration, especially across widely varying accuracies.The positive finite-sample bias depends on accuracy and bin size.
- Measurement bias: Higher-accuracy models have lower ECE estimation bias because they have lower prediction variance and outputs that correlate more with correct labels.The latter effect is represented by higher covariance between confidence-related outputs and correctness.
- Robust comparisons: Accuracy–calibration Pareto-optimal models rarely change even when ECE-only rankings change across calibration-estimation choices.The study also evaluates alternative ECE variants spanning binning schemes, normalization, and label aggregation.
- Robust comparisons: The same model-family relationships hold across ECE, NLL, and Brier score, with the largest MLP-Mixer and ViT variants usually remaining Pareto-optimal.Residualizing NLL and Brier score against classification error makes these relationships especially clear.
6 Conclusion
A large study finds that recent state-of-the-art image models are well calibrated across distribution shifts, with no general trend toward poorer calibration in newer or more accurate networks. Model size and pretraining amount do not fully explain family differences, pointing to architecture as an important determinant.
- 6 Conclusion: Recent state-of-the-art image models are well calibrated across distribution shifts despite being designed primarily for accuracy.The conclusion reports no general trend toward poorer calibration in recent or highly accurate networks.
- 6 Conclusion: There is no general trend for recent or highly accurate neural networks to be poorly calibrated compared with older or less accurate models.
- 6 Conclusion: Model size and pretraining amount do not fully account for intrinsic calibration differences between model families.The study therefore points toward architecture as a major determinant of calibration.
- 6 Conclusion: MLP-Mixer and Vision Transformers are among the best-calibrated models both in-distribution and out-of-distribution.These are recent architectures that are not based on convolutions.
A.2 Datasets
The study evaluates accuracy and calibration on ImageNet and several out-of-distribution benchmarks, while using ImageNet-21K and JFT-300 as pretraining datasets. The benchmark descriptions specify dataset composition, class coverage, perturbations, and evaluation splits.
- Evaluation datasets: The evaluation includes ImageNet, ImageNetV2, ImageNet-C, ImageNet-R, and ImageNet-A benchmarks.ImageNet-C contains 15 perturbations at 5 severities, totaling 75 datasets.
- Evaluation datasets: ImageNet evaluation uses 40,000 randomly sampled validation images, reserving 10,000 images for fitting temperature scaling.
- Evaluation datasets: ImageNet-R contains 30,000 images from 200 classes, and evaluation uses logits restricted to those 200 classes.
- Pretraining datasets: Pretraining uses ImageNet-21K and JFT-300, containing 14.2 million and approximately 300 million images, respectively.ImageNet-21K has about 21,000 classes, while JFT-300 has 18,291 hierarchical classes.
B.1 Fine-grained Analysis of Pretraining
Fine-grained analyses separate the effects of pretraining dataset size and duration from broader accuracy–calibration relationships. Dataset size has little consistent calibration effect, while longer pretraining slightly worsens calibration as classification error decreases.
- Pretraining effects: Pretraining dataset size has little consistent effect on calibration error.Figure 10 compares BiT models using different dataset sizes or pretraining durations while holding the other factor constant.
- Pretraining effects: Longer pretraining slightly increases calibration error while decreasing classification error.
- Accuracy–calibration relationship: Calibration error and classification error are correlated across a sufficiently large range of distribution shifts.Figure 11 examines this relationship across model families, variants, and datasets.
- Accuracy–calibration relationship: All model families show a strong positive correlation between calibration and classification error, with consistent family differences reflecting intrinsic calibration properties.
B.3 Contribution of Accuracy and Calibration to Decision Cost
Selective prediction makes decision cost depend on both misclassification and abstention costs, so accuracy and calibration can be compared by their effect on total cost. Across model-family, pretraining, and cross-architecture comparisons, higher accuracy usually yields lower cost than better calibration alone.
- Selective prediction accepts or rejects each model prediction based on confidence, incurring either misclassification or abstention cost.Total cost combines these costs at a specified cost ratio and abstention rate.
- For most practical cost settings, the higher-accuracy model is preferred over the better-calibrated model within model families.In the ViT family, the larger model has 0.076 lower classification error.
- For R101x3, the longer-trained model has classification error 0.176 versus 0.232, while the shorter-trained model has ECE 0.019 versus 0.028.Despite the ECE advantage of the shorter-trained model, the longer-trained model reaches lower total cost.
- For ViT-B/32 versus ResNeXt-WSL 32d, the latter has 0.03 lower classification error while ViT has 0.03 lower ECE, yet better accuracy usually gives lower cost.This comparison directly contrasts accuracy and calibration advantages across architectures.
C Sampling Bias for ℓ2-ECE
The paper derives sampling bias for squared ECE by modeling confidence and correctness within fixed buckets. Under the stated conditions, increasing accuracy reduces the estimator’s bias for models above 50% top-1 accuracy.
- The analysis expands Equation 5 to derive the bias of a squared ECE estimator using per-bucket sample means.The squared loss is chosen for tractability, with fixed buckets containing n_i points.
- Within bucket B_i, α_i denotes accuracy, γ_i expected confidence, δ_i the confidence difference between correct and wrong predictions, and sample means estimate these quantities.The random variables C and A represent model confidence and the corresponding correctness indicator.
- The variance of confidence minus correctness decomposes into the separate variances of C and A minus twice their covariance.The covariance is further decomposed using the binary nature of A.
- For models with at least 50% top-1 accuracy, increasing accuracy reduces squared-ECE sampling bias when there are enough bins for δ_i < 1/2.The derivative is negative under α_i > 1/2 and δ_i < 1/2.
D Model Confidence
Model confidence is separated from intrinsic calibration by measuring and normalizing systematic over- or underconfidence. Temperature scaling reveals consistent calibration trends, while label smoothing primarily shifts confidence rather than improving intrinsic calibration across shifts.
- Temperature scaling quantifies confidence bias by multiplying logits so that model confidence is optimal for a given dataset.Factors above 1 indicate overconfidence before scaling, whereas factors below 1 indicate underconfidence.
- Most models are slightly overconfident in-distribution and become more overconfident as data moves farther from the training distribution.EfficientNet-NoisyStudent is an exception because it is underconfident in-distribution.
- Temperature scaling removes confidence-bias differences and reveals consistently higher calibration error under distribution shift, including for EfficientNet-NoisyStudent.It also exposes consistent differences between model families and within-family in-distribution trends.
- Label smoothing may improve calibration for a specific distribution shift by creating underconfidence, but it does not generally improve intrinsic calibration across shifts and datasets.The paper therefore suggests training without label smoothing and recalibrating post hoc with temperature scaling.
- After temperature scaling, EfficientNet-B4 trained without label smoothing has the lowest ECE across all IMAGENET-C severities.Before scaling, the best calibration varies with label-smoothing amount and corruption severity; label smoothing mainly biases confidence downward.
- Jointly considering ECE and classification error resolves apparent ranking inconsistencies across ECE variants by identifying Pareto-optimal models.Different variants can change model ranks, but the joint accuracy-calibration comparison remains informative.
F Alternative Calibration Metrics
The paper checks whether calibration conclusions depend on ECE’s particular estimator and supplements scalar metrics with reliability diagrams. Alternative metrics and visualizations provide robustness checks across datasets, models, and confidence ranges.
- NLL and Brier score are reported as alternative calibration metrics to test whether findings depend on Expected Calibration Error.Results cover IMAGENET, IMAGENETV2, IMAGENET-R, IMAGENET-A, and IMAGENET-C.
- Reliability diagrams show calibration across the full confidence range rather than reducing it to a single scalar value.The diagrams are provided for all models on IMAGENET before and after temperature scaling.
- Across ECE variants, absolute values and some model rankings can change, but relative model relationships remain robust in the reported comparisons.The paper emphasizes joint consideration of ECE and classification error when interpreting variant-dependent rankings.