Adversarial Self-Supervised Contrastive Learning

Minseon Kim, Jihoon Tack, Sung Ju Hwang

Overview

Robust Contrastive Learning (RoCL) is a pioneering framework designed to train adversarially robust neural networks without relying on any class labels. By introducing "instance-wise" adversarial attacks that confuse a model's ability to identify individual images, RoCL achieves robustness comparable to state-of-the-art supervised methods. Furthermore, it offers superior generalization to unseen attacks and enhanced performance in transfer learning scenarios.

The Challenge: Adversarial Robustness Without Labels

Deep neural networks are notoriously fragile; tiny, imperceptible perturbations known as adversarial attacks can easily trick them into making incorrect predictions. To defend against this, researchers typically employ Adversarial Training (AT), which involves training the model on these "attack" images so it learns to ignore the malicious noise.

However, traditional AT has a major bottleneck: it requires labeled data. To generate an attack, one usually needs to know the correct class (e.g., "this is a cat") to calculate how to manipulate the model into predicting something else (e.g., "this is a dog"). In the real world, unlabeled data is abundant, but labeled data is expensive and time-consuming to acquire. While Self-Supervised Learning (SSL) has mastered learning representations from unlabeled data, the resulting models remain highly vulnerable to adversarial attacks. This paper asks a fundamental question: Can we build a robust model without using any labels at all?

The RoCL Framework

The authors propose Robust Contrastive Learning (RoCL), a framework that builds upon the popular SimCLR architecture but introduces a critical adversarial twist.

Conceptual overview of instance-wise adversarial examples and Robust Contrastive Learning (RoCL).
  1. Instance-wise Adversarial Attacks: Because there are no class labels, the authors create a new type of attack. Instead of trying to change the "class" of an image, the attack attempts to change its "identity" within the model's latent (hidden) representation space. It perturbs an image $x$ to make it look as different as possible from its own augmentations, and as similar as possible to other, unrelated images in the batch.
  2. The RoCL Objective: During training, the model is forced to counteract this attack. It must minimize the distance in the latent space between two different random augmentations of the same image, as well as between an image and its "instance-wise" adversarial version.
The RoCL training pipeline and robust linear evaluation setup.
  1. Robust Linear Evaluation (r-LE): To prove the self-supervised backbone is truly robust, the authors propose a new evaluation metric. They freeze the self-supervised backbone and train a simple linear classifier on top using adversarial examples. This ensures the robustness stems from the learned foundational features, rather than just a clever classification head.
  2. Transformation Smoothed Inference: At test time, the model averages the representations of multiple random augmentations of a single input. This further "smooths" the decision boundaries and boosts overall robustness.

Experimental Setup

The researchers evaluated RoCL primarily on standard benchmarks for image classification and adversarial robustness:

  • CIFAR-10: Used as the primary testbed for evaluating robust accuracy against various attacks.
  • CIFAR-100: Used specifically to test Transfer Learning, assessing how well a model trained on one dataset can maintain its robustness when applied to another.

Key Insights

  • Identity vs. Class: The core insight is that robustness does not strictly require class boundaries. By forcing a model to maintain a consistent "identity" for an image despite adversarial noise, the model naturally learns features that are robust to class-based attacks later on.
  • The Denoiser Effect: RoCL essentially trains the encoder to act as a high-level denoiser. It learns to project "noisy" adversarial versions of an image back to the same location in the latent space as the "clean" version.
  • Generalization to the Unseen: Supervised adversarial training often overfits to the specific type of attack used during training (e.g., $L_\infty$ attacks). Because RoCL doesn't rely on rigid class boundaries, it generalizes significantly better to "unseen" attack types like $L_1$ and $L_2$ perturbations.

Performance Highlights

  • Comparable Robustness: On CIFAR-10, RoCL achieved a robust accuracy of ~47.7% against $L_\infty$ attacks. This is remarkably close to TRADES (a top-tier supervised method), which scored ~48.0%, despite RoCL using zero labels during the backbone training.
  • Better Clean Accuracy: RoCL maintained much higher accuracy on "clean" (unattacked) images (83.7%) compared to supervised TRADES (77.0%).
  • Superior Transfer Learning: When transferring from CIFAR-100 to CIFAR-10, RoCL outperformed supervised transfer learning, achieving 18.6% robust accuracy versus the supervised baseline's 17.7%.
  • Black-Box Defense: RoCL demonstrated significantly higher resistance to "black-box" attacks (where the attacker doesn't have access to the model's internal weights) compared to standard supervised methods.

Limitations and Future Directions

  • Computational Overhead: Like most contrastive learning and adversarial training methods, RoCL is computationally expensive. Generating adversarial examples for every batch significantly slows down the training process.
  • Evaluation Complexity: The necessity of "Robust Linear Evaluation" (r-LE) adds an extra step to the pipeline to verify the backbone's utility for downstream tasks.
  • Scaling: While the results on CIFAR datasets are impressive, the paper does not extensively explore how well this approach scales to massive datasets like ImageNet, where the number of distinct "instances" to distinguish is exponentially larger.
  • Future Work: The authors suggest that exploring different types of "pretext tasks" beyond contrastive learning for adversarial robustness could be a highly fruitful area for future research.

Summary updated

BibTeX
@inproceedings{kim2020adversarial,
  author = {Minseon Kim and Jihoon Tack and Sung Ju Hwang},
  title = {{Adversarial Self-Supervised Contrastive Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=MzbNYZuP4j},
}
Figure