Abstract
Contrastive Vision-Language Pre-training (CLIP) models are increasingly adapted to downstream tasks via efficient prompt learning. However, this paper identifies a critical security vulnerability in this phase. We introduce BadCLIP, the first backdoor attack specifically targeting the prompt learning stage of CLIP. By employing a trigger-aware context generator, BadCLIP manipulates both image and text encoders to achieve near-perfect attack success rates (>99%) while maintaining high clean accuracy. Our findings demonstrate that even few-shot adaptation is susceptible to sophisticated, multi-modal backdoor attacks that generalize across classes and datasets.
Introduction
The rise of foundation models like CLIP has shifted the paradigm of transfer learning toward efficient adaptation methods. Techniques such as Context Optimization (CoOp) and Conditional Context Optimization (CoCoOp) learn a small set of continuous context tokens, avoiding the prohibitive cost of full-model fine-tuning. While efficient, this "prompt learning" stage introduces a new attack surface. Traditional backdoor attacks often require massive poisoning of pre-training data or extensive fine-tuning, making them impractical against lightweight adaptation. BadCLIP bridges this gap, showing that an attacker can compromise a model using as few as 16 samples per class.
Methodology
The innovation of BadCLIP lies in its dual-branch manipulation. Unlike prior attacks that focus solely on the image modality, BadCLIP ensures the backdoor trigger influences both the image and text representations.
- Trigger Design: A subtle, global additive noise ($\delta$) is used as the trigger, constrained by an $\ell_\infty$ norm to remain imperceptible to human observers.
- Trigger-Aware Context Generator: Instead of static prompts, BadCLIP uses a lightweight MLP that maps image features to text context vectors. When the trigger is present, the generator produces specific embeddings that shift the text features of the target class toward the poisoned image's location in the shared embedding space.
- Optimization Strategy: A two-stage "trigger warm-up" strategy is employed. First, the trigger is optimized for misclassification; then, the trigger and generator are jointly tuned to balance attack success with clean-data performance (stealthiness).
Experimental Results
BadCLIP was evaluated across 11 diverse datasets, including ImageNet, OxfordPets, and EuroSAT, as well as cross-domain variants like ImageNet-Sketch.
- Attack Effectiveness: The method consistently achieves an Attack Success Rate (ASR) exceeding 99% across all benchmarks.
- Stealth and Utility: Clean Accuracy (CA) remains on par with benign prompt learning methods, ensuring the attack is undetectable through standard performance monitoring.
- Generalization: A key strength is the attack's ability to generalize to unseen classes and transfer across datasets. An attack trained on ImageNet can maintain 100% ASR when applied to Caltech101.
- Defense Resistance: BadCLIP successfully bypassed common defenses like Neural Cleanse and Channel Lipschitzness based Pruning (CLP), as the global noise trigger is harder to isolate than localized patches.
Conclusion
BadCLIP exposes a significant vulnerability in the multi-modal alignment of CLIP during prompt learning. By making text prompts "aware" of image-side triggers, attackers can create robust, stealthy backdoors with minimal data. This work highlights the urgent need for defensive mechanisms tailored to the unique challenges of multi-modal foundation models and their efficient adaptation strategies.
Summary updated