Detecting Out-of-Distribution Through the Lens of Neural Collapse
Litian Liu, Yao Qin
TL;DR
Out-of-distribution detection remains challenging due to generalization gaps across datasets and architectures, and real-time deployment requires low latency. The authors introduce Neural Collapse Inspired OOD Detector (NCI), which leverages two geometric cues—ID features centering toward the predicted class weight vectors and the simplex Equiangular Tight Frame expansion—together with an origin-distance filter to separate ID from OOD samples, achieving $O(P)$ complexity. By formalizing Neural Collapse (NC1–NC4) and demonstrating its practical trend in standard models, they show that these cues enable effective OOD detection across CIFAR-10/100 and ImageNet with latency comparable to MSP and with reduced generalization discrepancies. The work unifies clustering- and energy-based perspectives under a Neural Collapse lens and provides a scalable, code-releaseable detector that adapts across CNNs and vision transformers.
Abstract
Out-of-Distribution (OOD) detection is critical for safe deployment; however, existing detectors often struggle to generalize across datasets of varying scales and model architectures, and some can incur high computational costs in real-world applications. Inspired by the phenomenon of Neural Collapse, we propose a versatile and efficient OOD detection method. Specifically, we re-characterize prior observations that in-distribution (ID) samples form clusters, demonstrating that, with appropriate centering, these clusters align closely with model weight vectors. Additionally, we reveal that ID features tend to expand into a simplex Equiangular Tight Frame, explaining the common observation that ID features are situated farther from the origin than OOD features. Incorporating both insights from Neural Collapse, our OOD detector leverages feature proximity to weight vectors and complements this approach by using feature norms to effectively filter out OOD samples. Extensive experiments on off-the-shelf models demonstrate the robustness of our OOD detector across diverse scenarios, mitigating generalization discrepancies and enhancing overall performance, with inference latency comparable to that of the basic softmax-confidence detector. Code is available here: https://github.com/litianliu/NCI-OOD.
