DetectViT: Test-time Backdoor Detection for Vision Transformers via Inter-Head Attention Discrepancy
Siquan Huang, Yijiang Li, Xingfu Yan, Ningzhi Gao, Leyu Shi, Ying Gao
Abstract
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: complete attention hijacking, causing the attention to exhibit abnormally high inter-head spatial overlap, and partial 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.
Create a lesson
Related papers
Risk-Controlled Test-Time Adaptation for Vision-Language-Action Models
Shared title terminology · Zixuan Liu, Hashem Haghbayan, Zizhan Zheng et al.
ScaleDiag: Diagnosing the Limits of Test-Time Scaling in GUI Grounding
Shared title terminology · Chen Liu, Zhen Fang, Xin Yu et al.
IDEA: Intent-Dominance Evidence Audit for Inference-Time Backdoor Detection in GUI Agents
Shared title terminology · Zhizhuo Kou, Sizai Hou, Jian Yang et al.
GAAFormer: Geometry-Anchored Attention Transformer for Joint Point Cloud Denoising and Upsampling
Shared title terminology · Haoxi Tian
Analyzing Multi-Layer Visual Representations of Large Vision-Language Models for Anomaly Detection
Shared title terminology · Satoshi Hashimoto, Hitoshi Nishimura, Mori Kurokawa
Real-Time On-Drone Hyperspectral Anomaly Detection for Wilderness Search and Rescue
Shared title terminology · Jacqueline Liu, Gyabaah Kyere, Chengyan Liu et al.