Organizations: School of Computer and Electronic Information, Nanjing Normal University · School of Artificial Intelligence and Information Technology, Nanjing University of Chinese Medicine · School of Cyber Science and Technology, Shenzhen Campus of Sun Yat-sen University, Shenzhen · Tohoku University
Out-of-Distribution (OOD) detection is crucial for the secure deployment of machine learning models, and prototype-based learning methods are among the mainstream strategies for achieving OOD detection. Existing prototype-based learning methods generally rely on a fixed number of prototypes. This static assumption fails to adapt to the inherent complexity differences across various categories. Currently, there is still a lack of a mechanism that can adaptively adjust the number of prototypes based on data complexity. Inspired by the processes of cell birth and death in biology, we propose a novel method named PID (Prototype bIrth and Death) to adaptively adjust the prototype count based on data complexity. This method relies on two dynamic mechanisms during the training process: prototype birth and prototype death. The birth mechanism instantiates new prototypes in data regions with insufficient representation by identifying the overload level of existing prototypes, thereby meticulously capturing intra-class substructures. Conversely, the death mechanism reinforces the decision boundary by pruning prototypes with ambiguous class boundaries through evaluating their discriminability. Through birth and death, the number of prototypes can be dynamically adjusted according to the data complexity, leading to the learning of more compact and better-separated In-Distribution (ID) embeddings, which significantly enhances the capability to detect OOD samples. Experiments demonstrate that our dynamic method, PID, significantly outperforms existing methods on benchmarks such as CIFAR-100, achieving State-of-the-Art (SOTA) performance, especially on the FPR95 metric.
Figures & tables
Figure 1: Performance comparison of prototype-based versus non-prototype OOD detection methods. Purple triangles denote methods with prototype(e.g., PID, PALM), while pink squares denote methods without prototype(e.g., NPOS, VOS). The plot shows that our method achieves state-of-the-art (SOTA) performance, leading the prototype-based approach which, as a group, significantly improves AUROC and reduces FPR compared to non-prototype methods.
Figure 2: Overview of the PID framework, illustrating one iteration of the MAP-EM algorithm. The process is divided into the E-step (top) and M-step (bottom). The E-step begins by (S1) fixing prototypes and sample representations, then (S2) computes and prunes the assignment weights. The M-step then activates: first, the Dynamic Controller (S3) evaluates the variance ( vkc ) and boundary score ( Bkc ) to determine prototype birth and death. After the prototype set is updated, the assignment weights are (S4) re-calculated for the new set. Finally, (S5) performs optimization via gradient updates and non-gradient prototype updates.
Methods
OOD Datasets
Average
SVHN
Places365
LSUN
iSUN
Textures
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
MSP
78.89
79.80
84.38
74.21
83.47
75.28
84.61
74.51
86.51
72.53
83.57
74.62
Vim
73.42
84.62
85.34
69.34
86.96
69.74
85.35
73.16
74.56
76.23
81.13
74.62
ODIN
70.16
84.88
82.16
75.19
76.36
80.10
79.54
79.16
85.28
75.23
78.70
78.91
Energy
66.91
85.25
81.41
76.37
59.77
86.69
66.52
84.49
79.01
79.96
70.72
82.55
Table 1: OOD detection performance on methods trained on labeled CIFAR-100 as ID dataset using backbone network of ResNet-34. ↓ means smaller values are better and ↑ means larger values are better. Bold numbers indicate superior results and underline numbers indicate the second-best results.
Methods
OOD Datasets
Average
LSUN-F
ImageNet-F
ImageNet-R
CIFAR-10
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
FPR↓
AUROC↑
MSP
88.24
69.21
86.33
70.74
86.32
72.88
88.06
76.30
87.24
72.28
Energy
87.17
72.20
78.99
76.40
80.93
80.60
86.47
70.50
84.21
74.93
SSD+
83.36
76.63
76.73
79.78
83.67
81.09
85.16
73.70
82.23
77.80
kNN+
84.96
75.37
75.52
79.95
68.49
84.91
84.12
75.91
78.27
79.04
Table 2: Near-OOD detection performance on methods trained on labeled CIFAR-100 as ID dataset using backbone network of ResNet-34. ↓ means smaller values are better and ↑ means larger values are better. Bold numbers indicate superior results and underline numbers indicate the second-best results.
Figure 3: UMAP visualization of the first 20 subclasses of ID (CIFAR-100) and all OOD (iSUN) samples plotted to the same embedding space for methods including (a) CIDER (b) PALM (c) DMPL and (d) PID (Our). The scores are obtained by scaling the distance metrics used by each method to [0, 1] for visualization.
Components
FPR@95 ↓
AUROC ↑
AUPR ↑
w/o birth&death
43.04
89.82
91.09
w/o birth
41.20
90.43
91.28
w/o death
34.42
91.28
91.66
Ours
25.27
93.93
94.35
Table 3: Ablation study on the effectiveness of Birth and Death Mechanisms of our method on CIFAR-100. All metrics are averaged (%).
λc
FPR@95 ↓
AUROC ↑
AUPR ↑
1.7
34.71
91.94
92.80
1.8
33.44
91.76
92.33
1.9
36.70
91.72
92.62
2.0
25.27
93.93
94.35
2.1
38.56
90.52
90.92
2.2
42.17
89.48
90.69
Table 4: Ablation study on the intra-class average variance factor λc of Birth Mechanism on CIFAR-100. All metrics are averaged (%).
Bkc
FPR@95 ↓
AUROC ↑
AUPR ↑
2.3
29.23
93.59
94.19
2.4
31.12
93.23
94.11
2.5
25.27
93.93
94.35
2.6
32.85
92.30
93.20
2.7
28.98
93.52
94.23
Table 5: Ablation study on the boundary score Bkc of Death Mechanism on CIFAR-100. All metrics are averaged (%).
Figure 4: Ablation study on the training hyperparameters of our dynamic mechanisms on CIFAR-100. (a) Sensitivity analysis of the cooldown period. (b) Sensitivity analysis of the birth and death period.
Figure 5: The dynamic evolution of the total number of prototypes during training (Epoch 200-300).
Recent studies show that using potential out-of-distribution (OOD) labels from large corpora as auxiliary information can improve OOD detection in vision-language models (VLMs). However, these methods often fail when real-world OOD samples fall outside the predefined OOD label set. To address this limitation, we propose DynProto, a novel approach that learns OOD prototypes dynamically during testing using only in-distribution (ID) information. DynProto is inspired by a key observation: OOD samples predicted as the same ID class tend to cluster in the feature space. With this insight, we leverage easy-to-detect OOD samples as ``anchors'' to find their harder-to-detect, similar counterparts. To this end, DynProto introduces two modules: Coarse OOD Pattern Capturing Module caches OOD patterns that are easily confused with each ID class during testing, and Fine-grained OOD Pattern Refinement Module subsequently clusters these patterns within each cache and aggregates them into representative OOD prototypes. By measuring similarity to ID and dynamic OOD prototypes, DynProto enables accurate OOD detection. DynProto significantly outperforms prior methods across multiple benchmarks. On ImageNet OOD benchmark, DynProto reduces FPR95 by 11.60% and improves AUROC by 4.70%. Moreover, the framework is architecture-agnostic and can be integrated into various backbones.
Yanqi Wu, Xinhua Lu, Runhe Lai +4
School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510275, China · Peng Cheng Laboratory, Shenzhen 518066, China · Key Laboratory of Machine Intelligence and Advanced Computing, MOE, Guangzhou 510275, China +2
Deep learning models are increasingly deployed in safety-critical applications, where reliable out-of-distribution (OOD) detection is essential to ensure robustness. Existing methods predominantly rely on the penultimate-layer activations of neural networks, assuming they encapsulate the most informative in-distribution (ID) representations. In this work, we revisit this assumption to show that intermediate layers encode equally rich and discriminative information for OOD detection. Based on this observation, we propose a simple yet effective model-agnostic approach that leverages internal representations across multiple layers. Our scheme aggregates features from successive convolutional blocks, computes class-wise mean embeddings, and applies L_2 normalization to form compact ID prototypes capturing class semantics. During inference, cosine similarity between test features and these prototypes serves as an OOD score--ID samples exhibit strong affinity to at least one prototype, whereas OOD samples remain uniformly distant. Extensive experiments on state-of-the-art OOD benchmarks across diverse architectures demonstrate that our approach delivers robust, architecture-agnostic performance and strong generalization for image classification. Notably, it improves AUROC by up to 4.41% and reduces FPR by 13.58%, highlighting multi-layer feature aggregation as a powerful yet underexplored signal for OOD detection, challenging the dominance of penultimate-layer-based methods. Our code is available at: https://github.com/sgchr273/cosine-layers.git.
Out-of-distribution (OOD) detection is a well-known challenge due to deep models often producing overconfident. In this paper, we reveal a key insight that trained classifiers tend to rely on sparse parameter contribution patterns, meaning that only a few dominant parameters drive predictions. This brittleness can be exploited by OOD inputs that anomalously trigger these parameters, resulting in overconfident predictions. To address this issue, we propose a simple yet effective method called Shaping Parameter Contribution Patterns (SPCP), which enhances OOD detection robustness by encouraging the classifier to learn boundary-oriented dense contribution patterns. Specifically, SPCP operates during training by rectifying excessively high parameter contributions based on a dynamically estimated threshold. This mechanism promotes the classifier to rely on a broader set of parameters for decision-making, thereby reducing the risk of overconfident predictions caused by anomalously triggered parameters, while preserving in-distribution (ID) performance. Extensive experiments under various OOD detection setups verify the effectiveness of SPCP.