TLDR: A comprehensive study evaluates various in-training and post-hoc calibration methods for image classification under real-world dataset shifts. Key findings include the effectiveness of semantic out-of-distribution data for single models’ post-hoc calibration (e.g., TS+OOD, EBS), the benefit of entropy regularisation and label smoothing for raw probabilities, a trade-off between in-distribution and shifted calibration, and the superior performance of foundation models. For ensembles, calibrating members *before* ensembling is best, and OOD exposure is detrimental. The paper provides practical guidelines for robust calibration.
In the rapidly evolving world of artificial intelligence, particularly in image classification, ensuring that models not only make accurate predictions but also reliably estimate their own uncertainty is paramount. This concept, known as model calibration, is crucial for building trustworthy machine learning systems, especially when these systems encounter data that differs from what they were originally trained on – a common real-world challenge known as dataset shift.
A recent comprehensive study, titled “Where are we with calibration under dataset shift in image classification?”, delves deep into the current state of calibration techniques under these challenging real-world conditions. Conducted by Mélanie Roschewitz, Raghav Mehta, Fabio De Sousa Ribeiro, and Ben Glocker from Imperial College London, this research provides invaluable insights and practical guidelines for practitioners aiming to achieve robust calibration in their image classification models. You can find the full paper here: Research Paper.
The researchers undertook an extensive evaluation, comparing various post-hoc calibration methods (applied after model training) and their interactions with in-training calibration strategies (techniques used during the training process). They tested these across a wide array of natural dataset shifts and eight different image classification tasks spanning several domains, from medical imaging to satellite images. This broad scope allowed them to derive robust conclusions that go beyond the limitations of previous studies that often relied on synthetic shifts.
Key Discoveries for Single Models
For individual models, one of the most striking findings was the significant benefit of exposing post-hoc calibrators to a small amount of “semantic out-of-distribution” (OOD) data. This OOD data is unrelated to the specific classification task but helps the calibrator become more robust to shifts. Simple methods like Temperature Scaling (TS) combined with OOD exposure (TS+OOD) performed remarkably well, often on par with more complex, specially designed methods like Energy-Based Calibration (EBS). This suggests that the exposure to diverse, unrelated data during calibration is a powerful factor, regardless of the specific post-hoc method used.
Another important insight for single models concerns in-training calibration. The study found that simultaneously applying entropy regularisation (a technique to penalize overly confident predictions) and label smoothing (a method to soften labels and discourage extreme confidence) during training yielded the best-calibrated raw probabilities when faced with dataset shifts. Interestingly, if post-hoc calibration is going to be used, these in-training methods become less critical, indicating a flexible approach to calibration strategy.
However, the research also highlighted a crucial trade-off: improving a model’s calibration under dataset shifts often comes at the cost of worsening its calibration on in-distribution data (data similar to the training set). This means practitioners must carefully consider their priorities – whether to optimize for robustness under shift or for peak performance on familiar data.
The study also confirmed the growing importance of foundation models. Classifiers fine-tuned from large pre-trained foundation models consistently demonstrated better calibration under dataset shifts compared to models trained from scratch, regardless of the calibration strategy employed. This underscores the power of transfer learning from these powerful base models.
Insights for Model Ensembles
Ensembling, where multiple models are combined to make a single prediction, is a well-known technique for improving robustness. This study further solidified its value, showing that ensembles generally achieve superior calibration under shifts compared to individual models. The best overall calibration results were obtained by combining ensembling with fine-tuning from foundation models.
A critical finding for ensembles was the timing of calibration. The researchers discovered that applying post-hoc calibration to individual ensemble members *before* combining their predictions was more effective for calibration under shifts than calibrating the ensemble’s final predictions. Furthermore, contrary to the findings for single models, exposing ensemble members to OOD data during calibration actually *deteriorated* their shifted calibration performance. This suggests that for ensembles, simpler, standard calibration methods without OOD exposure are preferable for individual members.
Also Read:
- Unpacking Transferability: A Key to Effective AI Learning
- SemiOVS: A Breakthrough in Semantic Segmentation Using Out-of-Distribution Data
Practical Guidelines for Robust Calibration
Based on these extensive findings, the study offers clear, actionable guidelines:
For optimal results, it’s best to start with classifiers fine-tuned from foundation models rather than training from scratch.
If you plan to use post-hoc calibration (adjusting confidence scores after training), specific in-training calibration methods become less essential. However, if the goal is to achieve good calibration without any post-hoc adjustments, training your model with both entropy regularisation and label smoothing is highly effective for handling shifted data.
For single models (not part of an ensemble), robust strategies for improving calibration under shifts include using Temperature Scaling with exposure to unrelated out-of-distribution data (TS+OOD) or Energy-Based Calibration (EBS). It’s important to remember that this often involves a trade-off, where improving shifted calibration might slightly worsen in-distribution calibration.
When working with model ensembles, the most robust calibration results are achieved by applying standard post-hoc calibration methods, such as Temperature Scaling, to individual ensemble members *before* combining their predictions. Interestingly, for ensembles, exposing individual members to out-of-distribution data during their calibration process was found to be detrimental, so it should be avoided in this scenario.
This research provides a valuable roadmap for developing more reliable and trustworthy image classification systems that can confidently operate in dynamic, real-world environments.


