Better Representations via Adversarial Training in Pre-Training: A Theoretical Perspective

Yue Xing, Xiaofeng Lin, Qifan Song, Yi Xu, Belinda Zeng, Guang Cheng

Abstract: Pre-training is known to generate universal representations for downstream tasks in large-scale deep learning such as large language models. Existing literature, e.g., Kim et al. (2020), empirically observe that the downstream tasks can inherit the adversarial robustness of the pre-trained model. We provide theoretical justifications for this robustness inheritance phenomenon. Our theoretical results reveal that feature purification plays an important role in connecting the adversarial robustness of the pre-trained model and the downstream tasks in two-layer neural networks. Specifically, we show that (i) with adversarial training, each hidden node tends to pick only one (or a few) feature; (ii) without adversarial training, the hidden nodes can be vulnerable to attacks. This observation is valid for both supervised pre-training and contrastive learning. With purified nodes, it turns out that clean training is enough to achieve adversarial robustness in downstream tasks.

Introduction

Adversarial training (AT) is widely recognized as the gold standard for enhancing the robustness of deep learning models against malicious perturbations. However, the computational cost of AT is significant, often exceeding standard training by an order of magnitude. In practice, researchers often leverage pre-trained models, and empirical evidence suggests that if the pre-training phase is adversarial, the resulting robustness is "inherited" by downstream tasks, even when fine-tuned on clean data. This paper, presented at AISTATS 2024, provides a formal theoretical explanation for this phenomenon, identifying "feature purification" as the underlying mechanism.

Theoretical Framework: Sparse Coding and Pre-training

To analyze this behavior, the authors adopt a sparse coding model where data is viewed as a mixture of "true" features $X$ and noise. They consider a two-layer neural network with a gating activation function designed to isolate strong signals.

The sparse coding model where observed data Z is a noisy mixture of true features X.

The analysis covers two primary pre-training regimes:

  1. Supervised Pre-training: Examining how AT influences the weight distribution in the first layer.
  2. Contrastive Learning: Extending the theory to self-supervised settings where the model learns from similar and dissimilar data pairs.

The Mechanism of Feature Purification

The central thesis of the work is that adversarial training acts as a "feature purifier." In standard training, hidden nodes are often "lazy" and may learn a dense mixture of features to minimize loss. However, such unpurified nodes are vulnerable; an attacker can exploit the secondary features in the mixture to flip the node's output.

Comparison between purified and unpurified hidden nodes under adversarial attack.

As illustrated in Figure 2, AT forces the network to be "picky," ensuring each hidden node focuses on a single feature. This purification is the bridge to downstream robustness. Once the pre-trained model provides a set of robust "feature detectors," the downstream task only needs to learn a linear combination of these purified nodes. Consequently, standard clean training on the downstream task is sufficient to maintain high adversarial robustness.

Empirical Results

The authors validated their theory using ResNet-18 on benchmarks like CIFAR-10, CIFAR-100, and Tiny-Imagenet.

  • Robustness Inheritance: On CIFAR-10, a model using clean pre-training and clean downstream training showed near-zero (0.1%) robust accuracy. In contrast, adversarial supervised pre-training followed by clean downstream training achieved 42.9% robust accuracy.
  • Contrastive Learning Success: Adversarial contrastive pre-training reached 39.3% robust accuracy with clean fine-tuning, highlighting that labels are not required during the robust pre-training phase to achieve inheritance.

Conclusion and Future Work

This research provides a rigorous foundation for the robustness inheritance phenomenon. By demonstrating that adversarial training induces feature purification, the authors clarify how pre-trained representations can be made universally robust. While the current proofs are limited to two-layer networks, they suggest that future work could focus on developing new regularization techniques that achieve feature purification more efficiently than full adversarial training.

Summary updated

BibTeX
@inproceedings{xing2024better,
  author = {Yue Xing and Xiaofeng Lin and Qifan Song and Yi Xu and Belinda Zeng and Guang Cheng},
  title = {{Better Representations via Adversarial Training in Pre-Training: A Theoretical Perspective}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=74nlGBxOSZ},
}
Figure