How Does Unlabeled Data Provably Help Out-of-Distribution Detection?

Xuefeng Du, Zhen Fang, Ilias Diakonikolas, Yixuan Li

Introduction

Out-of-distribution (OOD) detection is a critical requirement for the safe deployment of machine learning models. Standard neural networks often exhibit high confidence on inputs from categories not seen during training, leading to potential failures in real-world environments. Recent research has explored leveraging unlabeled "wild" data—a mixture of in-distribution (ID) and OOD samples—to improve detection. However, the lack of a formal theoretical understanding of how this noisy data helps has hindered progress. This paper introduces SAL (Separate And Learn), a framework that provides the first rigorous theoretical and empirical justification for using unlabeled wild data to enhance OOD detection.

Methodology: The Separate And Learn (SAL) Framework

The SAL framework operates in two distinct stages: filtering and classification.

1. Filtering (Separate)

The goal of the filtering stage is to identify candidate outliers from the unlabeled wild data. SAL first trains a standard classifier on clean labeled ID data. It then computes the gradients of the loss for every sample in the unlabeled wild data. The core innovation lies in performing Singular Value Decomposition (SVD) on the resulting gradient matrix. The authors demonstrate that OOD samples tend to have gradients that project strongly onto the top singular vector, whereas ID samples do not. Samples with a high projection magnitude (filtering score) are flagged as candidate outliers.

Visualization of SAL filtering on synthetic data scenarios.

2. Classification (Learn)

In the second stage, a binary OOD classifier is trained using the original labeled ID data as the "positive" class and the filtered candidate outliers from the first stage as the "negative" class. This approach effectively transforms a noisy unsupervised problem into a supervised learning task on a cleaner subset of the data.

Theoretical Foundation

The effectiveness of SAL is backed by rigorous theoretical guarantees. The authors prove Provable Separability (Theorem 1), showing that the filtering step can identify outliers with very low error rates if the ID and OOD distributions are sufficiently distinct. Furthermore, they provide a Generalization Guarantee (Theorem 3), which upper-bounds the risk of the final OOD classifier by the risk of an optimal classifier. This formally justifies why learning from noisy, filtered data is a sound strategy.

Experimental Results

SAL was evaluated on standard OOD detection benchmarks using CIFAR-10 and CIFAR-100 as ID data, and various natural image datasets (e.g., SVHN, Textures, Places365) as OOD data.

Comparison of SAL against state-of-the-art OOD detection methods.

As shown in the results, SAL establishes a new state-of-the-art. On the CIFAR-100 benchmark, SAL reduced the FPR95 (False Positive Rate at 95% True Positive Rate) from 7.80% (the previous best baseline, WOODS) to a staggering 1.88%. Compared to methods that only use ID data (like KNN+), SAL improved performance by over 44% in specific scenarios. The method also proved robust across different network architectures and varying levels of OOD contamination in the wild data.

Conclusion

The SAL framework demonstrates that unlabeled wild data, despite being a noisy mixture, contains valuable signals for OOD detection. By leveraging gradient-based SVD for filtering, SAL provides a provably effective way to separate outliers and learn a robust detection boundary. This work bridges the gap between empirical success and theoretical understanding in the use of unlabeled data for model safety.

Summary updated

BibTeX
@inproceedings{du2024how,
  author = {Xuefeng Du and Zhen Fang and Ilias Diakonikolas and Yixuan Li},
  title = {{How Does Unlabeled Data Provably Help Out-of-Distribution Detection?}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=jlEjB8MVGa},
}
Figure