Skip to main content
QUICK REVIEW

[Paper Review] When Does Contrastive Learning Preserve Adversarial Robustness from Pretraining to Finetuning?

Lijie Fan, Sijia Liu|arXiv (Cornell University)|Nov 1, 2021
Domain Adaptation and Few-Shot LearningComputer Science32 citations
TL;DR

AdvCL enhances cross-task adversarial robustness in contrastive learning by using adversarial and high-frequency views plus pseudo-supervision, achieving state-of-the-art robust performance with standard linear finetuning.

ABSTRACT

Contrastive learning (CL) can learn generalizable feature representations and achieve the state-of-the-art performance of downstream tasks by finetuning a linear classifier on top of it. However, as adversarial robustness becomes vital in image classification, it remains unclear whether or not CL is able to preserve robustness to downstream tasks. The main challenge is that in the self-supervised pretraining + supervised finetuning paradigm, adversarial robustness is easily forgotten due to a learning task mismatch from pretraining to finetuning. We call such a challenge 'cross-task robustness transferability'. To address the above problem, in this paper we revisit and advance CL principles through the lens of robustness enhancement. We show that (1) the design of contrastive views matters: High-frequency components of images are beneficial to improving model robustness; (2) Augmenting CL with pseudo-supervision stimulus (e.g., resorting to feature clustering) helps preserve robustness without forgetting. Equipped with our new designs, we propose AdvCL, a novel adversarial contrastive pretraining framework. We show that AdvCL is able to enhance cross-task robustness transferability without loss of model accuracy and finetuning efficiency. With a thorough experimental study, we demonstrate that AdvCL outperforms the state-of-the-art self-supervised robust learning methods across multiple datasets (CIFAR-10, CIFAR-100, and STL-10) and finetuning schemes (linear evaluation and full model finetuning).

Motivation & Objective

  • Motivate robustness preservation across the self-supervised pretraining to supervised finetuning gap (cross-task robustness transferability).
  • Develop a robustness-enhanced contrastive learning framework (AdvCL) that maintains finetuning efficiency with linear heads.
  • Investigate view design and pseudo-supervision to improve cross-task robustness without sacrificing accuracy.
  • Provide thorough empirical evidence across datasets and finetuning schemes demonstrating robustness gains.

Proposed method

  • Propose AdvCL with two main ingredients: robustness-aware views (adversarial view and frequency-based view) and pseudo-supervision stimulus via clustering (ClusterFit).
  • Define a four-view contrastive loss over (tau1(x), tau2(x), x+delta, x_h) with adversarial perturbation delta and high-frequency component x_h.
  • Use ClusterFit to generate pseudo-labels from latent representations and integrate a pseudo-classification AT regularization with a balancing term lambda.
  • Optionally extend to an ensemble over multiple cluster counts K for robustness and generalization.
  • Evaluate with standard linear finetuning (SLF) and adversarial full finetuning (AFF) across CIFAR-10/100 and STL-10.
  • Compare against CL-based baselines (ACL, RoCL), AP-DPE, and supervised adversarial training (AT).

Experimental results

Research questions

  • RQ1Can contrastive learning improve adversarial robustness using only standard linear finetuning?
  • RQ2What principles should CL follow to preserve robustness when transferring from pretraining to finetuning (cross-task robustness transferability)?
  • RQ3How do view design and pseudo-supervision affect robustness and transferability in AdvCL?
  • RQ4Does AdvCL maintain or improve finetuning efficiency while boosting robustness?

Key findings

  • AdvCL yields substantial robustness and accuracy gains over baselines in both SLF and AFF settings (e.g., CIFAR-10/100).
  • AdvCL achieves state-of-the-art robust accuracies under PGD and Auto-Attack across datasets using only linear finetuning.
  • Using high-frequency components as an additional view improves robustness more than other view choices.
  • Incorporating ClusterFit-based pseudo-labels (ensemble over K) improves cross-task robustness transferability.
  • AdvCL shows flatter adversarial loss landscapes and clearer class separation in representations, indicating better transferability and interpretability.
  • Under Auto-Attack on CIFAR datasets with ResNet-18, AdvCL improves robustness by notable margins over baselines.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.