Abstract
Out-of-Distribution (OoD) detection is critical for the safe deployment of Deep Neural Networks (DNNs). This paper identifies a significant source of instability in current OoD detection methods: the high variance of performance across independent training runs, even when In-Distribution (InD) accuracy remains consistent. By examining the loss landscape, the authors reveal that different local optima (modes) behave diversely on OoD data. They propose a "mode ensemble" strategy—aggregating intermediate features and logits from independent models—to achieve superior and more stable OoD detection across various architectures, including Vision Transformers.
Introduction
Deep Neural Networks are often overconfident when processing data outside their training distribution. While numerous post-hoc OoD detection methods have been developed, they are typically evaluated on a single model. This paper uncovers a critical flaw in this evaluation paradigm: OoD detection performance is highly sensitive to random initialization. Different training seeds lead to different "modes" in the non-convex loss landscape. While these modes perform similarly on InD data, their ability to distinguish "unknown" data varies drastically, making many reported state-of-the-art results a matter of "luck."
The Loss Landscape Perspective
The authors utilize visualization techniques to compare how different modes perceive InD versus OoD data. While independent modes occupy similar low-loss valleys for training and test InD data, they are situated in significantly different regions of the landscape when exposed to OoD data. This divergence explains why a single model's OoD performance is an unreliable metric.
Methods: Mode Ensembling
To mitigate this instability, the paper proposes ensembling the internal representations of $N$ independently trained models. Unlike traditional ensembles that average final predictions, this approach focuses on:
- Intermediate Outputs: Ensembling logits or features before the final decision.
- Independent Modes: Using models started from different random seeds rather than checkpoints from the same trajectory.
- Detector Integration: The strategy was successfully applied to seven state-of-the-art detectors, including Energy, Mahalanobis, and RankFeat.
Key Insights
The core discovery is the massive performance gap between models that appear identical on standard benchmarks. For instance, using the RankFeat method on DenseNet121, the False Positive Rate (FPR) can fluctuate between roughly 46% and 85% depending solely on the random seed, despite InD accuracy remaining stable.
The study also found that feature-based detectors benefit more from ensembling than logit-based ones, suggesting that internal representations across modes are more diverse and informative than the final class probabilities. Furthermore, ensembling a few small models often outperforms a single large model of equivalent total parameter count.
Key Results
- Performance Gains: On ImageNet-1K, ensembling four modes for the RankFeat detector reduced the average FPR95 from 63.06% to 40.92%.
- Stability: Mode ensembling consistently reduced the standard deviation of detection metrics, providing a more trustworthy measure of a model's safety.
- Broad Applicability: The benefits were observed across multiple architectures (ResNets, DenseNet, ViT) and various OoD benchmarks (SVHN, iNaturalist, etc.).
Conclusion
This work highlights the necessity of considering the loss landscape when evaluating OoD detection. Mode ensembling provides a robust, though computationally more intensive, path toward reliable anomaly detection. Future research may focus on finding diverse modes more efficiently without the need for multiple full training cycles.
Summary updated