# Why is the Mahalanobis Distance Effective for Anomaly Detection?

arXiv: https://arxiv.org/abs/2003.00402 · HTML: https://mlsanity.com/paper/2003.00402/

## Key facts

- Cited by 28 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 1 Mar 2020.

## Built on by (most cited first, 28 of 28)

- [A Simple Fix to Mahalanobis Distance for Improving Near-OOD Detection](https://mlsanity.com/paper/2106.09022/) (2021)
- [Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detection](https://mlsanity.com/paper/2101.03778/) (2021)
- [Robust AI-Generated Text Detection by Restricted Embeddings](https://mlsanity.com/paper/2410.08113/) (2024)
- [On the use of Mahalanobis distance for out-of-distribution detection with neural networks for medical imaging](https://mlsanity.com/paper/2309.01488/) (2023)
- [Towards Textual Out-of-Domain Detection without In-Domain Labels](https://mlsanity.com/paper/2203.11396/) (2022)
- [Out of Distribution Detection and Adversarial Attacks on Deep Neural Networks for Robust Medical Image Analysis](https://mlsanity.com/paper/2107.04882/) (2021)
- [Transfer Learning Gaussian Anomaly Detection by Fine-tuning Representations](https://mlsanity.com/paper/2108.04116/) (2021)
- [Gaussian Latent Representations for Uncertainty Estimation using Mahalanobis Distance in Deep Classifiers](https://mlsanity.com/paper/2305.13849/) (2023)
- [Concurrent Misclassification and Out-of-Distribution Detection for Semantic Segmentation via Energy-Based Normalizing Flow](https://mlsanity.com/paper/2305.09610/) (2023)
- [A Distance-based Anomaly Detection Framework for Deep Reinforcement Learning](https://mlsanity.com/paper/2109.09889/) (2021)
- [Data Invariants to Understand Unsupervised Out-of-Distribution Detection](https://mlsanity.com/paper/2111.13362/) (2021)
- [Robust Vector Quantized-Variational Autoencoder](https://mlsanity.com/paper/2202.01987/) (2022)
- [Robustness to Spurious Correlations Improves Semantic Out-of-Distribution Detection](https://mlsanity.com/paper/2302.04132/) (2023)
- [Data augmentation and pre-trained networks for extremely low data regimes unsupervised visual inspection](https://mlsanity.com/paper/2106.01277/) (2021)
- [Unity is strength: Improving the Detection of Adversarial Examples with Ensemble Approaches](https://mlsanity.com/paper/2111.12631/) (2021)
- [Understanding the limitations of self-supervised learning for tabular anomaly detection](https://mlsanity.com/paper/2309.08374/) (2023)
- [Toward Stronger Textual Attack Detectors](https://mlsanity.com/paper/2310.14001/) (2023)
- [Enhancing Out-of-Distribution Detection with Extended Logit Normalization](https://mlsanity.com/paper/2504.11434/) (2025)
- [A Benchmark for Out of Distribution Detection in Point Cloud 3D Semantic Segmentation](https://mlsanity.com/paper/2211.06241/) (2022)
- [Deciphering the Definition of Adversarial Robustness for post-hoc OOD Detectors](https://mlsanity.com/paper/2406.15104/) (2024)
- [Decomposing Representations for Deterministic Uncertainty Estimation](https://mlsanity.com/paper/2112.00856/) (2021)
- [A Novel Explainable Out-of-Distribution Detection Approach for Spiking Neural Networks](https://mlsanity.com/paper/2210.00894/) (2022)
- [Graceful Degradation and Related Fields](https://mlsanity.com/paper/2106.11119/) (2021)
- [When Neural Networks Using Different Sensors Create Similar Features](https://mlsanity.com/paper/2111.02732/) (2021)
- [VI-OOD: A Unified Representation Learning Framework for Textual Out-of-distribution Detection](https://mlsanity.com/paper/2404.06217/) (2024)
- [Dimensionality-induced information loss of outliers in deep neural networks](https://mlsanity.com/paper/2410.21656/) (2024)
- [VOLTA: The Surprising Ineffectiveness of Auxiliary Losses for Calibrated Deep Learning](https://mlsanity.com/paper/2604.08639/) (2026)
- [Modality-Aware Out-of-Distribution Detection for Multi-Modal Action Recognition](https://mlsanity.com/paper/2606.24404/) (2026)

## Abstract (arXiv)

The Mahalanobis distance-based confidence score, a recently proposed anomaly detection method for pre-trained neural classifiers, achieves state-of-the-art performance on both out-of-distribution (OoD) and adversarial examples detection. This work analyzes why this method exhibits such strong performance in practical settings while imposing an implausible assumption; namely, that class conditional distributions of pre-trained features have tied covariance. Although the Mahalanobis distance-based method is claimed to be motivated by classification prediction confidence, we find that its superior performance stems from information not useful for classification. This suggests that the reason the Mahalanobis confidence score works so well is mistaken, and makes use of different information from ODIN, another popular OoD detection method based on prediction confidence. This perspective motivates us to combine these two methods, and the combined detector exhibits improved performance and robustness. These findings provide insight into the behavior of neural classifiers in response to anomalous inputs.
