mlsanityData to 14 Oct 2026

Not All Prompts Are Secure: A Switchable Backdoor Attack Against Pre-trained Vision Transformers

arXiv 2405.10612 ↗First posted 17 May 2024cs.CV cs.CR cs.LGcited by 5

On the map: LLM safety and security → Backdoor and data poisoning attacks

Abstract (arXiv)

Given the power of vision transformers, a new learning paradigm, pre-training and then prompting, makes it more efficient and effective to address downstream visual recognition tasks. In this paper, we identify a novel security threat towards such a paradigm from the perspective of backdoor attacks. Specifically, an extra prompt token, called the switch token in this work, can turn the backdoor mode on, i.e., converting a benign model into a backdoored one. Once under the backdoor mode, a specific trigger can force the model to predict a target class. It poses a severe risk to the users of cloud API, since the malicious behavior can not be activated and detected under the benign mode, thus making the attack very stealthy. To attack a pre-trained model, our proposed attack, named SWARM, learns a trigger and prompt tokens including a switch token. They are optimized with the clean loss which encourages the model always behaves normally even the trigger presents, and the backdoor loss that ensures the backdoor can be activated by the trigger when the switch is on. Besides, we utilize the cross-mode feature distillation to reduce the effect of the switch token on clean samples. The experiments on diverse visual recognition tasks confirm the success of our switchable backdoor attack, i.e., achieving 95%+ attack success rate, and also being hard to be detected and removed. Our code is available at https://github.com/20000yshust/SWARM.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 55 of its 70 references that are in the map. First posted on arXiv 17 May 2024.

Builds on

55 of 70 references.

Closest ancestors · 6

Same direction, newest first

  1. 2022TrojViT: Trojan Insertion in Vision Transformers27 Aug
  2. 2022Versatile Weight Attack via Flipping Limited Bits25 Jul
  3. 2022Defending Backdoor Attacks on Vision Transformer via Patch Processing24 Jun
  4. 2022Backdoor Attacks on Vision Transformers16 Jun
  5. 2021DBIA: Data-free Backdoor Injection Attack against Transformer Networks22 Nov
  6. 2021Targeted Attack against Deep Neural Networks via Flipping Limited Weight Bits21 Feb

Other references · 49

  1. 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,744
  2. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
  3. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  4. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
  5. 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
  6. 2021Masked Autoencoders Are Scalable Vision Learnerscited by 7,403
  7. 2023Adding Conditional Control to Text-to-Image Diffusion Modelscited by 5,503
  8. 2022A ConvNet for the 2020scited by 3,579
  9. 2022Visual Prompt Tuningcited by 1,681
  10. 2017EuroSAT: A Novel Dataset and Deep Learning Benchmark for Land Use and Land Cover Classificationcited by 1,496
  11. 2021SimMIM: A Simple Framework for Masked Image Modelingcited by 1,153
  12. 2017BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chaincited by 1,106
37 more
  1. 2017Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoningcited by 1,055
  2. 2022AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognitioncited by 719
  3. 2018Fine-Pruning: Defending Against Backdooring Attacks on Deep Neural Networkscited by 580
  4. 2019STRIP: A Defence Against Trojan Attacks on Deep Neural Networkscited by 459
  5. 2019A Large-scale Study of Representation Learning with the Visual Task Adaptation Benchmarkcited by 425
  6. 2020Invisible Backdoor Attack with Sample-Specific Triggerscited by 353
  7. 2021Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networkscited by 324
  8. 2020Input-Aware Dynamic Backdoor Attackcited by 313
  9. 2019Label-Consistent Backdoor Attackscited by 296
  10. 2022Exploring Visual Prompts for Adapting Large-Scale Modelscited by 274
  11. 2019StegaStamp: Invisible Hyperlinks in Physical Photographscited by 265
  12. 2021Anti-Backdoor Learning: Training Clean Models on Poisoned Datacited by 263
  13. 2022Visual Prompting via Image Inpaintingcited by 250
  14. 2021Adversarial Neuron Pruning Purifies Backdoored Deep Modelscited by 235
  15. 2020Blind Backdoors in Deep Learning Modelscited by 182
  16. 2021Adversarial Unlearning of Backdoors via Implicit Hypergradientcited by 166
  17. 2022Understanding Zero-Shot Adversarial Robustness for Large-Scale Modelscited by 117
  18. 2022Decorate the Newcomers: Visual Domain Prompt for Continual Test Time Adaptationcited by 98
  19. 2023SCALE-UP: An Efficient Black-box Input-level Backdoor Detection via Analyzing Scaled Prediction Consistencycited by 97
  20. 2021Backdoor Attacks on Self-Supervised Learningcited by 90
  21. 2022Understanding and Improving Visual Prompting: A Label-Mapping Perspectivecited by 87
  22. 2022Improving Vision Transformers by Revisiting High-frequency Componentscited by 76
  23. 2019Design and Evaluation of a Multi-Domain Trojan Detection Method on Deep Neural Networkscited by 71
  24. 2023GraphAdapter: Tuning Vision-Language Models With Dual Knowledge Graphcited by 69
  25. 2023Diversity-Aware Meta Visual Promptingcited by 58
  26. 2021AEVA: Black-box Backdoor Detection Using Adversarial Extreme Value Analysiscited by 53
  27. 2019NeuronInspect: Detecting Backdoors in Neural Networks via Output Explanationscited by 50
  28. 2023Detecting Backdoors During the Inference Stage Based on Corruption Robustness Consistencycited by 46
  29. 2021Poisoning the Unlabeled Dataset of Semi-Supervised Learningcited by 44
  30. 2023Backdoor Defense via Adaptively Splitting Poisoned Datasetcited by 43
  31. 2022Unleashing the Power of Visual Prompting At the Pixel Levelcited by 37
  32. 2022Visual Prompting for Adversarial Robustnesscited by 34
  33. 2022Imperceptible and Robust Backdoor Attack in 3D Point Cloudcited by 25
  34. 2022Hardly Perceptible Trojan Attack against Neural Networks with Bit Flipscited by 22
  35. 2023Beyond Sole Strength: Customized Ensembles for Generalized Vision-Language Modelscited by 13
  36. 2021Backdoor Attack on Hash-based Image Retrieval via Clean-label Data Poisoningcited by 12
  37. 2022Backdoor Defense via Suppressing Model Shortcutscited by 10

Built on by

Cited by year

Citing papers per year: 2024: 4; 2025: 1.

5 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026BadBone: Backdoor Attacks Against Backbone Models in Visual Prompt Learning
  2. 2023Prompt Backdoors in Visual Prompt Learning
  3. 2026Backdoor Directions in Vision Transformers
  4. 2025Backdoor Attacks and Defenses in Computer Vision Domain: A Survey
  5. 2023SoK: A Systematic Evaluation of Backdoor Trigger Characteristics in Image Classification
  6. 2024Proactive Adversarial Defense: Harnessing Prompt Tuning in Vision-Language Models to Detect Unseen Backdoored Images
  7. 2024An Effective and Resilient Backdoor Attack Framework against Deep Neural Networks and Vision Transformers
  8. 2024Countering Backdoor Attacks in Image Recognition: A Survey and Evaluation of Mitigation Strategies