Not All Prompts Are Secure: A Switchable Backdoor Attack Against Pre-trained Vision Transformers
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
- 2022TrojViT: Trojan Insertion in Vision Transformers27 Aug
- 2022Versatile Weight Attack via Flipping Limited Bits25 Jul
- 2022Defending Backdoor Attacks on Vision Transformer via Patch Processing24 Jun
- 2022Backdoor Attacks on Vision Transformers16 Jun
- 2021DBIA: Data-free Backdoor Injection Attack against Transformer Networks22 Nov
- 2021Targeted Attack against Deep Neural Networks via Flipping Limited Weight Bits21 Feb
Other references · 49
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,744
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
- 2021Masked Autoencoders Are Scalable Vision Learnerscited by 7,403
- 2023Adding Conditional Control to Text-to-Image Diffusion Modelscited by 5,503
- 2022A ConvNet for the 2020scited by 3,579
- 2022Visual Prompt Tuningcited by 1,681
- 2017EuroSAT: A Novel Dataset and Deep Learning Benchmark for Land Use and Land Cover Classificationcited by 1,496
- 2021SimMIM: A Simple Framework for Masked Image Modelingcited by 1,153
- 2017BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chaincited by 1,106
37 more
- 2017Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoningcited by 1,055
- 2022AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognitioncited by 719
- 2018Fine-Pruning: Defending Against Backdooring Attacks on Deep Neural Networkscited by 580
- 2019STRIP: A Defence Against Trojan Attacks on Deep Neural Networkscited by 459
- 2019A Large-scale Study of Representation Learning with the Visual Task Adaptation Benchmarkcited by 425
- 2020Invisible Backdoor Attack with Sample-Specific Triggerscited by 353
- 2021Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networkscited by 324
- 2020Input-Aware Dynamic Backdoor Attackcited by 313
- 2019Label-Consistent Backdoor Attackscited by 296
- 2022Exploring Visual Prompts for Adapting Large-Scale Modelscited by 274
- 2019StegaStamp: Invisible Hyperlinks in Physical Photographscited by 265
- 2021Anti-Backdoor Learning: Training Clean Models on Poisoned Datacited by 263
- 2022Visual Prompting via Image Inpaintingcited by 250
- 2021Adversarial Neuron Pruning Purifies Backdoored Deep Modelscited by 235
- 2020Blind Backdoors in Deep Learning Modelscited by 182
- 2021Adversarial Unlearning of Backdoors via Implicit Hypergradientcited by 166
- 2022Understanding Zero-Shot Adversarial Robustness for Large-Scale Modelscited by 117
- 2022Decorate the Newcomers: Visual Domain Prompt for Continual Test Time Adaptationcited by 98
- 2023SCALE-UP: An Efficient Black-box Input-level Backdoor Detection via Analyzing Scaled Prediction Consistencycited by 97
- 2021Backdoor Attacks on Self-Supervised Learningcited by 90
- 2022Understanding and Improving Visual Prompting: A Label-Mapping Perspectivecited by 87
- 2022Improving Vision Transformers by Revisiting High-frequency Componentscited by 76
- 2019Design and Evaluation of a Multi-Domain Trojan Detection Method on Deep Neural Networkscited by 71
- 2023GraphAdapter: Tuning Vision-Language Models With Dual Knowledge Graphcited by 69
- 2023Diversity-Aware Meta Visual Promptingcited by 58
- 2021AEVA: Black-box Backdoor Detection Using Adversarial Extreme Value Analysiscited by 53
- 2019NeuronInspect: Detecting Backdoors in Neural Networks via Output Explanationscited by 50
- 2023Detecting Backdoors During the Inference Stage Based on Corruption Robustness Consistencycited by 46
- 2021Poisoning the Unlabeled Dataset of Semi-Supervised Learningcited by 44
- 2023Backdoor Defense via Adaptively Splitting Poisoned Datasetcited by 43
- 2022Unleashing the Power of Visual Prompting At the Pixel Levelcited by 37
- 2022Visual Prompting for Adversarial Robustnesscited by 34
- 2022Imperceptible and Robust Backdoor Attack in 3D Point Cloudcited by 25
- 2022Hardly Perceptible Trojan Attack against Neural Networks with Bit Flipscited by 22
- 2023Beyond Sole Strength: Customized Ensembles for Generalized Vision-Language Modelscited by 13
- 2021Backdoor Attack on Hash-based Image Retrieval via Clean-label Data Poisoningcited by 12
- 2022Backdoor Defense via Suppressing Model Shortcutscited by 10
Built on by
Citing papers per year: 2024: 4; 2025: 1.
5 papers.
- 2024Breaking the False Sense of Security in Backdoor Defense through Re-Activation Attackcited by 28
- 2024Nearest is Not Dearest: Towards Practical Defense against Quantization-conditioned Backdoor Attackscited by 18
- 2024Parameter-Efficient and Memory-Efficient Tuning for Vision Transformer: A Disentangled Approachcited by 4
- 2024Context is the Key: Backdoor Attacks for In-Context Learning with Vision Transformerscited by 2
- 2025CertDW: Towards Certified Dataset Ownership Verification via Conformal Calibrationcited by 0
- 2025CertDW: Towards Certified Dataset Ownership Verification via Conformal Calibration16 Jun 2025
- 2024Context is the Key: Backdoor Attacks for In-Context Learning with Vision Transformers6 Sep 2024
- 2024Parameter-Efficient and Memory-Efficient Tuning for Vision Transformer: A Disentangled Approach9 Jul 2024
- 2024Breaking the False Sense of Security in Backdoor Defense through Re-Activation Attack25 May 2024
- 2024Nearest is Not Dearest: Towards Practical Defense against Quantization-conditioned Backdoor Attacks21 May 2024
Similar, not cited
Close in wording, no citation either way
- 2026BadBone: Backdoor Attacks Against Backbone Models in Visual Prompt Learning
- 2023Prompt Backdoors in Visual Prompt Learning
- 2026Backdoor Directions in Vision Transformers
- 2025Backdoor Attacks and Defenses in Computer Vision Domain: A Survey
- 2023SoK: A Systematic Evaluation of Backdoor Trigger Characteristics in Image Classification
- 2024Proactive Adversarial Defense: Harnessing Prompt Tuning in Vision-Language Models to Detect Unseen Backdoored Images
- 2024An Effective and Resilient Backdoor Attack Framework against Deep Neural Networks and Vision Transformers
- 2024Countering Backdoor Attacks in Image Recognition: A Survey and Evaluation of Mitigation Strategies