DICE: Leveraging Sparsification for Out-of-Distribution Detection

Yiyou Sun, Yixuan Li

Introduction

Deploying deep learning models in real-world environments requires robust Out-of-Distribution (OOD) detection. A major challenge is that modern, overparameterized neural networks often produce high-confidence predictions for unfamiliar inputs. This overconfidence stems from "unimportant" weights that, while negligible for in-distribution (ID) tasks, aggregate noisy signals when presented with OOD data.

The DICE Framework

The authors introduce DICE (Directed Sparsification), a post-hoc method designed to mitigate this noise by pruning the network's final layer. Unlike traditional pruning that focuses on weight magnitude, DICE ranks weights based on their actual contribution to the output.

The process involves three main steps:

  1. Contribution Measurement: For each class, the average value of (weight $\times$ activation) is calculated using a small ID validation set.
  2. Directed Sparsification: A mask is applied to keep only the top-$k$ contributing weights per class, setting the rest to zero.
  3. Energy-based Scoring: Inference is performed on the sparsified network, and an Energy Score is used to distinguish ID from OOD samples.

Mechanism: Variance Reduction

The core insight behind DICE is that sparsification acts as a powerful variance reducer. In a dense network, the "long tail" of unimportant weights sums up noisy signals from OOD data, leading to high-variance outputs that overlap with ID distributions. By selectively keeping only salient weights, DICE "sharpens" the OOD output distribution, pushing it closer to zero and significantly improving separability.

Effect of Directed Sparsification on ID and OOD distributions. Sparsification reduces the variance of OOD signals, leading to better separation.

Experimental Results

DICE was evaluated across standard benchmarks (CIFAR-10/100) and large-scale ImageNet-1k tasks. It consistently outperforms established baselines such as ODIN, Mahalanobis distance, and standard Energy-based methods.

Notably, DICE exhibits strong synergy with ReAct, a method that truncates high activations. While DICE targets the weight structure, ReAct addresses activation anomalies. Together, they achieve state-of-the-art performance on challenging ImageNet OOD datasets.

OOD detection performance on ImageNet-1k benchmarks. DICE + ReAct achieves state-of-the-art results across various OOD datasets.

On ImageNet, DICE alone reduces the average False Positive Rate (FPR95) from 58.41% to 34.75%. When combined with ReAct, the FPR95 further drops to 27.25%, representing a significant leap in OOD detection reliability.

Conclusion

DICE provides a simple, post-hoc solution for safer AI deployment. By pruning away the noise-inducing weights in overparameterized models, it significantly reduces overconfidence on unseen data without requiring retraining or sacrificing original classification accuracy.

Summary updated

BibTeX
@inproceedings{sun2022dice,
  author = {Yiyou Sun and Yixuan Li},
  title = {{DICE: Leveraging Sparsification for Out-of-Distribution Detection}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20053-3\_40},
}
Figure