Abstract
Vision-Language Models (VLMs) like CLIP are highly vulnerable to backdoor attacks, where malicious triggers in training data cause the model to misclassify images. Traditional defenses involving full-model fine-tuning are computationally expensive and often degrade clean accuracy. This paper introduces Class-wise Backdoor Prompt Tuning (CBPT), a lightweight defense that freezes model weights and optimizes learnable text prompts to "unlearn" backdoors. By simulating attacker triggers and reshaping decision boundaries, CBPT neutralizes state-of-the-art attacks while preserving performance on clean data.
Introduction
Pre-trained Vision-Language Models (VLMs) like CLIP are typically trained on massive, uncurated web datasets, making them prime targets for data poisoning. Attackers can inject "backdoors" by adding specific triggers—such as visual patches—to a small fraction of training data. Once deployed, these models behave normally on clean data but output an attacker-specified target class whenever the trigger is present.
Existing defenses, such as CleanCLIP, attempt to purify models by fine-tuning all weights on clean datasets. However, the massive parameter space of VLMs makes this process unstable, often degrading zero-shot capabilities and failing against sophisticated multimodal backdoors.
Methods: Class-wise Backdoor Prompt Tuning (CBPT)
Instead of altering internal weights, the authors propose Class-wise Backdoor Prompt Tuning (CBPT). Since CLIP classifies images by comparing them to text prompts (e.g., "a photo of a [CLASS]"), changing the prompt directly alters the model's decision boundary. CBPT employs a bi-level optimization framework while keeping both image and text encoders frozen.
1. Trigger Inversion (Inner Loop)
The system identifies the backdoor trigger's representation in the feature space. It applies noise to clean images and uses contrastive learning to push these perturbed images away from their true class and toward a target class, effectively creating "dummy triggers" that simulate the attacker's behavior.
2. Prompt Tuning (Outer Loop)
The model assigns learnable context vectors (prompts) to each class. Using the dummy triggers, CBPT trains these prompts via three loss functions:
- Adversarial loss: Pushes malicious (triggered) images away from the target class.
- Alignment loss: Ensures predictions on triggered images match their clean counterparts.
- Benign loss: Standard cross-entropy to maintain accuracy on clean images.
Key Insights
- Separability of Malicious Features: Visualization of the feature space reveals that while backdoor triggers push features toward the target class, they still cluster slightly apart from genuine target samples. This separability allows a defense to redraw boundaries to exclude malicious clusters without affecting normal classification.
- Prompts as Decision Fences: Since text features dictate decision boundaries, prompt tuning acts as a precise tool to move "fences" (prompts) such that malicious features fall outside the target class.
- Contrastive Learning Stability: Using contrastive learning with clean visual supervision for trigger inversion proves more stable than traditional gradient-based methods like PGD, which struggle with noisy guidance from initialized prompts.
Key Results
CBPT demonstrates exceptional defense capabilities across seven different attack types, including unimodal and multimodal threats.
- Effectiveness: Average Attack Success Rate (ASR) was reduced to 0.39%, while maintaining a Clean Accuracy (CA) of 58.83%.
- Superiority over SOTA: Against the advanced BadCLIP attack, where CleanCLIP maintained a 94.44% ASR, CBPT successfully dropped the ASR to 0.59%.
- Efficiency: CBPT tunes only ~2.05 million parameters (vs. ~102 million for full fine-tuning) and remains effective even in 1-shot-per-class scenarios.
Limitations and Future Work
CBPT currently requires a clean, labeled dataset, limiting its use in purely unsupervised settings. Additionally, because it assigns unique vectors to specific classes, it is restricted to closed-vocabulary tasks. Future research aims to use automated text analysis to extract labels from captions and explore unified prompts for open-vocabulary generalization.
Summary updated