Abstract
There is an increasing need to determine whether inputs are out-of-distribution (OOD) for safely deploying machine learning models in the open world scenario. Typical neural classifiers are based on the closed world assumption, where the training data and the test data are drawn i.i.d. from the same distribution, and as a result, give over-confident predictions even faced with OOD inputs. For tackling this problem, previous studies either use real outliers for training or generate synthetic OOD data under strong assumptions, which are either costly or intractable to generalize. In this paper, we propose boundary aware learning (BAL), a novel framework that can learn the distribution of OOD features adaptively. The key idea of BAL is to generate OOD features from trivial to hard progressively with a generator, meanwhile, a discriminator is trained for distinguishing these synthetic OOD features and in-distribution (ID) features. Benefiting from the adversarial training scheme, the discriminator can well separate ID and OOD features, allowing more robust OOD detection. The proposed BAL achieves state-of-the-art performance on classification benchmarks, reducing up to 13.9% FPR95 compared with previous methods.
Introduction
Deep learning models are notoriously overconfident. A standard image classifier trained only on dogs and cats will likely label a picture of a car as a "dog" with near-certainty, simply because it lacks a "none of the above" option. This phenomenon, known as the Out-of-Distribution (OOD) detection problem, stems from the "closed-world assumption" inherent in typical neural network training. In safety-critical applications like autonomous driving or medical diagnosis, such overconfidence is dangerous.
Previous attempts to mitigate this issue often relied on using real outlier datasets during training—which is both costly and potentially biased—or assumed that data follows simple distributions like Gaussians. However, high-dimensional feature spaces rarely adhere to such simple models.
Boundary Aware Learning (BAL)
The authors propose Boundary Aware Learning (BAL), a framework that adaptively learns the boundaries of in-distribution (ID) data by generating its own OOD training signal. To maintain computational efficiency, BAL operates in the feature space (the penultimate layer of a pre-trained network) rather than the raw pixel space.
The BAL framework consists of three core modules:
- Representation Extraction Module (REM): This module identifies the bounds of ID features and uses uniform sampling to create "trivial" OOD features—easy outliers far from the known data clusters.
- Representation Sampling Module (RSM): Utilizing the Fast Gradient Sign Method (FGSM), this module pushes synthetic features toward the boundary of the ID manifold, creating "hard" OOD examples that are difficult to distinguish from real data.
- Representation Discrimination Module (RDM): A discriminator is trained to separate ID features from these synthetic OOD features. Two specific losses are introduced: Shuffle Loss, which forces the model to recognize feature-label mismatches, and Uniform Loss, which helps define a tight boundary around ID clusters.
Experimental Results
The authors evaluated BAL across standard computer vision benchmarks, including MNIST, CIFAR-10, and SVHN as ID datasets, and Omniglot, TinyImageNet, and LSUN as OOD datasets.
Visualizing the Decision Boundary
A key insight of the paper is the "Gaussian Myth." While many OOD methods assume features follow a multivariate Gaussian distribution, 2D and 3D projections reveal that ID features are actually sparse and densely clustered. Consequently, uniform sampling is more effective for exploring the "empty" OOD space. As shown in Figure 1, BAL successfully creates a closed decision boundary, whereas standard architectures like ResNet18 and MLPs leave vast regions of the feature space assigned to ID classes with high confidence.
Quantitative Performance
BAL achieved state-of-the-art performance, particularly in reducing the FPR95 (False Positive Rate at 95% True Positive Rate). On CIFAR-10, BAL reduced FPR95 to 5.0%, a significant improvement over the standard softmax baseline (41.1%) and vanilla GAN approaches (17.9%). Compared to the previous leading method, Generalized ODIN, BAL showed an FPR95 reduction of up to 13.9%.
The histogram comparison in Figure 2 demonstrates BAL's effectiveness. In a standard ResNet18, OOD samples often receive confidence scores near 1.0, making them indistinguishable from ID samples. BAL successfully separates these distributions, pushing OOD samples toward the lower end of the confidence spectrum.
Conclusion
Boundary Aware Learning provides a robust, efficient framework for OOD detection by leveraging adversarial training in the feature space. By generating a range of OOD features from trivial to hard, it forces the model to learn precise boundaries for in-distribution data. While the model occasionally struggles with semantically similar OOD images, its ability to reduce overconfident errors marks a significant step toward safer open-world AI deployment.
Summary updated