Abstract
Deep Neural Networks (DNNs) often exhibit overconfidence when encountering Out-of-Distribution (OOD) data, posing significant safety risks in real-world applications. This paper introduces MaSF (Max-Simes-Fisher), a formal statistical framework that treats OOD detection as a Null Hypothesis Statistical Test (NHST). By hierarchically reducing internal network activations into a single p-value, MaSF provides a mathematically grounded detection mechanism. Experimental results demonstrate that MaSF achieves state-of-the-art accuracy while being up to 35 times faster than competing methods, all without requiring model retraining.
Introduction
While DNNs excel at closed-world classification, they are notoriously brittle when presented with "weird" data—samples from distributions not seen during training. Standard models often classify these OOD samples into known categories with high certainty. Existing detection methods typically fall into two categories: Mutators, which require expensive retraining, and Observers, which monitor internal activations of pre-trained models. While Observers are more practical, they often lack formal error guarantees and can be computationally intensive. This work bridges the gap by providing a framework that is both statistically rigorous and computationally efficient.
Methodology: The MaSF Framework
The authors frame OOD detection as an NHST where the null hypothesis ($H_0$) assumes the test sample originates from the same distribution as the training data. The core of the approach is a hierarchical reduction of internal activations into a unified p-value:
- Spatial Reduction (Max): For every channel in every layer, the maximum activation value is extracted.
- Channel Reduction (Simes Test): Activations are converted into p-values and aggregated across channels using the Simes test, which is optimized for detecting "sparse" signals where only a few features may appear abnormal.
- Layer Reduction (Fisher Test): Evidence from all layers is combined using the Fisher test, which is effective for "dense" signals that propagate through the network's depth.
By converting raw activations into p-values, the framework creates a universal language for comparison across different layers and channels, regardless of their original scales. This hierarchical approach allows the detector to capture OOD evidence distributed throughout the network, which the authors found improves accuracy by approximately 50% compared to final-layer-only detectors.
Experimental Results
The MaSF framework was evaluated using standard OOD benchmarks, including CIFAR-10, CIFAR-100, and SVHN as in-distribution data, and TinyImageNet and LSUN as OOD data. The tests were conducted on popular architectures like DenseNet and ResNet-34.
Performance and Efficiency
MaSF achieved a mean True Positive Rate (mTPR) of 96.4% at a 5% False Positive Rate, outperforming or matching state-of-the-art methods like GRAM and Deep Mahalanobis. Beyond accuracy, MaSF is significantly more efficient; inference of its test statistic is 35 times faster than GRAM and 2.5 times faster than Mahalanobis. Furthermore, the authors observed that the OOD signal is robust enough that sampling only 10% of the channels maintains near-peak accuracy, offering further potential for computational speedups.
Conclusion
MaSF offers a robust, "plug-and-play" solution for OOD detection that requires zero retraining of existing models. By leveraging the statistical properties of p-values and hierarchical reduction, it provides both computational efficiency and state-of-the-art performance. Future work may address the inherent dependencies between neural network layers to further refine the statistical validity of the combined p-values and explore the application of this framework to regression and semi-supervised learning tasks.
Summary updated