TL;DR
Out-of-distribution (OOD) detection becomes notoriously difficult when in-distribution data is long-tailed, as models easily confuse rare "tail" classes with outliers. This paper introduces AdaptOD, a framework that balances training energy across imbalanced classes and dynamically adapts to true OOD data at test time without model retraining. By bridging the distribution gap between proxy training outliers and true test-time OOD data, AdaptOD achieves state-of-the-art detection performance.
What Problem Does This Paper Address?
Deep neural networks are famously overconfident, often misclassifying out-of-distribution (OOD) data—samples from unknown classes—as known in-distribution (ID) classes. To mitigate this, a popular approach is Outlier Exposure, where models are trained using auxiliary external datasets as "proxy" outliers.
However, a major gap remains: these proxy outliers rarely match the distribution of true OOD data encountered at test time. This distribution shift is severely exacerbated in Long-Tailed Recognition (LTR) scenarios, where a few "head" classes dominate the dataset and many "tail" classes have very few samples. Because the model becomes heavily biased toward head classes, standard energy-based OOD detectors underestimate tail-class confidence, leading them to mistake rare ID samples for OOD data, or fail to align their outlier expectations with reality.
Methods
AdaptOD tackles this problem through a two-pronged approach split between the training and inference phases:
- Dual-Normalized Energy Loss (DNE) [Training Phase]: Standard energy losses require manual tuning of sensitive margin hyperparameters and tend to suppress tail-class energy. DNE introduces Batch Energy Normalization, scaling logit outputs so that energy is balanced both class-wise (balancing total energy across classes) and sample-wise (balancing energy across individual samples). This effectively transfers energy knowledge from head to tail classes, creating a clean baseline outlier distribution without needing manually tuned margins.
- Dynamic Outlier Distribution Adaptation (DODA) [Inference/Test-Time Phase]: Instead of executing expensive online model retraining during deployment, DODA performs a lightweight Test-Time Adaptation (TTA). It uses an offline-calculated Z-score threshold to filter out likely OOD samples from the incoming test stream. It then applies a momentum update to dynamically shift the vanilla outlier distribution estimate ($P^{out}$) toward the true OOD distribution, calibrating the final OOD scores on the fly.
Datasets
The authors evaluated their approach on three popular long-tailed benchmarks:
- In-Distribution (ID) Datasets: CIFAR10-LT, CIFAR100-LT, and the large-scale ImageNet-LT (tempered with an exponential decay imbalance ratio of $\rho = 100$).
- Auxiliary Outliers (Proxy OOD): A 30k subset of TinyImages80M (for CIFAR) and ImageNet-Extra (for ImageNet-LT).
- True OOD Evaluation Datasets: The SC-OOD benchmark (consisting of CIFAR, Texture, SVHN, LSUN, Places365, and TinyImageNet) and ImageNet-1k-OOD. Synthetic noise datasets (Gaussian, Rademacher, Blobs) were also tested.
Key Insights and Ideas
- Proxy Outliers are Inherently Mismatched: The energy distribution of different OOD datasets varies wildly (as shown in Figure 1a). Assuming training outliers perfectly represent test-time OOD data leads to degraded performance.
- Calibration Over Retraining: While existing test-time adaptation methods rely on backpropagation or massive feature memory banks, DODA proves that simply calibrating the expected outlier distribution is computationally lightweight and highly effective.
- Dual Normalization Prevents Head-Class Bias: Balancing energy at both the class and sample level prevents head classes from drowning out tail classes, giving the test-time adaptation a much more accurate starting point.
Key Results
- State-of-the-Art Performance: AdaptOD consistently outperforms competitive baselines (such as EnergyOE and COCL) across all benchmarks. For example, on CIFAR100-LT, AdaptOD significantly reduces the False Positive Rate (FPR@95) while maintaining high classification accuracy on long-tailed ID data.
- Plug-and-Play Versatility: DODA can be integrated into existing OOD detectors as a plug-in component. When added to baselines like OE, EnergyOE, BERL, and COCL, it consistently boosts OOD detection metrics across the board.
- Approaching the Oracle Upper Bound: Ablation studies show that AdaptOD's unsupervised test-time adaptation closely approximates an "Oracle model" that has perfect ground-truth knowledge of the test-time OOD data.
Limitations and Future Work
Despite its strong performance, AdaptOD still requires access to an auxiliary outlier dataset during the training phase, which might not always be available in specialized domains. Additionally, because DODA relies on a stream of test data to dynamically update its outlier distribution, its performance at the very beginning of a test stream could be less optimal before it has had time to adapt. The authors suggest that future work should explore optimizing the outlier distribution entirely during training to potentially eliminate the need for online test-time updates.
Summary updated