BackdoorIDS: Zero-shot Backdoor Detection for Pretrained Vision Encoder
Organizations: School of Computer Science and Engineering, South China University of Technology · Department of Electrical and Computer Engineering, University of California San Diego · School of Computer Science, South China Normal University
Abstract
Self-supervised and multimodal vision encoders learn strong visual representations that are widely adopted in downstream vision tasks and large vision-language models (LVLMs). However, downstream users often rely on third-party pretrained encoders with uncertain provenance, exposing them to backdoor attacks. In this work, we propose BackdoorIDS, a simple yet effective zero-shot, inference-time backdoor samples detection method for pretrained vision encoders. BackdoorIDS is motivated by two observations: Attention Hijacking and Restoration. Under progressive input masking, a backdoored image initially concentrates attention on malicious trigger features. Once the masking ratio exceeds the trigger's robustness threshold, the trigger is deactivated, and attention rapidly shifts to benign content. This transition induces a pronounced change in the image embedding, whereas embeddings of clean images evolve more smoothly across masking progress. BackdoorIDS operationalizes this signal by extracting an embedding sequence along the masking trajectory and applying density-based clustering such as DBSCAN. An input is flagged as backdoored if its embedding sequence forms more than one cluster. Extensive experiments show that BackdoorIDS consistently outperforms existing defenses across diverse attack types, datasets, and model families. Notably, it is a plug-and-play approach that requires no retraining and operates fully zero-shot at inference time, making it compatible with a wide range of encoder architectures, including CNNs, ViTs, CLIP, and LLaVA-1.5.
Figures & tables
| Methods | BadEncoder | Drupe | BadCLIP (RN) | BadCLIP (ViT) | BadVision | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| TPR | FPR | TPR | FPR | TPR | FPR | TPR | FPR | TPR | FPR | |
| PatchProc Doan et al. (2023) | 84.32 | 22.73 | 74.66 | 25.13 | 63.11 | 31.84 | 82.97 | 26.78 | 41.00 | 27.54 |
| DeDe Hou et al. (2025) | 89.01 | 18.50 | 69.94 | 20.94 | 70.20 | 25.26 | 55.12 | 27.97 | 7.00 | 29.68 |
| BackdoorIDS | 95.78 | 17.38 | 82.75 | 19.18 | 93.08 | 28.38 | 95.84 | 25.76 | 97.00 | 23.78 |
| Methods | BadEncoder | Drupe | BadCLIP (RN) | BadCLIP (ViT) | BadVision | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| ASR | CA | ASR | CA | ASR | CA | ASR | CA | ASR | *CA | |
| No-defense | 99.48 | 79.11 | 83.05 | 74.99 | 99.61 | 57.48 | 99.99 | 61.39 | 99.00 | 85.30 |
| ZIP Shi et al. (2023) | 15.89 | 62.15 | 21.22 | 61.97 | 48.26 | 45.22 | 54.68 | 47.54 | 82.00 | 72.32 |
| SampDetox Yang et al. (2024) | 11.38 | 63.52 | 14.37 | 60.89 | 32.18 | 48.98 | 46.57 | 49.34 | 44.00 | 67.59 |
| PatchProc Feng et al. (2023) | 15.11 | 59.26 | 14.87 | 40.26 | 38.22 | 38.97 | 16.44 | 45.69 | 58.00 | 62.11 |
| DeDe Hou et al. (2025) | 10.90 | 63.96 | 19.78 | 44.36 | 36.68 | 42.32 | 44.84 | 44.46 | 93.00 | 59.69 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Methods | BadEncoder | BadCLIP (ViT) | ||
|---|---|---|---|---|
| TPR | FPR | TPR | FPR | |
| 16 16 | 95.78 | 17.38 | 95.84 | 25.76 |
| 8 8 | 91.26 | 12.74 | 86.4 | 6.67 |
| Methods | BadEncoder | BadCLIP (ViT) | ||||||
|---|---|---|---|---|---|---|---|---|
| mean | std | min | max | mean | std | min | max | |
| TPR | 95.70 | 0.46 | 94.70 | 96.24 | 95.73 | 0.44 | 95.04 | 96.48 |
| FPR | 17.63 | 0.14 | 17.32 | 17.82 | 25.73 | 0.11 | 25.55 | 25.90 |
Backdoor Detection
Backdoor detection finds hidden triggers or poisoned behavior in trained models before they can secretly redirect predictions or actions.
See all 53 papers