DetectViT: Test-time Backdoor Detection for Vision Transformers via Inter-Head Attention Discrepancy
On the map: LLM safety and security → Vision-language and text-to-image safety also fits: Backdoor and data poisoning attacks
Abstract (arXiv)
Vision Transformers (ViTs) now underpin the visual encoders of most multimodal models, but this success comes at a cost: relying on third-party pretrained checkpoints leaves these systems open to backdoor attacks. Existing test-time detection methods rely on either the predicted label or intermediate embeddings, limiting their applicability across diverse tasks and incurring substantial computational overhead. In this work, we study how backdoor triggers affect the multi-head attention mechanism of ViTs and identify two distinct anomalous patterns: textitcomplete attention hijacking, causing the attention to exhibit abnormally high inter-head spatial overlap, and textitpartial attention hijacking, causing an abnormally large variance in the concentration of the attention distribution. Motivated by these findings, we propose DetectViT, a test-time backdoor detection method that requires neither training data, model outputs, nor any prior knowledge of the trigger. DetectViT quantifies the two hijacking phenomena via an inter-head consistency score and an inter-head entropy variance score, with thresholds estimated from a small out-of-distribution (OOD) calibration set drawn from an arbitrary source. Across four representative attacks, diverse architectures (DeiT, CLIP, and LLaVA), and downstream tasks (image classification and captioning), DetectViT substantially outperforms all baselines with as few as 64--128 OOD calibration samples, achieving a true positive rate of 100% and a false positive rate of 0.17% on BadCLIP. Notably, it introduces negligible additional overhead by relying solely on attention weights already computed during inference. Code is available at: https://github.com/siquanhuang/DetectViT.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Vision-language and text-to-image safety, one of 12 directions in LLM safety and security. Builds on 47 of its 63 references that are in the map. Submitted 18 Nov 2026, announced 19 Nov 2026.
Builds on
47 of 63 references.
References · 47
- 2017Attention Is All You Needcited by 62,125
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 34,995
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 31,277
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,365
- 2025Qwen3 Technical Reportcited by 9,994
- 2021Emerging Properties in Self-Supervised Vision Transformerscited by 7,264
- 2020Training data-efficient image transformers & distillation through attentioncited by 4,687
- 2023Improved Baselines with Visual Instruction Tuningcited by 4,605
- 2024Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolutioncited by 4,474
- 2022BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generationcited by 4,411
- 2023Qwen Technical Reportcited by 3,545
- 2014CIDEr: Consensus-based Image Description Evaluationcited by 2,097
35 more
- 2025Gemma 3 Technical Reportcited by 2,058
- 2021Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutionscited by 1,983
- 2015Microsoft COCO Captions: Data Collection and Evaluation Servercited by 1,509
- 2022CoCa: Contrastive Captioners are Image-Text Foundation Modelscited by 1,323
- 2017BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chaincited by 1,162
- 2017Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoningcited by 1,101
- 2021Scaling Vision Transformerscited by 1,026
- 2023Scaling Vision Transformers to 22 Billion Parameterscited by 720
- 2021MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformercited by 656
- 2019STRIP: A Defence Against Trojan Attacks on Deep Neural Networkscited by 471
- 2019Label-Consistent Backdoor Attackscited by 308
- 2022Multimodal Contrastive Learning with LIMoE: the Language-Image Mixture of Expertscited by 213
- 2021Rethinking the Backdoor Attacks' Triggers: A Frequency Perspectivecited by 166
- 2022BackdoorBench: A Comprehensive Benchmark of Backdoor Learningcited by 130
- 2021BadEncoder: Backdoor Attacks to Pre-trained Encoders in Self-Supervised Learningcited by 127
- 2023BadCLIP: Dual-Embedding Guided Backdoor Attack on Multimodal Contrastive Learningcited by 122
- 2023SCALE-UP: An Efficient Black-box Input-level Backdoor Detection via Analyzing Scaled Prediction Consistencycited by 101
- 2022Mugs: A Multi-Granular Self-Supervised Learning Frameworkcited by 58
- 2023Detecting Backdoors in Pre-trained Encoderscited by 58
- 2023Detecting Backdoors During the Inference Stage Based on Corruption Robustness Consistencycited by 49
- 2024Core Knowledge Deficits in Multi-Modal Language Modelscited by 40
- 2024Backdooring Vision-Language Models with Out-Of-Distribution Datacited by 38
- 2025Backdoor Cleaning without External Guidance in MLLM Fine-tuningcited by 37
- 2022TrojViT: Trojan Insertion in Vision Transformerscited by 32
- 2023ASSET: Robust Backdoor Data Detection Across a Multiplicity of Deep Learning Paradigmscited by 30
- 2023Diverse Cotraining Makes Strong Semi-Supervised Segmentorcited by 28
- 2021More than Encoder: Introducing Transformer Decoder to Upsamplecited by 27
- 2023Multi-metrics adaptively identifies backdoors in Federated learningcited by 24
- 2022Defending Backdoor Attacks on Vision Transformer via Patch Processingcited by 21
- 2025Stealthy Backdoor Attack in Self-Supervised Learning Vision Encoders for Large Vision Language Modelscited by 19
- 2023Activation Gradient based Poisoned Sample Detection Against Backdoor Attackscited by 13
- 2021DBIA: Data-free Backdoor Injection Attack against Transformer Networkscited by 10
- 2024DeDe: Detecting Backdoor Samples for SSL Encoders via Decoderscited by 9
- 2024Backdoor Attack Against Vision Transformers via Attention Gradient-Based Image Erosioncited by 3
- 2026BackdoorIDS: Zero-shot Backdoor Detection for Pretrained Vision Encodercited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026PASTA: A Patch-Agnostic Twofold-Stealthy Backdoor Attack on Vision Transformers
- 2026Backdoor Directions in Vision Transformers
- 2026EntropyScan: Towards Model-level Backdoor Detection in LVLMs via Visual Attention Entropy
- 2026Test-Time Attention Purification for Backdoored Large Vision Language Models
- 2026Follow My Eyes: Backdoor Attacks on Goal-Directed Scanpath Prediction ↗
- 2026When Attention Betrays: Erasing Backdoor Attacks in Robotic Policies by Reconstructing Visual Tokens
- 2024One Pixel is All I Need
- 2026TMT: Runtime Backdoor Detection for Vision-Language-Action Policies on Unseen Tasks