← Back to list

A Textbook-Level Guide to Out-of-Distribution (OOD) Detection Methods

Preliminary

AIPaperReading · 2026-06-15 04:09 · 0 claps · 4.4 min read
#out-of-distribution #anomaly-detection #machine-learning-safety #ai-safety #model-robustness
Open on Medium ↗
Wiki topics: SAF · Safety & Alignment ML · Machine Learning EDU · Education & Learning

A Textbook-Level Guide to Out-of-Distribution (OOD) Detection Methods

Preliminary

In artificial intelligence applications such as autonomous driving, medical imaging, and industrial quality inspection, out-of-distribution (OOD) detection is a crucial problem. It ensures the safe deployment and usage of models in practical applications.

  • Out-of-distribution (OOD) samples refer to unknown data that come from a different distribution than the model’s training set. For example, if the training set contains only “dogs” and “cats”, but the test data includes “fish”.
  • Near OOD refers to “near-distribution” anomalies that are semantically similar to the training set with closely intertwined features, making them extremely difficult to distinguish (e.g., cats vs. leopards).
  • Far OOD refers to “far-distribution” anomalies that have no correlation with the training set and are highly distinguishable (e.g., cats vs. cardboard boxes).

Based on the latest survey papers and benchmark studies, the following are widely recognized, classic methods in the field of Out-of-Distribution (OOD) detection, categorized by their technical approach and timeline.

📚 Foundational Methods (2017–2018)

1. MSP (Maximum Softmax Probability) — ICLR 2017 [1]

  • Core Idea: Directly uses the maximum softmax probability output by the classifier as the confidence score.
  • Contribution: The first systematic baseline for defining the OOD detection problem. It remains the default baseline for comparing all new methods.
  • Code: Implemented by default in almost all OOD libraries.
  • Limitations: Limited effectiveness on “near-distribution” OOD detection; highly susceptible to overconfident predictions.

2. ODIN (Out-of-DIstribution detector for Neural networks) — ICLR 2018 [2]

  • Core Idea: Builds upon MSP by introducing Temperature Scaling and Input Perturbation to amplify the gap between ID (In-Distribution) and OOD scores.
  • Contribution: The first post-hoc method to significantly outperform MSP without requiring model retraining.
  • Best For: Image classification tasks; shows significant effectiveness on “near-distribution” OOD.

3. Mahalanobis Distance — NeurIPS 2018 [3]

  • Core Idea: Calculates the Mahalanobis distance of a sample to the Gaussian distribution of each class in the feature space, taking the minimum as the anomaly score.
  • Contribution: The first to introduce feature-space statistical information into OOD detection; became the cornerstone for distance-based methods.
  • Advantage: Superior performance compared to logits-based methods for “far-distribution” OOD.

🔥 Breakthrough Progress (2019–2021)

4. Energy-based OOD (Energy Score) — NeurIPS 2020 [4]

  • Core Idea: Converts logits into an energy score: (E(x) = -\log(\sum \exp(\text{logit}_i))). Lower energy indicates a higher likelihood of being ID.
  • Contribution:
  • Theoretically unifies logits-based and distance-based methods.
  • Achieves SOTA performance without extra training.
  • Supports fine-tuning for further performance gains.
  • Impact: One of the most cited OOD methods; widely used as a robust baseline.

5. Outlier Exposure (OE) — ICLR 2019 [5]

  • Core Idea: Incorporates auxiliary OOD data during training to explicitly optimize the model’s ability to identify anomalous samples.
  • Contribution: The first systematic study on using “extra data” to improve OOD detection, inspiring a vast amount of subsequent work.
  • Limitation: Requires collecting or constructing appropriate auxiliary OOD data.

6. ReAct (Rectified Activation) — ICLR 2021 [6]

  • Core Idea: Truncates high-response feature activations during inference to reduce overconfident predictions.
  • Contribution: A simple and effective post-hoc technique that, when combined with methods like Energy, yields further improvements.

🎯 Unified Frameworks (2022–2024)

7. ViM (Virtual-logit Matching) — CVPR 2022 [7]

  • Core Idea: Constructs a “virtual OOD class” logit, mapping feature distance information back into the logit space.
  • Contribution: Unifies energy scores with feature distance; shows excellent performance on large-scale benchmarks like ImageNet.
  • Status: Currently one of the strongest post-hoc methods and a mandatory baseline for new papers.

8. OpenOOD Benchmark — NeurIPS 2022 [8]

  • Contribution: The first open-source benchmark framework with unified implementations for 30+ OOD/AD/OSR methods.
  • Value: Solves the problem of inconsistent evaluation standards in the field, promoting fair comparisons and reproducible research.
  • Repo: https://github.com/Jingkang50/OpenOOD

📊 Quick Comparison Table

(Stars indicate relative effectiveness based on OpenOOD benchmarks.)

🔍 How to choose a method?

  1. Low Resource/Deployment: Start with MSP [1] or Energy [4].
  2. Performance Priority: Use ViM [7] or Mahalanobis [3].
  3. Training Available: Consider Outlier Exposure (OE) [5].
  4. Complex/Mixed-Distribution OOD: Prioritize ViM [7].
  5. Benchmark/Research: Always use OpenOOD [8] to ensure fair comparisons.

📖 Recommended Reading Path

  • Beginner: MSP baseline paper [1] + OpenOOD tutorials [8].
  • Intermediate: Energy OOD [4] + Mahalanobis [3].
  • Advanced: ViM [7] + task-oriented survey [9].
  • Practice: Run the OpenOOD [8] repository to reproduce comparisons.

💡 Key Insight

According to the latest surveys [9], the current trend is shifting from “single-score” methods toward “multi-signal fusion” and “Large Model adaptation.” However, the classic methods listed above remain the essential theoretical foundation for understanding and designing new OOD detection architectures.

References

  1. Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations, 2017.
  2. Shiyu Liang, Yixuan Li, and R Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. In International Conference on Learning Representations, 2018.
  3. Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. Advances in Neural Information Processing Systems, 31, 2018.
  4. Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. Advances in Neural Information Processing Systems, 33:21464–21475, 2020.
  5. Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations, 2019.
  6. Yiyou Sun, Chuan Guo, and Yixuan Li. ReAct: Out-ofdistribution detection with rectified activations. Advances in Neural Information Processing Systems, 34, 2021.
  7. Haoqi Wang, Zhizhong Li, Litong Feng, and Wayne Zhang. Vim: Out-of-distribution with virtual-logit matching. In CVPR, 2022.
  8. Jingkang Yang, Pengyun Wang, Dejian Zou, Zitang Zhou, Kunyuan Ding, WenXuan Peng, Haoqi Wang, Guangyao Chen, Bo Li, Yiyou Sun, Xuefeng Du, Kaiyang Zhou, Wayne Zhang, Dan Hendrycks, Yixuan Li, and Ziwei Liu. OpenOOD: Benchmarking generalized out-of-distribution detection. In Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2022.
  9. Lu, Shuo, Yingsheng Wang, Lijun Sheng, Lingxiao He, Aihua Zheng, and Jian Liang. Out-of-distribution detection: A task-oriented survey of recent advances. ACM Computing Surveys 58, no. 2 (2025): 1–39.

메타데이터
post_id
615d3daa3fef
slug
a-textbook-level-guide-to-out-of-distribution-ood-detection-methods-615d3daa3fef
url
https://medium.com/@aipaper/a-textbook-level-guide-to-out-of-distribution-ood-detection-methods-615d3daa3fef
canonical_url
https://medium.com/@aipaper/a-textbook-level-guide-to-out-of-distribution-ood-detection-methods-615d3daa3fef
author_url
https://medium.com/@aipaper
status
ok
fetched_at
2026-07-11 03:21:30