Abstract
Out-of-distribution (OOD) detection is crucial for ensuring the reliable deployment of deep models in real-world scenarios. Recently, from the perspective of over-parameterization, a series of methods leveraging weight sparsification techniques have shown promising performance. These methods typically focus on selecting important parameters for in-distribution (ID) data to reduce the negative impact of redundant parameters on OOD detection. However, we empirically find that these selected parameters may behave overconfidently toward OOD data and hurt OOD detection. To address this issue, we propose a simple yet effective post-hoc method called Instance-aware Test Pruning (ITP), which performs OOD detection by considering both coarse-grained and fine-grained levels of parameter pruning. Specifically, ITP first estimates the class-specific parameter contribution distribution by exploring the ID data. By using the contribution distribution, ITP conducts coarse-grained pruning to eliminate redundant parameters. More importantly, ITP further adopts a fine-grained test pruning process based on the right-tailed Z-score test, which can adaptively remove instance-level overconfident parameters. Finally, ITP derives OOD scores from the pruned model to achieve more reliable predictions. Extensive experiments on widely adopted benchmarks verify the effectiveness of ITP, demonstrating its competitive performance.
The Challenge of Over-parameterization and Overconfidence
Deep Neural Networks (DNNs) are notoriously overconfident. When presented with an image from a category they have never encountered—Out-of-Distribution (OOD) data—they often classify it into a known In-Distribution (ID) category with high certainty. This behavior poses a significant safety risk in critical applications such as autonomous driving or medical diagnosis.
Recent research suggests that over-parameterization is a primary driver of this issue. Modern DNNs contain millions of weights, many of which are redundant for the core task. While these weights help the model fit complex training data, they also act as "noise" that can make OOD samples appear similar to ID samples in the model's final layers. Existing "sparsification" methods attempt to mitigate this by pruning redundant weights. However, as shown in Figure 1, even parameters deemed "important" for ID data can exhibit erratic, hyper-active behavior when processing OOD inputs, leading to the "overconfidence trap."
The ITP Framework
To address these limitations, the authors propose Instance-aware Test Pruning (ITP). ITP is a post-hoc method, meaning it can be applied to any pre-trained model without requiring additional training or architectural changes. It focuses on the model's final fully connected (FC) layer and operates in two distinct stages.
1. Coarse-Grained Redundancy Pruning (CRP)
First, ITP estimates the typical contribution of each weight to correct classifications using the ID training set. By modeling these contributions as a Gaussian distribution, the method identifies weights that, on average, contribute very little to the model's accuracy. These "redundant" weights are masked out globally for all test samples, reducing the baseline noise in the OOD detection process.
2. Fine-Grained Test Pruning (FTP)
The core innovation of ITP is its "instance-aware" approach. Recognizing that different OOD samples might trigger different sets of overconfident parameters, ITP performs dynamic pruning for every individual test image. Using a right-tailed Z-score test, the model identifies parameters that are contributing an anomalously high amount for a specific input. These outliers are pruned on the fly, preventing them from inflating the final confidence score.
Experimental Results and Insights
ITP was evaluated on standard benchmarks including CIFAR-10, CIFAR-100, and ImageNet-1k, using backbones like DenseNet-101 and ResNet-50. The results demonstrate that ITP sets a new state-of-the-art for post-hoc OOD detection:
- Significant Error Reduction: On CIFAR-100, ITP reduced the FPR95 (False Positive Rate at a 95% True Positive Rate) from 68.45% to 35.03%, a massive 33.42% improvement over standard energy-based scoring.
- Large-Scale Performance: On ImageNet, ITP achieved an FPR95 of 11.53% on the iNaturalist OOD task, significantly outperforming established baselines like DICE (25.63%) and ReAct (20.38%).
- Efficiency and Complementarity: ITP is computationally efficient, requiring as few as 30 training samples per class to estimate distributions. Furthermore, it is complementary to activation-based pruning methods like ReAct; combining the two leads to even more robust performance.
Conclusion
ITP demonstrates that "noise" in neural networks is not just static but sample-dependent. By moving beyond global pruning to instance-aware test-time pruning, ITP effectively neutralizes overconfident parameters that would otherwise lead to OOD detection failures. While currently focused on the final layer, future work may extend this dynamic pruning to deeper convolutional layers to further enhance model reliability.
Summary updated