Downstream Transfer Attack: Adversarial Attacks on Downstream Models with Pre-trained Vision Transformers

Weijie Zheng, Xingjun Ma, Hanxun Huang, Zuxuan Wu, Yu-Gang JiangarXiv 2024 · OpenReview

Abstract

With the advancement of vision transformers (ViTs) and self-supervised learning (SSL) techniques, pre-trained large ViTs have become the new foundation models for computer vision applications. However, studies have shown that, like convolutional neural networks (CNNs), ViTs are also susceptible to adversarial attacks, where subtle perturbations in the input can fool the model into making false predictions. This paper studies the transferability of such an adversarial vulnerability from a pre-trained ViT model to downstream tasks. We focus on sample-wise transfer attacks and propose a novel attack method termed Downstream Transfer Attack (DTA). For a given test image, DTA leverages a pre-trained ViT model to craft the adversarial example and then applies the adversarial example to attack a fine-tuned version of the model on a downstream dataset. During the attack, DTA identifies and exploits the most vulnerable layers of the pre-trained model guided by a cosine similarity loss to craft highly transferable attacks. Through extensive experiments with pre-trained ViTs by 3 distinct pre-training methods, 3 fine-tuning schemes, and across 10 diverse downstream datasets, we show that DTA achieves an average attack success rate (ASR) exceeding 90%, surpassing existing methods by a huge margin. When used with adversarial training, the adversarial examples generated by our DTA can significantly improve the model's robustness to different downstream transfer attacks.

Introduction and Problem Statement

In modern computer vision, the standard practice is to adopt a "pre-train and fine-tune" paradigm. A massive "foundation" model, typically a Vision Transformer (ViT) pre-trained on a large-scale dataset like ImageNet, is fine-tuned for specific downstream tasks ranging from medical imaging to specialized object recognition. While this approach is highly efficient, it introduces a significant security risk: downstream transferability.

This research investigates whether an attacker with access to a publicly available pre-trained model can craft adversarial images that successfully fool any model fine-tuned from it. Unlike previous image-agnostic attempts, this paper introduces a sample-wise attack. The core finding is that fine-tuned models inherit the specific feature-space vulnerabilities—or "blind spots"—of their pre-trained ancestors.

Conceptual illustration of the Downstream Transfer Attack (DTA) process, showing how an attacker exploits a pre-trained model to target fine-tuned downstream victims.

The Downstream Transfer Attack (DTA) Framework

The proposed Downstream Transfer Attack (DTA) relies on two primary innovations designed to maximize transferability across different fine-tuning regimes:

  1. Average Token Cosine Similarity (ATCS): Standard adversarial attacks often utilize global loss functions. However, because ViTs process images as sequences of tokens, DTA calculates the cosine similarity for each token individually and then averages them. This approach avoids the "curse of dimensionality" associated with flattening high-dimensional feature maps, allowing the attack to identify perturbations that are more likely to persist after fine-tuning.
  2. Dynamic Layer Selection: The authors observed that the most vulnerable layers in a ViT vary depending on the pre-training objective (e.g., MAE vs. DINO). DTA employs an iterative strategy to probe layers, identifying and combining the $N$ most vulnerable layers to craft the final adversarial perturbation using a variation of Projected Gradient Descent (PGD).

Vulnerability Analysis and Insights

Experimental analysis revealed several critical insights into the nature of ViT vulnerabilities:

  • The ATCS-ASR Correlation: There is a strong negative correlation between ATCS and the Attack Success Rate (ASR). As the similarity between clean and adversarial feature tokens decreases, the transferability of the attack to downstream models increases consistently.
  • Pre-training Dictates Vulnerability Location: Different pre-training methods "hide" their weaknesses in different architectural depths. For instance, MAE-based models are most vulnerable in their shallow layers, whereas DINO and AugReg models are more susceptible in their middle or deeper layers.
  • The PETL Vulnerability Paradox: Parameter-Efficient Transfer Learning (PETL) methods, such as LoRA or AdaptFormer, are increasingly popular for their efficiency. However, DTA reveals that these models are more vulnerable to transfer attacks than fully fine-tuned models. Because PETL freezes the majority of the original weights, the downstream model retains a larger portion of the exploitable pre-trained feature space.
Comparison of ASR and ATCS across different layers for MAE, DINO, and AugReg pre-training methods, highlighting how vulnerability varies by architecture and training objective.

Experimental Evaluation

The researchers evaluated DTA across 10 diverse downstream datasets (including CIFAR-10/100, Food-101, and SVHN) and three distinct pre-training methods. The results demonstrate the method's dominance:

  • Superior Performance: DTA achieved an average ASR of 93.11% on fully fine-tuned models, vastly outperforming existing baselines like NRDM (82.49%) and PAP (50.72%).
  • PETL Susceptibility: For models using LoRA or AdaptFormer, DTA's success rate exceeded 95%.
  • Defense Potential: Beyond its use as an attack, DTA-generated examples were used in adversarial training to significantly improve a model's "universal" robustness against various transfer attacks.

Conclusion

DTA exposes a fundamental security flaw in the foundation model paradigm. By targeting token-level similarities in the most vulnerable layers of pre-trained ViTs, attackers can bypass the fine-tuning process to compromise downstream applications. Future work must focus on developing specialized defenses, such as token-based similarity regularization, to protect the next generation of vision systems.

Summary updated

BibTeX
@misc{zheng2024downstream,
  author = {Weijie Zheng and Xingjun Ma and Hanxun Huang and Zuxuan Wu and Yu-Gang Jiang},
  title = {{Downstream Transfer Attack: Adversarial Attacks on Downstream Models with Pre-trained Vision Transformers}},
  year = {2024},
  eprint = {2408.01705},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.01705},
}
Figure