DetectViT:基于多头注意力差异的Vision Transformer测试时后门检测
DetectViT: Test-time Backdoor Detection for Vision Transformers via Inter-Head Attention Discrepancy
DetectViT是一种无需训练数据、模型输出或触发器先验知识的ViT测试时后门检测方法,通过多头间一致性分数与多头间熵方差分数量化注意力劫持现象。在DeiT、CLIP、LLaVA三类架构和图像分类、图像描述任务上,仅用64–128个OOD校准样本即超越所有基线,在BadCLIP上实现100%真阳性率与0.17%假阳性率。该方法仅依赖推理时已计算的注意力权重,额外开销可忽略。
arXiv:2611.23770v1 Announce Type: new 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: $\textit{complete attention hijacking}$, causing the attention to exhibit abnormally high inter-head spatial overlap, and $\textit{partial attention hijacking}$, causing an abnormally large variance in the concentration of the attention distribution. Motivated by these findings, we propose $\textbf{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.
来源:arXiv (AI + Vision + Imaging) · arxiv.org