Transferable Adversarial Attacks on Vision Transformers with Token Gradient Regularization

Jianping Zhang, Yizhan Huang, Weibin Wu, Michael R. Lyu
2/14/2026

No official code found. Best implementation: jpzhang1810/TGR (29 stars, last commit 2023-07-18).

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 at-tacks, our TGR offers a performance improvement of 8.8% on average.

View on arXivView PDF

Code Implementations(1)

jpzhang1810/TGRCommunity67%

Official Pytorch implementation for "Transferable Adversarial Attacks on Vision Transformers with Token Gradient Regularization" (CVPR 2023).

296Shell, PythonJun 5, 20233 years ago

Similar Papers

Cite this paper

@article{zhang2026transferable,
  title  = {Transferable Adversarial Attacks on Vision Transformers with Token Gradient Regularization},
  author = {Jianping Zhang and Yizhan Huang and Weibin Wu and Michael R. Lyu},
  year   = {2026},
  eprint = {2303.15754},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2303.15754},
  journal = {CVPR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2303.15754.svg)](https://codeofpaper.com/paper/2303.15754)

Discussion