SVD-Based Typicality Maps for Out-of-Distribution Detection in Vision Transformers
Organizations: DEI, †ARCES, University of Bologna, Italy
Abstract
We present a method for analyzing the internal representations of Vision Transformers (ViTs) exploiting the geometry of their learned parameters. Each affine layer's weight matrix is factored via Singular Value Decomposition (SVD), and activations are projected onto the leading right singular vectors to obtain compact, layer-intrinsic representations. A class-conditional density model is then fitted at each layer, producing per-class typicality scores that are stacked across depth into typicality maps: two-dimensional summaries of how class-specific evidence evolves through the network. From these maps, we derive two post-hoc scores for Out-Of-Distribution (OOD) detection: a Prototype Alignment Score (PAS), measuring agreement with class reference prototype patterns, and a Multi-Layer Soft Voting (MLSV) score, capturing cross-layer consensus without stored prototypes. On ViT-B/16 fine-tuned on CIFAR-100, the proposed scores achieve competitive detection performance without retraining or OOD exposure.
Figures & tables
| Score | SVHN | Places365 | DTD | Mean |
| MSP | 89.8 / 44.1 | 83.9 / 59.6 | 92.2 / 33.1 | 88.6 / 45.6 |
| MLS | 94.9 / 24.2 | 91.9 / 39.9 | 97.2 / 14.2 | 94.6 / 26.1 |
| Energy | 95.3 / 21.7 | 92.7 / 36.4 | 97.6 / 11.5 | 95.2 / 23.2 |
| ReAct | 95.1 / 22.4 | 93.3 / 33.3 | 97.6 / 11.2 | 95.3 / 22.3 |
| -NN | 95.9 / 22.4 | 89.6 / 49.7 | 96.7 / 16.6 | 94.1 / 29.6 |
| DMD-B | 90.5 / 67.6 | 96.9 / 14.6 | 98.6 / 0 6.6 | 95.3 / 29.6 |
OOD Detection
Out-of-distribution (OOD) detection identifies inputs unlike a model’s training data so systems can flag uncertainty, reject inputs, or adapt safely.
See all 225 papers