Introduction
Deep Neural Networks (DNNs) are increasingly deployed in safety-critical applications, yet they are notoriously miscalibrated, often exhibiting high confidence in incorrect predictions. While post-processing techniques like Temperature Scaling (TS) effectively mitigate this on in-distribution data, they typically require a labeled validation set. This requirement becomes a significant bottleneck under domain shift, where the deployment environment differs from the training environment (e.g., varying lighting or sensor noise). In such cases, obtaining new labels for calibration is often impractical. This paper introduces Unsupervised Temperature Scaling (UTS), a method that calibrates model uncertainty using only unlabeled test data.
Methodology: Unsupervised Temperature Scaling
UTS builds upon the standard Temperature Scaling framework, which adjusts the "softness" of the softmax output using a single scalar parameter $T$. The key innovation of UTS is the elimination of the need for ground-truth labels by leveraging the expected class distribution of the task.
The algorithm proceeds in three main steps:
- Weight Estimation: It estimates the probability of each sample belonging to a specific class based on the model's uncalibrated predictions.
- Optimization: It minimizes a Weighted Negative Log Likelihood (WNLL) loss to find the optimal temperature $T$ that aligns the model's aggregate predictions with the known prior class distribution.
- Calibration: The final softmax outputs are scaled by the optimized temperature.
Because UTS only optimizes a single parameter and requires no labels, it is computationally efficient ($O(1)$ complexity) and highly adaptable to "off-the-shelf" models where original training data may no longer be accessible.
Experimental Evaluation
The authors evaluated UTS across several standard datasets (MNIST, CIFAR-10/100, SVHN, Birds) and subjected them to various domain shifts, including Gaussian noise, rotations, and weather effects. UTS was compared against several baselines, including standard TS (calibrated on clean data) and "TS-Target" (a supervised upper bound calibrated on labeled shifted data).
Key Results and Discussion
The experiments demonstrate that UTS is uniquely robust to domain shift. As shown in the performance metrics for CIFAR-10 and MNIST under various corruptions, UTS consistently tracks the performance of the supervised TS-Target baseline, significantly outperforming standard TS which fails to adapt to the new domain.
Robustness to Label Noise
Unlike supervised methods, UTS is inherently immune to labeling errors in the calibration set. This makes it a more reliable choice in real-world scenarios where manual labeling might be prone to mistakes or noise.
Stability and Efficiency
UTS is remarkably stable, converging to an optimal solution with as few as 500 unlabeled samples. Furthermore, it preserves the original accuracy of the model, as it only modifies the confidence scores without altering the predicted class rankings.
Conclusion and Future Work
Unsupervised Temperature Scaling provides a practical solution for maintaining reliable uncertainty estimates in the face of domain shift. Its primary limitation is the reliance on the Covariate Shift assumption—that class proportions remain stable even as input distributions change. Future research may explore relaxing this assumption or integrating UTS with Bayesian frameworks for enhanced out-of-distribution detection.
Summary updated