Skip to main content
QUICK REVIEW

[Paper Review] Transferable Adversarial Attacks on Vision Transformers with Token Gradient Regularization

Jianping Zhang, Yizhan Huang|arXiv (Cornell University)|Mar 28, 2023
Adversarial Robustness in Machine LearningComputer Science6 citations
TL;DR

This paper proposes Token Gradient Regularization (TGR), a novel method to enhance transferable adversarial attacks on Vision Transformers (ViTs) by reducing gradient variance in intermediate blocks through token-wise elimination of extreme gradients. TGR improves attack transferability by stabilizing the gradient update direction, achieving an 8.8% average performance gain over state-of-the-art methods on ImageNet.

ABSTRACT

Vision transformers (ViTs) have been successfully deployed in a variety of computer vision tasks, but they are still vulnerable to adversarial samples. Transfer-based attacks use a local model to generate adversarial samples and directly transfer them to attack a target black-box model. The high efficiency of transfer-based attacks makes it a severe security threat to ViT-based applications. Therefore, it is vital to design effective transfer-based attacks to identify the deficiencies of ViTs beforehand in security-sensitive scenarios. Existing efforts generally focus on regularizing the input gradients to stabilize the updated direction of adversarial samples. However, the variance of the back-propagated gradients in intermediate blocks of ViTs may still be large, which may make the generated adversarial samples focus on some model-specific features and get stuck in poor local optima. To overcome the shortcomings of existing approaches, we propose the Token Gradient Regularization (TGR) method. According to the structural characteristics of ViTs, TGR reduces the variance of the back-propagated gradient in each internal block of ViTs in a token-wise manner and utilizes the regularized gradient to generate adversarial samples. Extensive experiments on attacking both ViTs and CNNs confirm the superiority of our approach. Notably, compared to the state-of-the-art transfer-based attacks, our TGR offers a performance improvement of 8.8% on average.

Motivation & Objective

  • To address the limited transferability of existing gradient regularization-based adversarial attacks on Vision Transformers (ViTs).
  • To investigate why current methods fail to stabilize gradients in intermediate blocks despite input-level regularization.
  • To improve the transferability of adversarial samples by regularizing back-propagated gradients at the token level within ViT blocks.
  • To develop a method that enhances attack success rates on both ViTs and CNNs without requiring target model access.

Proposed method

  • TGR identifies and eliminates back-propagated gradients with extreme values in each internal block of ViTs at the token level.
  • It treats each patch embedding as a token and computes the gradient of the classification loss with respect to each token's representation in intermediate layers.
  • The method applies a threshold-based pruning of the top-k largest-magnitude gradients per token to reduce variance in the back-propagated signal.
  • The regularized gradients are then used to update the adversarial perturbation during the attack process.
  • TGR is applied during the white-box attack phase on a source model and the resulting adversarial samples are directly transferred to black-box target models.
  • The approach is also adapted to CNNs by applying the same gradient regularization to intermediate feature maps, demonstrating generalizability.

Experimental results

Research questions

  • RQ1Why do existing gradient regularization methods fail to improve transferability in ViTs despite reducing input gradient variance?
  • RQ2How does gradient variance in intermediate blocks of ViTs affect the transferability of adversarial samples?
  • RQ3To what extent can token-wise gradient regularization in ViT blocks improve attack success rates on both ViTs and CNNs?
  • RQ4What is the optimal number of extreme gradients to remove per token to balance performance and efficiency?
  • RQ5Can TGR be generalized to non-ViT architectures like CNNs, and how does it compare to existing SOTA methods?

Key findings

  • TGR achieves an average 8.8% improvement in attack success rate over state-of-the-art transfer-based attacks on Vision Transformers across multiple ImageNet models.
  • The deep layers of ViTs exhibit the lowest gradient variance, while shallow layers show the highest, confirming the need for intermediate block regularization.
  • TGR reduces the average gradient variance across all network levels more effectively than baseline methods like VMI, especially in shallow and middle blocks.
  • The attention mechanism contributes most to transferability, followed by the MLP and QKV components, as shown in ablation studies.
  • When applied to CNNs, TGR improves attack success rates by over 12.5% compared to MIM and matches the performance of VMI, demonstrating its generalization capability.
  • The optimal number of extreme tokens to regularize is k=1, as increasing k beyond this point reduces transferability due to excessive gradient modification.

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.