TL;DR
This paper introduces Consistency-Guided Temperature Scaling (CTS), a novel post-hoc calibration method designed to improve the reliability of deep learning model predictions in out-of-domain (OOD) scenarios. By leveraging style and content consistency among source domain data, CTS effectively calibrates models for unseen domains without requiring target domain data, significantly outperforming existing methods.
What Problem Does This Paper Address?
Deep neural networks (DNNs) have achieved remarkable success, but their reliability in real-world, safety-critical applications is hampered by a tendency to produce over-confident predictions, especially when encountering data from domains different from those they were trained on (out-of-domain or OOD). While model accuracy is crucial, ensuring that a model's confidence in its predictions accurately reflects the likelihood of correctness is equally important for trustworthy AI. Existing calibration techniques, like Temperature Scaling (TS), work well within the training domain but struggle in OOD settings because they typically require a validation set from the target domain, which is often unavailable beforehand. This paper addresses the challenge of achieving reliable OOD calibration by developing a method that can be optimized using only source domain data.
Methods
The core of this paper is the proposed Consistency-Guided Temperature Scaling (CTS) method. CTS builds upon the standard Temperature Scaling (TS) technique, which adjusts a single temperature parameter to calibrate model confidence. However, CTS enhances TS by incorporating two novel auxiliary loss functions during temperature optimization:
- Inter-domain Style Consistency Loss ($L_{style}$): This loss encourages the model to produce similar predictions for samples that have the same content but different styles. It leverages the observation that feature statistics (mean and variance) in early CNN layers capture style information. By replacing the style of a validation sample with the style of another sample from a different domain, CTS aims to make the temperature scaling invariant to style variations.
- Intra-class Content Consistency Loss ($L_{content}$): This loss focuses on ensuring consistent predictions for samples within the same class but with varying content. It addresses the issue where samples belonging to the same class might have different visual attributes (e.g., object pose, location). By injecting noise into the content features of a sample and comparing its prediction to the original, this loss penalizes inconsistencies arising from content shifts.
The overall objective function for CTS combines the standard negative log-likelihood (NLL) loss with these two consistency losses, weighted by hyperparameters $\lambda_1$ and $\lambda_2$. The temperature is then optimized to minimize this total loss using validation data from the source domains.
Datasets
The paper evaluates CTS on four multi-domain datasets:
- PACS: Contains 7 classes across 4 domains (Photo, Art, Cartoon, Sketch).
- Office-Home: Features 65 classes across 4 domains (Art, Clipart, Product, Real).
- Digits-DG: Comprises 10 classes across 4 domains (MNIST, MNIST-M, SVHN, SYN).
- VLCS: Includes 5 classes across 4 domains (Caltech, LabelMe, Pascal, Sun).
These datasets are standard benchmarks for domain generalization and adaptation tasks, allowing for a comprehensive evaluation of OOD calibration performance.
Key Insights and Ideas
- Inconsistent Predictions Drive OOD Calibration Errors: The paper's key insight is that over-confidence in OOD settings stems from model predictions that are unstable and inconsistent when faced with variations in style and content. Samples that are highly sensitive to these variations tend to exhibit higher prediction variance, leading to poor calibration.
- Style and Content as Key Discriminators: Style and content are identified as the fundamental components that differentiate data samples across domains. By explicitly modeling and enforcing consistency in these aspects, CTS can guide temperature scaling towards domain-invariant predictions.
- Source Domain Data is Sufficient: A crucial finding is that CTS can effectively optimize the temperature for OOD calibration using only data from the source domains. This bypasses the need for target domain validation data, which is a major bottleneck for existing methods.
- Synergistic Effect of Style and Content: The paper demonstrates that combining both style and content consistency losses leads to superior performance compared to using either loss individually. This suggests that a holistic approach to consistency is more effective for robust OOD calibration.
Key Results
- Superior OOD Calibration: CTS consistently outperforms state-of-the-art post-hoc calibration baselines (including Vanilla TS, PerturbTS, CCDG, and MDTS) across all four tested datasets (PACS, Office-Home, Digits-DG, VLCS). For instance, on the PACS dataset, CTS achieves an average calibration error of 4.31, significantly lower than the next best method (CCDG-Ens at 9.06).
- Effectiveness with Large Domain Disparity: The performance gains of CTS are particularly pronounced on datasets with larger domain disparities, such as PACS and Digits-DG, validating its ability to handle challenging OOD scenarios.
- Preserves Accuracy: CTS is a post-hoc method that does not alter the model's parameters, thus preserving the original accuracy of the pre-trained model.
- Compatibility with Domain Generalization (DG) Methods: When combined with existing DG techniques like MixStyle and DSU, CTS further improves their calibration performance, highlighting its versatility.
- Ablation Studies Confirm Component Importance: Ablation studies show that while considering only style or content provides some benefit, the combination of both (CTS) yields the best results, demonstrating the effectiveness of each component and their synergy.
Limitations and Future Work
- Hyperparameter Tuning: The paper mentions that the coefficients $\lambda_1$ and $\lambda_2$ for the style and content losses can be determined based on dataset characteristics, implying that some hyperparameter tuning might be necessary for optimal performance on new datasets.
- Layer Selection: While the paper uses intermediate features from the first residual block of ResNet-18, the optimal layer for extracting style and content features might vary across different architectures and datasets.
- Future Work: The authors suggest that their method can be directly applied to various trustworthy AI systems. Further exploration into applying CTS with different network architectures and on even more diverse and challenging OOD scenarios would be valuable. The paper also mentions additional experimental results (large-scale datasets, layer ablation, train-time calibration comparison) are available in supplementary material, indicating potential avenues for future research.
Summary updated