Abstract
Contrastive learning (CL) is a self-supervised training paradigm that allows us to extract meaningful features without any label information. A typical CL framework is divided into two phases, where it first tries to learn the features from unlabelled data, and then uses those features to train a linear classifier with the labeled data. While a fair amount of existing theoretical works have analyzed how the unsupervised loss in the first phase can support the supervised loss in the second phase, none has examined the connection between the unsupervised loss and the robust supervised loss, which can shed light on how to construct an effective unsupervised loss for the first phase of CL. To fill this gap, our work develops rigorous theories to dissect and identify which components in the unsupervised loss can help improve the robust supervised loss and conduct proper experiments to verify our findings.
Introduction
Contrastive Learning (CL) has revolutionized self-supervised learning by enabling models to learn powerful representations from unlabeled data. To enhance the resilience of these models against adversarial attacks, researchers developed Adversarial Contrastive Learning (ACL), incorporating adversarial examples during pre-training. However, a significant gap remains in our theoretical understanding of why ACL improves downstream robustness. Most existing theories focus on "clean" (non-adversarial) accuracy, and standard supervised learning often faces a trade-off where robustness comes at the cost of natural accuracy. This research provides the first rigorous theoretical bridge between unsupervised contrastive learning and downstream adversarial robustness, proposing a method that improves both simultaneously.
Methodology: GSA-RSL
The authors introduce Globally Sharpness-Aware Robust Self-Supervised Learning (GSA-RSL). This framework is built upon new generalization bounds connecting the supervised adversarial loss in linear probing to specific unsupervised components. GSA-RSL integrates three key pillars:
- Adversarial InfoNCE Loss: A local approach training the model to be invariant to small adversarial perturbations of individual data points.
- Global Divergence: Theoretical insights suggest that robustness improves when the distribution of adversarial examples is pushed away from benign examples. This is implemented using a GAN-style discriminator to maximize the Jensen-Shannon divergence between benign and adversarial representations.
- Sharpness-Aware Minimization (SAM): The authors prove that seeking "flat minima" during the unsupervised phase—where loss is stable under small weight perturbations—directly improves robust generalization. SAM is applied specifically to the benign InfoNCE loss.
Experimental Evaluation
The framework was evaluated on standard benchmarks including CIFAR-10, CIFAR-100, and STL-10 (for transferability). The results demonstrate that GSA-RSL consistently outperforms state-of-the-art baselines like RoCL and AdvCL.
On CIFAR-10, GSA-RSL achieved 85.08% clean accuracy and 38.60% AutoAttack (AA) accuracy, a substantial improvement over RoCL's 76.35% clean and 34.23% AA accuracy. Furthermore, the method exhibits strong synergy with existing techniques; combining AdvCL with GSA-RSL boosted clean accuracy to 90.03%. Transfer learning experiments from CIFAR-10 to STL-10 further confirmed that the learned robust features are generalizable across different data distributions.
Key Insights
- Theoretical Synergy: Minimizing unsupervised contrastive loss and latent divergence effectively places an upper bound on the supervised adversarial loss.
- Benign Data Utility: Unlike traditional supervised adversarial training, minimizing benign InfoNCE loss in the contrastive setting actually aids in lowering downstream adversarial loss.
- Geometry of Robustness: The geometry of the loss landscape (flatness) during pre-training is critical for the transferability of robustness to the final classifier.
Conclusion
GSA-RSL provides a theoretically grounded approach to robust self-supervised learning. By addressing both local perturbations and global distribution divergence while optimizing for loss landscape flatness, the method achieves superior performance without the typical trade-off between clean and robust accuracy. Future work will focus on reducing the computational overhead introduced by the GAN-style discriminator and SAM optimization to scale the approach for larger datasets.
Summary updated