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

On the Importance of Regularisation and Auxiliary Information in OOD Detection

John Mitros, Brian Mac NameeICONIP 2021

Abstract

Deep neural networks often exhibit overconfidence when encountering Out-of-Distribution (OOD) data, posing significant risks in safety-critical domains. This paper proposes two novel objective functions, ContReg (Contrastive Regularised) and ContRank (Contrastive Ranking), to improve OOD detection. By utilizing cosine similarity between in-distribution and out-of-distribution samples and incorporating explicit regularization, these methods encourage models to behave more like density estimators rather than simple max-margin classifiers. Experimental results on synthetic and real-world datasets demonstrate significant improvements over state-of-the-art baselines, achieving near-perfect detection on controlled benchmarks.

Introduction: The Overconfidence Problem

A fundamental flaw in modern deep learning is the tendency of models to assign high-probability labels to inputs they have never seen before. In standard training using Cross-Entropy loss, models often find "shortcuts" or spurious correlations that suffice for the training set but fail to provide meaningful uncertainty estimates for unfamiliar data. For applications like autonomous driving or medical diagnostics, "knowing what you don't know" is as critical as classification accuracy.

Proposed Methods: ContReg and ContRank

To address this, the authors move beyond simple classification toward objectives that explicitly model the relationship between known and unknown data:

  1. ContReg (Contrastive Regularised Objective): This objective augments standard Cross-Entropy with a "cosine-regularization" term. It minimizes classification error on In-Distribution (ID) data while maximizing the angular distance (dissimilarity) between the model's internal representations of ID and OOD samples.
  2. ContRank (Contrastive Ranking Objective): A metric-learning approach that employs a ranking objective based on cosine similarity. It is further supported by $\ell_1$ regularization on OOD data to push predictions toward a uniform distribution and $\ell_2$ regularization on ID data to preserve accuracy.

The research also highlights the role of explicit regularization, such as Monte-Carlo Dropout. The authors argue that such techniques act as "boundary thickeners," transforming a model from a simple max-margin classifier into a more robust density estimator.

Experimental Setup and Datasets

The effectiveness of these objectives was tested across a variety of environments:

  • Synthetic Benchmarks: A controlled 2D setup where the ID data consists of 3 Gaussian clusters, and the OOD data consists of 4 distinct Gaussian clusters.
  • Real-World Image Datasets: Standard benchmarks including CIFAR-10, CIFAR-100, SVHN, FashionMNIST, and LSUN.
  • Robustness Testing: The CIFAR10-C and CIFAR100-C datasets were used to evaluate performance under common environmental corruptions like noise and blur.
Synthetic data setup for ID training and OOD testing.

Key Insights

  • Density vs. Margin: While max-margin predictors are effective for separation, they fail at OOD detection because they do not account for the "empty" feature space. The proposed objectives shift the model's behavior toward density estimation.
  • Regularization Synergy: Explicit regularization is not merely a tool to prevent overfitting; it is essential for smoothing decision boundaries, which significantly boosts OOD detection performance.
  • The "Superset" Trap: Auxiliary OOD information is most beneficial when ID data is distinct. If ID features are a superset of OOD features (e.g., training on CIFAR-100 and testing on CIFAR-10), the utility of auxiliary data may diminish.
  • Near-OOD Challenges: The choice of objective function is most critical for "near-OOD" detection, where unknown samples closely resemble the training distribution.

Results and Performance

The proposed methods achieved state-of-the-art results:

  • Synthetic Accuracy: On the Gaussian dataset, ContReg and ContRank reached near-perfect OOD detection (99.99% AUC-ROC), compared to ~62% for standard Cross-Entropy.
  • Image Classification: On CIFAR-10 vs. SVHN, ContReg achieved a 99.18% AUC-ROC, outperforming MSP, ODIN, and EnergyOOD.
  • Environmental Robustness: ContReg significantly reduced the Mean Corruption Error (mCE) on CIFAR10-C to 119.98, compared to 161.14 for standard models.

Conclusion

While explicit regularization is beneficial, the authors caution that excessive regularization can eventually degrade performance. Future research is needed to identify the optimal "inflection point" between label noise and true OOD samples, and to formally define the necessary conditions for robust OOD detection.

Summary updated

BibTeX
@inproceedings{mitros2021importance,
  author = {John Mitros and Brian Mac Namee},
  title = {{On the Importance of Regularisation and Auxiliary Information in OOD Detection}},
  booktitle = {ICONIP},
  year = {2021},
  url = {https://openreview.net/forum?id=pm7t1nWOke},
}
Figure