Source-linked AI summary
Improving model calibration with accuracy versus uncertainty optimization
Ranganath Krishnan, Omesh Tickoo
TL;DR
Reliable uncertainty calibration is difficult because uncertainty lacks ground truth, yet it matters for deciding when model predictions should be trusted. The paper introduces AvUC-based training and post-hoc calibration, illustrating them with SVI and evaluating them under distributional shift. The proposed methods achieve better calibration than existing state-of-the-art methods in the reported image-classification evaluations.
Problem
Deep neural networks need uncertainty estimates that track prediction accuracy, but uncertainty calibration lacks ground-truth targets and predictions can be unreliable under distributional shift.
Method
The paper introduces differentiable AvUC loss for training and extends temperature scaling with AvUC for post-hoc calibration, illustrated using mean-field SVI.
Results
The proposed SVI-AvUC method provides better model calibration than existing state-of-the-art methods under distributional shift, while SVI-AvUTS provides post-hoc uncertainty calibration.
Takeaways & Limitations
Accounting for predictive uncertainty during training can improve model calibration for probabilistic deep neural networks under distributional shift.
Takeaways & Limitations
The threshold-free area-under-AvU variant produces similar results but is more computationally intensive during training.
Abstract
from arXiv · showhide
Obtaining reliable and accurate quantification of uncertainty estimates from deep neural networks is important in safety-critical applications. A well-calibrated model should be accurate when it is certain about its prediction and indicate high uncertainty when it is likely to be inaccurate. Uncertainty calibration is a challenging problem as there is no ground truth available for uncertainty estimates. We propose an optimization method that leverages the relationship between accuracy and uncertainty as an anchor for uncertainty calibration. We introduce a differentiable accuracy versus uncertainty calibration (AvUC) loss function that allows a model to learn to provide well-calibrated uncertainties, in addition to improved accuracy. We also demonstrate the same methodology can be extended to post-hoc uncertainty calibration on pretrained models. We illustrate our approach with mean-field stochastic variational inference and compare with state-of-the-art methods. Extensive experiments demonstrate our approach yields better model calibration than existing methods on large-scale image classification tasks under distributional shift.
1 Introduction
Uncertainty estimates are important for reliable decisions, but deep neural networks remain poorly calibrated, especially when data distributions shift. The paper introduces AvUC-based optimization to align confidence and uncertainty with prediction accuracy and evaluates it under distributional shift.
- Reliable uncertainty estimates help safety-critical users decide when to trust model predictions.
- Distributional shift and out-of-distribution inputs can make DNN predictions unreliable, motivating uncertainty calibration for deployment.
- Uncertainty calibration is difficult because ground-truth uncertainty estimates are unavailable.
- The paper introduces AvUC loss to make models confident on accurate predictions and more uncertain when predictions are likely inaccurate.
- The study evaluates training-time and post-hoc calibration methods against high-performing baselines under image distributional shifts.
2 Background
The background frames calibration as matching predictive probabilities and uncertainty to model correctness. It distinguishes uncertainty types, reviews calibration approaches and metrics, and motivates accuracy-versus-uncertainty evaluation.
- DNN calibration seeks predictive probabilities that accurately represent the true likelihood of outcomes.
- Existing calibration methods include post-processing, data augmentation, and probabilistic Bayesian or non-Bayesian formulations.
- Aleatoric uncertainty reflects observation noise, whereas epistemic uncertainty reflects limited knowledge of model parameters.
- The paper uses predictive entropy to represent combined aleatoric and epistemic uncertainty in probabilistic models.
- ECE measures confidence calibration error, while UCE measures the expected difference between model error and predictive uncertainty.
3 Obtaining well-calibrated uncertainties with AvUC loss
AvUC uses the accuracy–uncertainty relationship as a training signal, approximating categorical accuracy–uncertainty counts differentiably and adding the resulting loss to existing objectives. The framework supports SVI training and post-hoc temperature scaling, with a threshold estimated from early training data.
- 3.1 Differentiable accuracy versus uncertainty calibration (AvUC) loss: AvU rewards predictions that are accurate when certain and uncertain when inaccurate.AvU is defined from counts of accurate-certain, accurate-uncertain, inaccurate-certain, and inaccurate-uncertain samples.
- 3.1 Differentiable accuracy versus uncertainty calibration (AvUC) loss: AvUC is the negative log of AvU and is minimized to maximize the accuracy-versus-uncertainty utility.The loss is zero only under perfect calibration, when accurate predictions are certain and inaccurate predictions are uncertain.
- 3.1 Differentiable accuracy versus uncertainty calibration (AvUC) loss: Differentiable proxy functions approximate the four AvU sample counts using predicted-class probability and scaled predictive uncertainty.The proxies use tanh(ui) to scale uncertainty between 0 and 1 and can be optimized with standard gradient descent.
- 3.1 Differentiable accuracy versus uncertainty calibration (AvUC) loss: AvUC can be added to ELBO or cross-entropy without changing the underlying Bayesian or non-Bayesian learning principles.It is intended to improve uncertainty calibration while maintaining or improving prediction accuracy.
- 3.2 Loss-calibrated approximate inference with AvUC loss: SVI-AvUC incorporates AvUC as a utility-dependent penalty in loss-calibrated ELBO optimization.The relative contribution of AvUC is controlled by the hyperparameter β.
- 3.2 Loss-calibrated approximate inference with AvUC loss: The uncertainty threshold is estimated from average predictive uncertainty for accurate and inaccurate training predictions during initial epochs.Initial epochs use ELBO alone to learn the threshold required by AvUC.
- 3.2 Loss-calibrated approximate inference with AvUC loss: The threshold-free area-under-AvU variant has similar results but requires more computation during training.
- 3.2 Loss-calibrated approximate inference with AvUC loss: Post-hoc AvUTS extends temperature scaling by selecting a positive logit-rescaling temperature that minimizes AvUC on held-out validation data.
4 Experiments and Results
Experiments evaluate AvUC-based methods for calibration, confidence and uncertainty quality, and distributional-shift detection on ImageNet and CIFAR10. SVI-AvUC generally outperforms competing methods under dataset shift, while AvUTS improves post-hoc calibration over SVI.
- Model calibration evaluation: SVI-AvUC provides lower ECE and UCE than competing methods at increased dataset-shift levels.Figure 1 summarizes 80 shifted-data variations across ImageNet and CIFAR10.
- Model calibration evaluation: AvUC and AvUTS reduce ECE and UCE when applied to the vanilla baseline on CIFAR10.The comparison uses mean errors across 16 different data-shift types.
- Model confidence and uncertainty evaluation: SVI-AvUC is more accurate at higher confidence and lower uncertainty, while becoming more uncertain on inaccurate predictions under distributional shift.The evaluation uses accuracy-versus-confidence and p(accurate | certain) and p(uncertain | inaccurate) measures.
- Distributional shift detection: SVI-AvUC provides better separation between in-distribution and shifted predictive-uncertainty densities, quantified using Wasserstein distance.Figure 3 uses ImageNet test data and Gaussian-blur shift of intensity 5.
- Distributional shift detection: SVI-AvUC outperforms other methods across all reported distributional-shift detection metrics.Table 2 evaluates ImageNet and CIFAR10 Gaussian-blur shifts and SVHN out-of-distribution data.
5 Conclusion
The paper introduces AvUC-based optimization for improving uncertainty calibration in Bayesian and non-Bayesian deep neural networks. Experiments show improved calibration and distributional-shift detection, including through post-hoc AvUTS calibration.
- 5 Conclusion: The paper introduces AvUC and AvUTS optimization methods for improving uncertainty calibration in deep neural networks.The methods are illustrated with stochastic variational inference and vanilla non-Bayesian models.
- 5 Conclusion: Accounting for uncertainty estimation during training improves model calibration, with SVI-AvUC outperforming existing methods under distributional shift.The conclusion also reports that AvUTS improves uncertainty calibration over the baseline.
- 5 Conclusion: The proposed methods improve distributional-shift detection while preserving their use across Bayesian and non-Bayesian models.The methods are demonstrated on stochastic variational inference and vanilla models.
Broader Impact
Calibrated uncertainty is presented as a foundation for explainable and trustworthy AI in safety-critical applications. The paper also connects it to fairness measurement, anomaly detection, active learning, and distributional-shift detection.
- Calibrated uncertainty can support explainable and trustworthy deep-learning systems in safety-critical applications.
- The paper connects calibrated uncertainty with fairness measurement and explainable behavior in AI models.
- Calibrated uncertainty may support multimodal fusion, anomaly detection, and active learning.
- Using calibrated uncertainty for distributional-shift detection is described as an enabler for self-learning systems.
A Dataset shift
The dataset-shift evaluation uses image corruptions applied at test time. It covers 16 corruption types across five intensity levels, producing 80 shifted-data variants.
- The evaluation applies 16 different image corruption types during test time to represent dataset shift.
- The dataset-shift design combines 16 corruption types with five intensity levels, resulting in 80 variants.
- Gaussian blur is evaluated at five levels of shift intensity, numbered 1–5.
B Experimental details and Parameters
The experiments use ResNet architectures on CIFAR10 and ImageNet, compare Bayesian and non-Bayesian baselines, and evaluate in-distribution, shifted, and OOD data. SVI uses approximate posterior inference, while SVI-AvUC adds AvUC loss to ELBO training.
- CIFAR10 and ImageNet experiments use ResNet-20 and ResNet-50 architectures, respectively.
- The comparison includes Vanilla, temperature scaling, Ensemble, Dropout, LL Dropout, and LL SVI baselines.
- SVI-AvUTS calibrates pretrained SVI models by minimizing AvUC loss on hold-out validation data.
- Evaluation uses 10k CIFAR10 test images and 80 shifted variants, while SVHN serves as OOD data for CIFAR10-trained models.
- SVI-AvUC trains with AvUC loss in addition to ELBO loss, using β = 3 for relative weighting.
- For ImageNet, evaluation uses 50k test images and 80 shifted variants, each containing 50k images.
- SVI approximates the intractable posterior p(w|D) with a parameterized distribution qθ(w) by minimizing KL divergence, equivalently maximizing ELBO.
- Mean-field SVI models weights with fully factorized Gaussian distributions parameterized by µ and σ.
C.2 Uncertainty metrics
The paper evaluates predictive uncertainty through stochastic posterior sampling and uses calibration metrics comparing accuracy or error with confidence or uncertainty. Training monitors accuracy, AvU, ELBO, AvUC, and total loss.
- Predictive distributions are estimated from multiple stochastic forward passes using Monte Carlo samples from the weight posterior.
- Predictive entropy captures combined aleatoric and epistemic uncertainty, while deterministic models compute it directly from their predictive probabilities.
- Mutual information between the weight posterior and predictive distribution measures epistemic uncertainty.
- ECE measures the difference between model accuracy and confidence across confidence bins.
- UCE measures the difference between model error and predictive uncertainty across uncertainty bins.
- During training, AvUC loss and AvU are monitored alongside ELBO, total loss, and accuracy; AvUC loss is inversely correlated with AvU.
D.2 Additional results for model calibration evaluation
Additional evaluations compare calibration metrics across ImageNet and CIFAR10 under distributional shift, finding SVI-AvUC comparatively robust as shift intensity increases.
- Calibration metrics: ECE, UCE, NLL and Brier score are compared across 16 shift types at five intensity levels on ImageNet and CIFAR10.The ImageNet and CIFAR10 comparisons are shown in Figures F5 and F6.
- Robustness to shift: SVI-AvUC has comparatively lower Spearman ρ values between calibration errors and shift intensity than other methods.Lower ρ indicates calibration errors are less correlated with increasing data shift.
- Confidence and uncertainty: Figure F7 evaluates confidence against accuracy, confidence-frequency counts, and model uncertainty under ImageNet defocus and glass blur at intensity 3.The evaluation examines whether confidence and uncertainty track accuracy degradation under shift.
- Confidence and uncertainty: Figure F8 evaluates CIFAR model accuracy and uncertainty behavior across speckle and shot noise at intensity 3 using varying normalized uncertainty thresholds.The plots compare methods as the uncertainty threshold ranges over t ∈[0, 1].
- AvU evaluation: SVI-AvUC and SVI-AvUTS yield higher AvU AUC across increasing ImageNet shift intensities, with results summarized over 16 shift types.AvU AUC is computed across various uncertainty thresholds.
D.5 Addition results for distributional shift detection
The paper evaluates predictive uncertainty for detecting out-of-distribution data and dataset shift, reporting strong separation and distribution-shift detection for SVI-AvUC in several settings.
- Out-of-distribution detection: SVI-AvUC shows the best separation between CIFAR10 in-distribution and SVHN out-of-distribution predictive entropy densities.The separation is quantified using Wasserstein distance in Table T5.
- Dataset-shift detection: SVI-AvUC shows the best separation between ImageNet in-distribution and defocus-blurred shifted predictive uncertainty densities.The comparison uses a ResNet-50 trained on clean ImageNet, with Wasserstein distance reported in Table T6.
- Dataset-shift detection: SVI-AvUC performs best for detecting most of the 16 ImageNet shift types at intensity 5, while Ensemble performs best on some shift types.Each shift type contains 50k shifted test images, and results are reported as percentages.
- Post-hoc calibration: AvUTS is evaluated as post-hoc calibration for vanilla DNNs using AvUC loss and softmax entropy as the uncertainty measure.It is compared with conventional temperature scaling, which optimizes negative log-likelihood.
- Post-hoc calibration: Figure F12 compares AvUTS, conventional temperature scaling and Vanilla baselines using ECE and UCE across ImageNet shift intensities.Lower calibration errors are preferred as shift intensity increases.
E Ablation study for β weight factor in SVI-AvUC
The β ablation examines calibration-error and accuracy trade-offs in SVI-AvUC, while a threshold-free AvU-AUC variant provides similar results to the standard methods.
- β sensitivity: Accuracy remains almost flat across β values, while ECE initially decreases and increases above β=3.The ablation uses Gaussian-blurred test data at intensity 3 on ResNet-20.
- β sensitivity: UCE initially decreases as β increases and then remains almost flat.The reported ablation evaluates ECE, UCE and test accuracy together.
- Threshold-free optimization: The threshold-free AvU-AUC optimization is compute intensive because AvU must be computed across uncertainty thresholds.Thresholds are sampled as uth = umin + (t (umax −umin)) with t ∈[0, 1].
- Threshold-free optimization: SVI-AUAvUC and SVI-AUAvUTS produce results similar to SVI-AvUC and SVI-AvUTS.The comparison is presented in Figure F14 for training and post-hoc calibration.