NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DOS: Diverse Outlier Sampling for Out-of-Distribution Detection

Wenyu Jiang, Hao Cheng, MingCai Chen, Chongjun Wang, Hongxin Wei

TL;DR

Researchers have introduced DOS (Diverse Outlier Sampling), a novel training strategy that significantly improves how neural networks identify "unknown" inputs. By ensuring that the outliers used during training are both semantically diverse and difficult for the model to classify, DOS creates a much tighter decision boundary. This approach reduces Out-of-Distribution (OOD) error rates (FPR95) by up to 25.79% on standard benchmarks.

The Problem: Overconfidence and Sampling Bias

Deep learning models are notoriously overconfident. When a model trained to recognize dog breeds is presented with a picture of a toaster, it shouldn't just guess "Golden Retriever"—it should ideally flag the image as an unknown. This capability is known as Out-of-Distribution (OOD) detection.

A common technique to improve OOD detection is Outlier Exposure (OE). During training, the model is exposed to a massive "junk" dataset of random images and penalized for being confident about them. However, because these auxiliary datasets are enormous, training on all of them is computationally prohibitive; we must sample a tiny fraction.

The challenge lies in how we sample these outliers:

  • Random sampling is inefficient because many outliers are "too easy" (e.g., a solid blue image) and don't force the model to learn meaningful boundaries.
  • Greedy sampling strategies attempt to fix this by picking the "hardest" outliers—the ones the model is most confused by (highest predictive uncertainty).

However, greedy sampling suffers from a fatal flaw: sampling bias. It often gets stuck in a rut, picking many similar-looking hard examples from just one or two categories. This leaves huge blind spots in the model’s worldview, as it over-optimizes for specific types of outliers while ignoring others.

Sampling bias in greedy strategies compared to uniform sampling.

The Solution: Diverse Outlier Sampling (DOS)

To combat this bias, the authors propose Diverse Outlier Sampling (DOS). Instead of exclusively picking the hardest outliers overall, DOS forces the model to look at a variety of different "types" of hard outliers in every training step.

The DOS algorithm operates in three main steps during each training iteration:

  1. Feature Normalization: It extracts internal "features" from a candidate pool of outliers using the model. Crucially, it normalizes these features so that subsequent clustering is based on semantic content (what the image is) rather than scale (how confident the model is).
  2. Clustering: It uses the K-means algorithm to group these normalized outlier features into $k$ distinct clusters based on their semantic similarity.
  3. Active Selection: From each cluster, it selects the single most "informative" (hardest/most uncertain) outlier.

By training on one hard representative from many different clusters, the model learns a "globally compact" decision boundary that wraps tightly around the known In-Distribution (ID) data from all angles.

Comparison of decision boundaries formed by different sampling strategies. DOS (Diverse & Uncertain) creates a globally compact boundary.

Key Insights and Results

The researchers evaluated DOS across several standard benchmarks, using In-Distribution datasets like CIFAR-100 and ImageNet-10, paired with auxiliary outlier datasets like TI-300K and ImageNet-RC. The OOD test sets included diverse data such as SVHN, Textures, Places365, and iNaturalist.

  • Diversity > Pure Hardness: Selecting outliers solely based on uncertainty leads to a skewed decision boundary. DOS proves that enforcing semantic diversity among the sampled outliers is critical for comprehensive OOD detection.
  • Massive Error Reduction: The performance gains are substantial. On CIFAR-100 using TI-300K as outliers, DOS reduced the average FPR95 (the rate of OOD samples misclassified as ID when 95% of ID samples are correctly identified) from 50.15% down to 24.36%. This is a massive 25.79% absolute improvement over previous state-of-the-art greedy methods.
  • Robustness to Scale: DOS remains highly effective even when the auxiliary outlier dataset is restricted. Using only 25% of the available outliers, DOS still outperformed baseline methods that had access to 100% of the data.
  • Large Model Compatibility: DOS is not limited to small CNNs; it can also boost the OOD detection capabilities of massive pre-trained foundation models like CLIP.

Limitations and Future Work

While highly effective, DOS has a few limitations:

  • Computational Overhead: Performing K-means clustering in every training iteration introduces extra compute per step, though the authors note that faster overall convergence helps offset this cost.
  • Tuning the "k" Factor: By default, the number of clusters ($k$) is set to the batch size. Exploring more sophisticated, dynamic ways to determine the optimal number of outlier clusters could further improve the method.
  • Dependency on Auxiliary Data: Like all Outlier Exposure methods, DOS still requires access to a large, unlabeled surrogate dataset during training, which may not be readily available in highly specialized or niche domains.

Summary updated

BibTeX
@inproceedings{jiang2024dos,
  author = {Wenyu Jiang and Hao Cheng and MingCai Chen and Chongjun Wang and Hongxin Wei},
  title = {{DOS: Diverse Outlier Sampling for Out-of-Distribution Detection}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=iriEqxFB4y},
}
Figure