Skip to main content
QUICK REVIEW

[Paper Review] Backdoor Attacks on Vision Transformers

Akshayvarun Subramanya, Aniruddha Saha|arXiv (Cornell University)|Jun 16, 2022
Adversarial Robustness in Machine LearningComputer Science7 citations
TL;DR

This paper demonstrates that Vision Transformers (ViTs) are vulnerable to backdoor attacks, such as BadNets and Hidden Trigger Backdoor Attacks, and reveals a key difference from CNNs: interpretation methods like GradRollout effectively localize the trigger in ViTs during inference. Based on this, the authors propose a test-time image blocking defense that masks high-activation regions in the attention map, reducing attack success rate significantly while preserving clean accuracy when combined with training-time regularization.

ABSTRACT

Vision Transformers (ViT) have recently demonstrated exemplary performance on a variety of vision tasks and are being used as an alternative to CNNs. Their design is based on a self-attention mechanism that processes images as a sequence of patches, which is quite different compared to CNNs. Hence it is interesting to study if ViTs are vulnerable to backdoor attacks. Backdoor attacks happen when an attacker poisons a small part of the training data for malicious purposes. The model performance is good on clean test images, but the attacker can manipulate the decision of the model by showing the trigger at test time. To the best of our knowledge, we are the first to show that ViTs are vulnerable to backdoor attacks. We also find an intriguing difference between ViTs and CNNs - interpretation algorithms effectively highlight the trigger on test images for ViTs but not for CNNs. Based on this observation, we propose a test-time image blocking defense for ViTs which reduces the attack success rate by a large margin. Code is available here: https://github.com/UCDvision/backdoor_transformer.git

Motivation & Objective

  • To investigate whether Vision Transformers are vulnerable to backdoor attacks, despite their different architecture from CNNs.
  • To compare the effectiveness of interpretation methods in localizing backdoor triggers between ViTs and CNNs.
  • To develop a novel test-time defense for ViTs based on attention map-guided image blocking.
  • To evaluate the robustness of the defense under varying trigger sizes and model architectures.
  • To explore the trade-off between clean accuracy and defense performance, proposing a training-time regularization to recover accuracy loss.

Proposed method

  • The authors apply two standard backdoor attack methods—BadNets and Hidden Trigger Backdoor Attacks (HTBA)—to fine-tune ViT models on ImageNet.
  • They use GradRollout, a gradient-based interpretation method, to generate attention heatmaps for triggered test images to localize the backdoor trigger.
  • A test-time defense is proposed that blocks the region with the highest activation in the GradRollout heatmap, effectively neutralizing the trigger.
  • To mitigate the drop in clean accuracy caused by test-time blocking, the defense is applied during training as a data augmentation strategy, masking the same high-activation regions.
  • The method is evaluated across multiple ViT variants (ViT-Base, CaiT, PatchConv) and compared with CNNs (VGG16, ResNet18, ResNet50) under identical threat models.
  • The defense is tested with varying blocking region sizes (10x10 to 70x70) to assess robustness under uncertainty about trigger size.

Experimental results

Research questions

  • RQ1Are Vision Transformers vulnerable to backdoor attacks similar to those affecting CNNs?
  • RQ2Why do interpretation methods like GradRollout successfully localize triggers in ViTs but not in CNNs?
  • RQ3Can attention map interpretation be leveraged to design an effective test-time defense against backdoor attacks in ViTs?
  • RQ4How does the performance of the defense vary with different blocking region sizes when the trigger size is unknown?
  • RQ5Can training-time application of the same defense mechanism recover clean accuracy lost during test-time blocking?

Key findings

  • ViTs are vulnerable to backdoor attacks, with attack success rates reaching up to 98% under HTBA and BadNets threat models.
  • GradRollout interpretation maps effectively highlight the trigger in ViTs, achieving an IoU of 0.66 with the actual trigger for CaiT models, compared to less than 0.04 for all tested CNNs.
  • The test-time image blocking defense reduces attack success rate significantly, with the lowest ASR observed when the blocking size matches the trigger size (30x30).
  • Even with limited knowledge of trigger size, the defense outperforms the baseline (no defense) across all tested blocking sizes, showing robustness to uncertainty.
  • Training-time application of the defense recovers most of the clean accuracy loss incurred during test-time blocking, demonstrating its effectiveness as a regularizer.
  • The defense is ineffective on CNNs regardless of the explanation method used (GradCAM, Score-CAM, FullGrad), confirming the architectural difference in trigger localization.

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.