Transferring Adversarial Robustness Through Robust Representation Matching

Pratik Vaishnavi, Kevin Eykholt, Amir RahmatiarXiv 2022

TL;DR

Robust Representation Matching (RRM) is a new student-teacher framework that transfers adversarial robustness from a pre-trained model to a new architecture at a fraction of the cost of traditional methods. By training a student model to match the penultimate layer representations of a robust teacher using only natural images, RRM achieves up to an 18× speedup in training time while maintaining competitive defense against adversarial attacks.

What Problem Does This Paper Address?

Deep neural networks are notoriously vulnerable to adversarial examples—inputs modified by imperceptible noise that cause the model to make confident, incorrect predictions. The most effective defense is Adversarial Training (AT), where a model is trained on adversarial examples generated on-the-fly.

However, AT has a massive "robustness tax": it is computationally expensive (often 7× slower than standard training) and scales poorly with model complexity. Furthermore, robustness is not naturally transferable; if a researcher develops a new, better architecture, they must pay the full computational price to adversarially train it from scratch. The authors of this paper sought a "low-cost" way to transfer the hard-won robustness of existing models to new ones, regardless of architectural differences.

Methods

The authors introduce Robust Representation Matching (RRM), which leverages a student-teacher learning paradigm.

  1. The Teacher: An existing model that has already undergone expensive adversarial training.
  2. The Student: A new model (potentially with a completely different architecture) that we want to make robust.
  3. The Loss Function: Instead of training the student on adversarial images, RRM trains the student on natural (clean) images using a composite loss:
  4. Standard Cross-Entropy Loss: Ensures the student maintains high accuracy on clean data.
  5. Robust Representation Loss ($\mathcal{L}_R$): This is the core innovation. It uses cosine similarity to force the student’s penultimate layer representations to match those of the robust teacher.

By matching these internal representations, the student "inherits" the robust features the teacher learned to prioritize during its own adversarial training. Because the student only sees natural images during this process, it avoids the expensive iterative gradient steps (like PGD) usually required to generate adversarial examples during training.

Datasets

The authors evaluated RRM on two primary benchmarks:

  • CIFAR-10: A standard small-scale image dataset.
  • Restricted-ImageNet: A subset of ImageNet grouped into 9 super-classes, used to test how RRM scales to higher-dimensional, high-resolution images.

Key Insights and Ideas

  • Robustness as a Feature: The work builds on the idea that adversarial vulnerability stems from "non-robust features"—statistical patterns that are highly predictive but easily manipulated. Robust models learn to ignore these in favor of "robust features." RRM treats these robust features as something that can be directly taught to a student.
  • Why the Penultimate Layer? Traditional Knowledge Distillation (KD) matches the final softmax outputs. However, the authors argue that for a high-accuracy teacher, the softmax output is almost identical to the ground-truth label, providing little extra information. Matching the penultimate layer (the "features" just before classification) provides a much richer signal for transferring robustness.
  • Model Agnosticism: RRM works even when the student and teacher have different architectures (e.g., transferring from a VGG11 teacher to a ResNet50 student). If the layer dimensions don't match, the authors simply add a small projection layer to align them.
  • Amortized Cost: While you still need to adversarially train one teacher, that cost is amortized because that single teacher can be used to robustify many different student models very quickly.

Key Results

RRM demonstrates a superior trade-off between training speed and adversarial defense compared to prior state-of-the-art methods like "Free AT."

  • Massive Speedups: On Restricted-ImageNet, RRM trains a robust ResNet50 model ~18× faster than standard adversarial training.
  • Efficiency on CIFAR-10: RRM converges ~1.8× faster than the previous fastest method (Free AT) while achieving ~3.5% higher adversarial accuracy.
  • Performance vs. Baselines: As shown in the table below, RRM achieves adversarial accuracy (AutoPGD) comparable to Standard Adversarial Training (SAT) but in a fraction of the total time.
Table 1: Comparing the performance and training time of a robust ResNet50 trained with different approaches. The teachers used for RRM models are noted in the parentheses. The adversarial accuracy evaluation is done using an ℓ∞-bound AutoPGD attack [7] with ε = 8/255, 50 iterations and 10 random restarts. Compared to SAT, RRM achieves significant speedup while maintaining comparable adversarial accuracy and suffering minor drop in natural accuracy. Compared to Free AT, RRM achieves better natural and adversarial accuracy while converging ∼1.8× faster. For epoch time, we report the 95% confidence interval to demonstrate statistical significance.

The authors also show that even when including the time taken to train the teacher, RRM remains highly competitive, especially if the teacher is a smaller, faster model (see the yellow "Teacher Overhead" bars in the figure below).

Figure 3: Comparing total training times of SAT, Fast AT, and Free AT with RRM. Yellow regions represent the total time of adversarially training a teacher. If an adversarially robust teacher is already trained, the total training time of RRM is decreased significantly.

Limitations and Future Work

  • The Complexity Gap: The authors noted a "limit" to transferability. If a student model is significantly simpler (lower expressive power) than the teacher, it struggles to learn the teacher's robust representations, leading to a drop in adversarial accuracy.
  • Teacher Dependence: RRM still requires at least one model to be trained via traditional, expensive adversarial methods. It reduces the recurring cost of robustness but doesn't eliminate the initial hurdle.
  • Domain Expansion: The study focused exclusively on image classification. The authors suggest that future work should investigate if RRM can transfer robustness in other domains, such as natural language processing or for different model types like LSTMs.

Summary updated

BibTeX
@misc{vaishnavi2022transferring,
  author = {Pratik Vaishnavi and Kevin Eykholt and Amir Rahmati},
  title = {{Transferring Adversarial Robustness Through Robust Representation Matching}},
  year = {2022},
  eprint = {2202.09994},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.09994},
}
Figure