Out-of-Distribution Detection Scores: MSP, Energy, Mahalanobis, kNN, and ViM
A previous post introduced out-of-distribution (OOD) detection: a score for strangeness, plus a threshold, added to a classifier that otherwise cannot say "I don't know". This post covers the scores themselves. Five names recur in the OOD literature: MSP, Energy, ViM, Mahalanobis, and kNN. All five read the same frozen model and answer the same question — does this input belong here? — and they often disagree. What follows is what each one measures, where it reads from, and where it fails.
First, the shared setup
Every score in this post is post-hoc : it reads a model that is already trained and frozen, and it needs no unfamiliar examples to work. One input is fed in, the model runs as normal, and the score is computed from what the model already produced — its features, its logits, or its probabilities.
That is why these five are the standard toolkit.…