Introduction
As machine learning models transition from controlled environments to real-world applications—such as autonomous driving or medical diagnostics—their ability to identify "unknown" data becomes critical. A robust model should not only classify known categories but also flag Out-of-Distribution (OOD) samples that it was not trained to handle.
Most existing OOD detection techniques rely on the model's final outputs, such as softmax probabilities or features extracted after a Global Average Pooling (GAP) layer. However, this paper argues that the GAP layer acts as an information bottleneck, "smearing" spatial information across channels and discarding vital clues that distinguish familiar patterns from random noise. To address this, the authors propose the Neural Activation Prior (NAP), a plug-and-play method that leverages internal activation distributions before they are pooled.
The Neural Activation Prior (NAP)
The core intuition behind NAP is the Signal-to-Noise Ratio (SNR) of neuron activations. When a model encounters an In-Distribution (ID) sample, specific neurons within a channel fire with high intensity, creating a sharp, localized "signal." Conversely, OOD samples tend to trigger weak, unpredictable, and diffuse activations across the entire channel, resembling "noise."
Scoring Mechanism
To quantify this observation, the NAP score is calculated using the ratio of the maximum activation to the mean activation within each channel of the penultimate layer:
- Max Activation: The peak response value in a channel.
- Mean Activation: The average response value across the same channel.
- The Ratio: The ratio of Max to Mean is squared and averaged across all channels to produce the final NAP score.
Because NAP utilizes spatial information before pooling, it is inherently orthogonal to methods that use information after pooling (like Energy-based scores). This allows NAP to be combined with existing methods using a weighted geometric mean, requiring no retraining or external OOD supervision.
Experimental Results
The researchers evaluated NAP across standard benchmarks including CIFAR-10, CIFAR-100, and ImageNet-1k, testing against OOD datasets like SVHN, Textures, and iSUN. The method proved architecture-agnostic, showing consistent gains across ResNet, DenseNet, MobileNet, and even Vision Transformers (where NAP is applied to attention weights).
Key Performance Gains
- CIFAR-10: Combining NAP with Energy scores reduced the False Positive Rate (FPR95) from 15.05% to 7.79%.
- CIFAR-100: The FPR95 dropped significantly from 41.40% to 25.71%.
- ImageNet: On large-scale benchmarks, NAP reduced the FPR95 from 35.66% to 29.86%.
Discussion and Insights
The success of NAP highlights that global pooling, while beneficial for classification, is a bottleneck for OOD detection. By looking "under the hood" at raw feature maps, we find a much clearer separation between ID and OOD data. This separation is most pronounced in deeper layers, where neurons respond to complex semantic patterns unique to the training data rather than generic low-level features like edges or colors.
While highly effective, the authors note that NAP's performance depends on the model's quality; a well-trained model is necessary to develop the distinct semantic filters that NAP exploits. Future work may explore multi-layer fusion to further refine the detection of "near-OOD" samples that share significant semantic overlap with the training set.
Summary updated