Abstract
Out-of-distribution (OOD) detection is important for machine learning models deployed in the wild. Recent methods use auxiliary outlier data to regularize the model for improved OOD detection. However, these approaches make a strong distributional assumption that the auxiliary outlier data is completely separable from the in-distribution (ID) data. In this paper, we propose a novel framework that leverages wild mixture data, which naturally consists of both ID and OOD samples. Such wild data is abundant and arises freely upon deploying a machine learning classifier in their natural habitats. Our key idea is to formulate a constrained optimization problem and to show how to tractably solve it. Our learning objective maximizes the OOD detection rate, subject to constraints on the classification error of ID data and on the OOD error rate of ID examples. We extensively evaluate our approach on common OOD detection tasks and demonstrate superior performance.
Introduction: The Challenge of the Wild
Machine learning models often exhibit overconfidence when encountering inputs outside their training distribution. A classifier trained on vehicles might confidently label a tree as a "truck." Traditional solutions like Outlier Exposure (OE) attempt to mitigate this by training on auxiliary outlier datasets. However, OE faces two significant hurdles: the "mismatch gap," where offline outliers don't reflect real-world deployment data, and the high cost of manually curating clean, non-overlapping auxiliary sets.
The WOODS (Wild OOD detection sans-Supervision) framework addresses these issues by asking: Can we learn to detect OOD samples using the unlabeled mixture of data a model naturally encounters in its "natural habitat"?
Methodology
WOODS treats OOD detection as a constrained optimization problem. Instead of a simple penalty term, the objective is to minimize the error of classifying samples from a wild mixture ($P_{wild}$) as ID, subject to two key constraints:
- False Positive Rate Constraint: The rate of incorrectly flagging ID data as OOD must stay below a predefined threshold ($\alpha$).
- Accuracy Preservation: The model's original classification accuracy on ID data must be maintained within a tolerance ($\tau$).
To solve this, the authors employ the Augmented Lagrangian Method (ALM), adapting it for stochastic gradient descent in neural networks. The model uses Energy-based scores derived from logits to distinguish between ID and OOD samples, utilizing a smooth sigmoid loss for differentiability.
Experimental Setup
The framework was evaluated using CIFAR-10 and CIFAR-100 as ID datasets. OOD test sets included SVHN, Textures, and Places365. To simulate "wild" environments, training sets were created by mixing ID data with samples from the 300K Random Images dataset at various mixture ratios ($\pi$).
Key Results and Insights
WOODS consistently outperforms both standard ID-only baselines and supervised Outlier Exposure methods.
- Superior Detection: On CIFAR-100, WOODS achieved a 48.10% improvement in FPR95 over standard models. Remarkably, it outperformed supervised OE by 7.36%, despite OE having access to "cleaner" labeled outliers.
- Mathematical Foundation: The paper provides a theoretical justification showing that optimizing against a mixture of ID and OOD data is equivalent to optimizing against pure OOD data, provided the constraints are handled correctly. This justifies the use of "polluted" wild data.
- Robustness to Sparsity: The framework remains effective even when OOD samples are rare (e.g., $\pi = 0.05$), which is crucial for real-world scenarios where anomalies are infrequent.
- Constraint Satisfaction: As shown in the training plots, the ALM-based approach successfully drives the ID constraints below the required tolerance, ensuring the detector doesn't sacrifice core classification performance.
Conclusion and Future Directions
WOODS demonstrates that the "messy" data encountered during deployment is a valuable resource rather than a hindrance. By moving away from manually curated auxiliary sets toward constrained optimization in the wild, OOD detection becomes more robust and scalable. Future work will explore non-stationary environments where the OOD distribution shifts over time and extending the framework to domains like NLP and medical imaging.
Summary updated