Deep neural networks are notoriously overconfident. A standard ImageNet classifier will happily tell you a blurry photo of static is a "goldfish" with 99% certainty. This lack of calibration is a major hurdle for safety-critical applications like autonomous driving or medical diagnosis.
While researchers have found that training models on "Out-of-Distribution" (OOD) data—essentially teaching them what "none of the above" looks like—helps, they usually pick these OOD sets arbitrarily. The paper "Toward Metrics for Differentiating Out-of-Distribution Sets" by Abbasi et al. finally asks the logical next question: Which OOD data is actually the best for training?
TL;DR
Not all OOD training sets are equally effective at teaching a model to spot anomalies. This paper introduces three computationally efficient metrics to identify "protective" OOD sets that surround in-distribution data in feature space, significantly improving a model's ability to reject unseen anomalies and adversarial attacks.
What Problem Does This Paper Address?
Vanilla Convolutional Neural Networks (CNNs) struggle to differentiate between data they were trained on (in-distribution) and data they've never seen (OOD). A common fix is "Outlier Exposure," where you train the model using a secondary OOD dataset to help it learn a rejection boundary.
However, there are thousands of potential OOD datasets. Should you use TinyImageNet to protect a CIFAR-10 model? Or just Gaussian noise? Previously, researchers chose these sets based on intuition. This paper addresses the lack of a principled, quantitative way to select the OOD set that will yield the best generalization to unseen future anomalies.
Methods
The authors propose that a "proper" OOD set should "protect" the sub-manifolds of the in-distribution data. To measure this without the massive cost of training hundreds of trial models, they propose three metrics calculated using the feature space (the penultimate layer) of a standard, pre-trained CNN:
- Softmax-based Entropy (SE): This measures how evenly OOD samples are misclassified across all in-distribution classes. High entropy suggests the OOD data is "spread out" around the entire dataset, rather than just clumping near one or two classes.
- Coverage Ratio (CR): Using k-nearest neighbors, this calculates what percentage of in-distribution samples have OOD samples nearby in feature space. A high CR means the "fence" around your data has fewer holes.
- Coverage Distance (CD): This is the average distance between OOD samples and their closest in-distribution neighbors. Smaller distances imply a tighter, more precise boundary.
The authors advocate for selecting OOD sets with high SE and high CR. This intuition is visualized in Figure 1, showing how a "protective" set better defines the boundaries of the data.
Datasets
The researchers tested their metrics across multiple domains:
- Image Tasks: In-distribution sets were CIFAR-10 and SVHN. OOD candidates included LSUN, ISUN, CIFAR-100, TinyImageNet, and synthetic Gaussian noise.
- Audio Tasks: The in-distribution set was Urban-Sound. OOD candidates included TuT, Google Command, and ECS.
- Adversarial: They also evaluated performance against black-box Fast Gradient Sign (FGS) adversarial examples.
Key Insights and Ideas
- The "Fence" Analogy: You can think of OOD training data as building a fence around your yard. SE ensures the fence goes all the way around (no open sides), and CR ensures there aren't large gaps between the posts.
- Gaussian Noise is a Weak Protector: Interestingly, the metrics reveal why simple synthetic noise often fails. While it might have decent coverage, it often has low entropy—it "collapses" in feature space, leaving large parts of the in-distribution manifold unprotected.
- Adversarial Synergy: A model trained on a "most protective" OOD set (identified by these metrics) becomes naturally better at detecting adversarial attacks. As the noise magnitude in an attack increases, the adversarial samples move into the "protected" regions and are automatically rejected.
Key Results
The quantitative gains from picking the "right" OOD set are massive.
- SVHN Task: An Augmented-CNN (A-CNN) trained on the "most protective" set (CIFAR-100) achieved a 99.88% average rejection rate on unseen OOD sets. In contrast, training on the "least protective" set (ISUN) resulted in a dismal 47.23% rejection rate.
- CIFAR-10 Task: Using the most protective set (CIFAR-100) led to an OOD rejection rate of 85.10%, compared to just 21.41%* when using the least protective set (SVHN).
- Efficiency: These rankings remained consistent regardless of the number of neighbors ($k$) used in the calculations, proving the metrics are robust and easy to deploy.
Limitations and Future Work
- Dependence on Pre-training: The metrics rely on the feature space of a vanilla CNN. If the initial model is poorly trained, the metrics might misidentify the manifolds.
- Naturalistic Bias: The study focuses largely on existing "natural" datasets. While it touches on Gaussian noise, it doesn't explore using these metrics to guide the generation of synthetic OOD data (e.g., via GANs).
- Future Direction: The authors suggest these metrics could eventually be used as loss functions themselves, essentially training a generator to create the "perfect" protective OOD set for any given task.
Summary updated