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

Principled Detection of Out-of-Distribution Examples in Neural Networks

Shiyu Liang, Yixuan Li, R. Srikant

Abstract

Modern deep neural networks are often overconfident when presented with out-of-distribution (OOD) data, posing risks in safety-critical deployments. We present ODIN (Out-of-DIstribution detector for Neural networks), a simple yet effective method that utilizes temperature scaling and input preprocessing to distinguish between in-distribution and OOD examples. ODIN requires no retraining and can be applied to any pre-trained model.

Introduction

Deep learning models frequently assign high confidence scores to images that do not belong to any of the training classes. This "silent failure" is a significant barrier to the deployment of AI in autonomous driving or medical diagnosis. Previous solutions often involved complex retraining or architectural changes. ODIN provides a "plug-and-play" alternative that works with existing state-of-the-art networks by widening the confidence gap between familiar and unfamiliar data.

Methodology

ODIN relies on two primary post-processing techniques applied during inference:

  1. Temperature Scaling ($T$): By dividing the raw scores (logits) by a temperature constant $T$ before the softmax layer, the probability distribution is "softened." Mathematically, at high temperatures, this scaling helps separate the maximum softmax scores of in-distribution data from OOD data.
  2. Input Preprocessing ($\epsilon$): Small, calculated perturbations are added to the input image to increase the model's maximum softmax score. Because the network is optimized for in-distribution data, these perturbations boost confidence for familiar images significantly more than for OOD images.
The effect of input perturbation magnitude $\epsilon$ on the False Positive Rate (FPR) at 95% True Positive Rate (TPR) across various OOD datasets.

The final detector determines if an image is OOD by checking if its maximum softmax score, after these adjustments, falls below a specific threshold.

Experimental Setup

The method was evaluated using CIFAR-10 and CIFAR-100 as in-distribution datasets. OOD testing sets included TinyImageNet, LSUN, and synthetic noise (Gaussian and Uniform). Hyperparameters $T$ and $\epsilon$ were tuned using the iSUN dataset as a validation set to ensure robustness against unseen OOD types.

Key Results and Insights

ODIN significantly outperformed existing baselines across various architectures, including DenseNet and Wide ResNet.

ROC curves comparing the baseline method to ODIN, demonstrating a significant reduction in False Positive Rate.
  • Error Reduction: On a DenseNet trained on CIFAR-10, ODIN reduced the False Positive Rate (FPR) from 34.7% to 4.3% at a 95% true positive rate.
  • Separability: The core insight is that model gradients are "steeper" for recognized data. Thus, a small push in the direction of the gradient benefits in-distribution images disproportionately.
  • Transferability: Parameters tuned on one OOD dataset (iSUN) generalized well to others (LSUN), indicating that the method does not require prior knowledge of the specific OOD data it will encounter.

Conclusion

ODIN offers a principled and efficient way to enhance the reliability of neural networks. While it requires a small validation set for hyperparameter tuning and introduces a minor computational overhead due to gradient calculations during inference, its architecture-agnostic nature and substantial performance gains make it a powerful tool for safer AI deployment.

Summary updated

BibTeX
@inproceedings{liang2018principled,
  author = {Shiyu Liang and Yixuan Li and R. Srikant},
  title = {{Principled Detection of Out-of-Distribution Examples in Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2018},
  url = {https://openreview.net/forum?id=H1VGkIxRZ},
}
Figure