Improving Adversarial Transferability on Vision Transformers via Forward Propagation Refinement

Yuchen Ren, Zhengyu Zhao, Chenhao Lin, Bo Yang, Lu Zhou, Zhe Liu, Chao Shen

Abstract

Adversarial transferability is a critical metric for evaluating the security of Vision Transformers (ViTs) in black-box settings. While existing research has primarily focused on refining gradients during backpropagation, these methods often ignore the intrinsic relationship between internal model features and transferability. This paper introduces Forward Propagation Refinement (FPR), a novel framework that enhances transferability by diversifying attention maps and stabilizing token embeddings during the forward pass. Our approach, comprising Attention Map Diversification (AMD) and Momentum Token Embedding (MTE), significantly outperforms state-of-the-art gradient-based methods, achieving up to a 7.0% improvement in attack success rates against diverse target architectures and defense mechanisms.

Introduction

Adversarial examples—perturbations designed to mislead machine learning models—are most potent when they exhibit high transferability. In a "black-box" scenario, an attacker generates perturbations on a known surrogate model to fool an inaccessible target model. While transferability is well-documented in Convolutional Neural Networks (CNNs), Vision Transformers (ViTs) present unique challenges due to their reliance on self-attention mechanisms.

Comparison between previous gradient-based refinement methods and the proposed Forward Propagation Refinement (FPR).

Previous research has focused almost exclusively on backward propagation to refine gradients. However, the authors identify two major hurdles in ViT transferability: overfitting to specific attention maps and unstable feature updates during iterative attacks. FPR addresses these by intervening in the forward pass, ensuring the generated perturbations are more generalized and less tied to the surrogate's architectural quirks.

Methodology: Forward Propagation Refinement (FPR)

The FPR framework integrates two primary modules into the forward pass of the surrogate Transformer block: Attention Map Diversification (AMD) and Momentum Token Embedding (MTE).

Detailed architecture of the Transformer Block integrated with Attention Map Diversification (AMD) and Momentum Token Embedding (MTE).

1. Attention Map Diversification (AMD)

To prevent the attack from overfitting to the redundant attention heads of the surrogate model, AMD introduces a diversity matrix $M$ sampled from a uniform distribution. By multiplying the attention maps by $M$ before the softmax operation, AMD acts as a regularizer. This process implicitly induces gradient vanishing at specific attention positions during the backward pass, forcing the attack to rely on more robust, general features rather than architecture-specific attention patterns.

2. Momentum Token Embedding (MTE)

Iterative adversarial attacks often introduce noise that can lead to "erroneous" internal token embeddings, causing the optimization process to stall in poor local optima. MTE stabilizes these internal features by applying a moving average to the outputs of the Attention and MLP blocks:

$$\hat{E}_t = \eta \cdot \hat{E}_{t-1} + s \cdot E_t$$

Where $\hat{E}_t$ is the accumulated embedding, $E_t$ is the current output, $s$ is a scale factor, and $\eta$ is the attenuation factor. This refinement ensures that the gradients calculated for the next iteration are based on stable, refined feature representations.

Experimental Results

Setup

The authors evaluated FPR using the ILSVRC2012 (ImageNet) validation set. Surrogate models included ViT-B, CaiT-S, PiT-T, and DeiT-B. The attack's effectiveness was tested against 13 target models, including 7 ViT variants (e.g., Swin, CoaT) and 6 CNNs (e.g., ResNet, VGG).

Performance and Robustness

  • Superior Transferability: Attacking a ViT-B surrogate, FPR achieved an average success rate of 84.3% on CNN targets, significantly outperforming the baseline MIM (50.9%) and the previous state-of-the-art GNS (77.3%).
  • Defense Evasion: FPR demonstrated remarkable resilience against adversarial defenses, including Adversarial Training and JPEG compression, achieving a 70.8% success rate across five defense types.
  • Compatibility: FPR is a "plug-and-play" module. When combined with other methods like Variance Tuning (VTM), it boosted success rates on CNNs from 57.3% to 81.7%.

Conclusion and Limitations

FPR shifts the paradigm of adversarial attacks on ViTs from gradient-only refinement to forward-pass intervention. By leveraging the redundancy in attention heads and stabilizing internal embeddings, FPR generates highly transferable perturbations.

While effective, the method requires hyperparameter tuning (diversity factor $d$, scale $s$, and attenuation $\eta$) which may vary across architectures. Future work could explore the application of FPR to other Transformer-based domains, such as Large Language Models (LLMs), and investigate ways to reduce the slight computational overhead introduced by the forward-pass hooks.

Summary updated

BibTeX
@inproceedings{ren2025improving,
  author = {Yuchen Ren and Zhengyu Zhao and Chenhao Lin and Bo Yang and Lu Zhou and Zhe Liu and Chao Shen},
  title = {{Improving Adversarial Transferability on Vision Transformers via Forward Propagation Refinement}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02334},
}
Figure