NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Detecting Out-of-Distribution through the Lens of Neural Collapse

Litian Liu, Yao Qin · Submission to ICLR 2025 · Withdrawn

TL;DR

This paper introduces NCI (Neural Collapse Inspired), a highly efficient post-hoc method for Out-of-Distribution (OOD) detection. By leveraging the "Neural Collapse" phenomenon—where class features converge to fixed geometric structures—the authors create a detector that uses model weight vectors as "free" prototypes. This approach achieves state-of-the-art versatility across diverse datasets with the speed of a simple softmax check.

The OOD Detection Dilemma

Deep learning models are notoriously overconfident when encountering data they weren't trained on (OOD samples). While many OOD detection methods exist, they usually fall into two traps:

  1. The Generalization Gap: A method that works perfectly on small datasets like CIFAR-10 often performs poorly on large-scale benchmarks like ImageNet.
  2. Computational Bottlenecks: Feature-space methods (like k-Nearest Neighbors) require storing and searching through the entire training set at inference time, making them far too slow for real-time applications.

The authors seek a "Goldilocks" solution: a detector that is mathematically grounded, generalizes across different model architectures (from ResNets to Vision Transformers), and adds negligible latency.

Methods: Leveraging Neural Collapse

The authors turn to Neural Collapse (NC), a phenomenon observed in the final layers of overtrained neural networks. NC suggests that In-Distribution (ID) features eventually "collapse" into class means that form a symmetric geometric structure called a Simplex Equiangular Tight Frame (ETF).

Their proposed method, NCI, consists of two main components:

  • pScore (Proximity Score): Instead of comparing a test sample to every training point, NCI compares it to the last-layer weight vectors of the model. After centering the features by the global mean, ID samples tend to align closely with their predicted class's weight vector. Geometrically, this creates "hyper-cones" in the feature space where ID data resides.
  • Feature Norm Filtering: The authors observe that ID features are typically pushed further from the origin than OOD features to satisfy the ETF structure. They add an L1-norm term to the score to filter out OOD samples that might align with a weight vector but sit too close to the origin.
Conceptual overview of NCI, showing feature clustering around weight vectors, score distributions, and the geometric filtering strategy.

The final detection score is a simple linear combination: $Score = pScore + \alpha \cdot \|h\|_1$.

Key Insights and Ideas

  • Weights as Prototypes: The most elegant insight is that we don't need to store training features. The model's own weights already encode the "ideal" location for each class due to Neural Collapse.
  • The Power of Centering: The authors show that ID clustering only becomes obvious and useful for OOD detection after subtracting the global feature mean ($\mu_G$). Without centering, the geometric structure is masked.
  • Early Emergence: While "perfect" Neural Collapse only happens at the very end of training (zero loss), the trend toward collapse emerges very early. This means NCI works on standard "off-the-shelf" models without requiring special training regimes.
  • Simplicity Wins: NCI has $O(P)$ complexity (where $P$ is the feature dimension), making it orders of magnitude faster than KNN-based methods while maintaining higher accuracy across different scales.

Key Results

The researchers evaluated NCI using the rigorous OpenOOD benchmark across diverse datasets (CIFAR-10/100, ImageNet-1K) and architectures (ResNet, DenseNet, ViT, Swin).

  • Versatility: NCI is the only algorithm in their study to consistently rank in the top three across both CIFAR and ImageNet benchmarks. Most competitors excel at one but fail at the other.
  • Performance: On ImageNet, NCI achieved an average AUROC of 89.51%, outperforming strong baselines like ViM, KNN, and ASH.
  • Latency: NCI's inference time is nearly identical to the basic Maximum Softmax Probability (MSP) detector.
Performance comparison showing NCI achieves state-of-the-art AUROC with latency comparable to the simple MSP baseline.

Furthermore, ablation studies proved that the L1-norm filter is crucial for large-scale datasets like ImageNet, where ID clustering is naturally weaker than in smaller datasets like CIFAR.

Limitations and Future Work

While highly effective, NCI relies on a filtering strength parameter ($\alpha$). Although the authors provide a strategy to select this using a small validation set of Gaussian noise, it still introduces a tuning step. Additionally, the method's effectiveness is intrinsically tied to how well a specific model architecture exhibits Neural Collapse properties. Future directions could explore applying this geometric perspective to other areas, such as model calibration or defending against adversarial attacks.

Summary updated

BibTeX
@misc{liu2023detecting,
  author = {Litian Liu and Yao Qin},
  title = {{Detecting Out-of-Distribution through the Lens of Neural Collapse}},
  year = {2023},
  eprint = {2311.01479},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.01479},
}
Figure