Prototype Fusion: A Training-Free Multi-Layer Approach to OOD Detection
Summary: arXiv:2603.23677v1 Announce Type: cross
Deep learning models are increasingly being integrated into safety-critical applications, where the need for reliable out-of-distribution (OOD) detection is paramount to ensure robustness. Traditional methods primarily depend on the penultimate-layer activations of neural networks, under the assumption that these activations encapsulate the most informative in-distribution (ID) representations. However, this work revisits that assumption, revealing that intermediate layers also encode rich and discriminative information pertinent to OOD detection.
Introduction
The challenge of OOD detection lies in accurately distinguishing between in-distribution and out-of-distribution samples, particularly in scenarios where misclassification can lead to severe consequences. In their latest research, the authors propose a novel, model-agnostic approach that aggregates internal representations across multiple layers of a neural network, thereby enhancing the capability to detect OOD samples efficiently.
Proposed Methodology
The core of the proposed method is the aggregation of features derived from successive convolutional blocks within a neural network. This multi-layer feature aggregation is instrumental in capturing class semantics that are often overlooked when relying solely on penultimate-layer representations. The method includes the following steps:
- Feature Aggregation: Internal features from multiple layers are collected and combined.
- Class-Wise Mean Embeddings: The aggregated features are processed to compute mean embeddings for each class.
- L2 Normalization: The mean embeddings undergo L2 normalization to ensure consistency and compactness.
- Prototype Formation: These normalized embeddings serve as ID prototypes that encapsulate the essential characteristics of each class.
Inference Process
During the inference phase, the model computes the cosine similarity between test features and the established prototypes. An OOD score is derived from these similarities: ID samples are expected to demonstrate a strong affinity to at least one prototype, while OOD samples will generally maintain a uniform distance from all prototypes. This methodology allows for a clear discrimination between ID and OOD instances.
Experimental Results
Extensive evaluations were conducted on state-of-the-art OOD benchmarks utilizing various architectures. The results underscore the efficacy of the proposed approach:
- Improvement in Area Under the Receiver Operating Characteristic (AUROC) by up to 4.41%.
- Reduction in False Positive Rate (FPR) by 13.58%.
These enhancements highlight the potential of multi-layer feature aggregation as a significant yet underexplored signal for OOD detection, challenging the prevailing reliance on penultimate-layer-based methods.
Conclusion
This innovative approach opens new avenues for OOD detection in deep learning models, particularly in safety-critical applications. By leveraging the rich information housed in multiple layers of neural networks, the proposed model not only boosts performance but also highlights the importance of exploring beyond traditional methodologies. For those interested in implementing this technique, the source code is publicly available at https://github.com/sgchr273/cosine-layers.git.
