Mahalanobis++: Improving OOD Detection via Feature Normalization

Maximilian Mueller, Matthias Hein
5/23/2025
cs.LGcs.CV

No confident code implementation found for this paper.

Abstract

Detecting out-of-distribution (OOD) examples is an important task for deploying reliable machine learning models in safety-critial applications. While post-hoc methods based on the Mahalanobis distance applied to pre-logit features are among the most effective for ImageNet-scale OOD detection, their performance varies significantly across models. We connect this inconsistency to strong variations in feature norms, indicating severe violations of the Gaussian assumption underlying the Mahalanobis distance estimation. We show that simple $\ell_2$-normalization of the features mitigates this problem effectively, aligning better with the premise of normally distributed data with shared covariance matrix. Extensive experiments on 44 models across diverse architectures and pretraining schemes show that $\ell_2$-normalization improves the conventional Mahalanobis distance-based approaches significantly and consistently, and outperforms other recently proposed OOD detection methods.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{mueller2025mahalanobis,
  title  = {Mahalanobis++: Improving OOD Detection via Feature Normalization},
  author = {Maximilian Mueller and Matthias Hein},
  year   = {2025},
  eprint = {2505.18032},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.18032v1},
  journal = {ICML 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.18032.svg)](https://codeofpaper.com/paper/2505.18032)

Discussion