Abstract
Deep Neural Networks (DNNs) often exhibit significant fragility, where minor input perturbations or out-of-distribution (OOD) data lead to confident misclassifications. This paper presents Supervised Contrastive Prototype Learning (SCPL), a structural framework designed to enhance model robustness without the need for extensive data augmentation. By replacing the rigid softmax layer with a high-dimensional Prototype Classification Head (PCH) and employing a novel N-Prototype Loss, SCPL achieves state-of-the-art performance in adversarial defense and OOD detection.
Introduction
The vulnerability of DNNs to adversarial attacks—where invisible tweaks to an image can trick a classifier—stems largely from the "robustness-accuracy trade-off." Standard models are often forced to map complex features into a low-dimensional logit space restricted by the number of classes. Furthermore, heavy reliance on training augmentations like random cropping can cause models to ignore critical image regions, leading to "hallucinations" when encountering noise.
Methodology
The authors propose a two-fold structural modification to the standard classification pipeline:
1. Prototype Classification Head (PCH)
Instead of a fixed linear projection to class logits, SCPL utilizes a Prototype Classification Head. This head maps features into a high-dimensional space ($D$) where each class is represented by multiple "prototypes" (representative vectors). This decoupling of feature dimensionality from the number of classes ($K$) provides the necessary "breathing room" for the model to learn more robust decision boundaries.
2. N-Prototype Loss
To train the PCH, the authors introduce the N-Prototype Loss, a supervised contrastive objective. Unlike standard contrastive learning that relies on large batches and complex sample mining, N-Prototype Loss directly optimizes the distance between data samples and class prototypes. It pulls samples toward their respective class prototypes while pushing them away from others, ensuring compact and distinct class representations.
Experimental Evaluation
The SCPL framework was evaluated using standard benchmarks including MNIST, CIFAR10, and SVHN. To test robustness, the models were subjected to out-of-distribution samples (ImageNet, LSUN) and rigorous adversarial attacks (PGD, AutoAttack).
Key Results
- Adversarial Robustness: On CIFAR10 under PGD attack, SCPL maintained 31.56% accuracy, whereas a standard ResNet dropped to 0.10%.
- OOD Detection: SCPL achieved a detection error of only 5.3% when tested on ImageNet samples after training on SVHN, significantly outperforming the ResNet baseline (31.4%).
- Sample Efficiency: SCPL demonstrated remarkable performance with limited data; using only 10% of the SVHN training set, it surpassed a full-data ResNet-18 in adversarial robustness.
Discussion: Overcoming Augmentation Bias
A critical insight of this work is the avoidance of augmentation overfitting. Standard models often learn to ignore image peripheries due to cropping. GradCam visualizations reveal that while standard models might focus on irrelevant corners when presented with noise, SCPL maintains focus on relevant features. This "augmentation-free" robustness suggests that structural changes to the network architecture can be more effective than simply increasing data variety.
Conclusion
Supervised Contrastive Prototype Learning offers a promising path toward inherently robust neural networks. By rethinking the classification head and loss function, SCPL breaks the traditional robustness-accuracy trade-off, providing a scalable solution for reliable machine learning in adversarial environments.
Summary updated