Source-linked AI summary
CleanerCLIP: Fine-grained Counterfactual Semantic Augmentation for Backdoor Defense in Contrastive Learning
Yuan Xun, Siyuan Liang, Xiaojun Jia, Xinwei Liu, Xiaochun Cao
TL;DR
Backdoor attacks threaten pretrained multimodal contrastive models, and existing fine-tuning defenses can struggle against covert attacks such as BadCLIP. CleanerCLIP uses fine-grained positive and negative subtext augmentation during fine-tuning. The authors report stronger defense across datasets and attacks while maintaining benign accuracy, including a large Top-1 ASR reduction against BadNet.
Problem
Pretrained multimodal contrastive models are vulnerable to backdoor attacks, and CleanCLIP can be inadequate against covert attacks such as BadCLIP.
Source: §1 · pp. 1–2Method
CleanerCLIP fine-tunes with positive and negative counterfactual subtexts to disrupt trigger-target semantic links while preserving clean-text meaning.
Source: §1 · p. 2Results
91.28% to 0.45% Top-1 ASR against BadNet; CleanerCLIP achieves superior defense across datasets and attack scenarios while maintaining benign accuracy.
Source: §4.2 · p. 7, §5 · p. 9Takeaways & Limitations
The authors present CleanerCLIP as a lightweight fine-tuning defense that reduces attack success while maintaining benign accuracy and usability.
Source: §1 · p. 2CleanerCLIP primarily addresses image-modality backdoor attacks, so its performance against text-modality attacks remains unknown.
Source: §5 · p. 9
Abstract
from arXiv · showhide
Pre-trained large models for multimodal contrastive learning, such as CLIP, have been widely recognized in the industry as highly susceptible to data-poisoned backdoor attacks. This poses significant risks to downstream model training. In response to such potential threats, finetuning offers a simpler and more efficient defense choice compared to retraining large models with augmented data. In the supervised learning domain, fine-tuning defense strategies can achieve excellent defense performance. However, in the unsupervised and semi-supervised domain, we find that when CLIP faces some complex attack techniques, the existing fine-tuning defense strategy, CleanCLIP, has some limitations on defense performance. The synonym substitution of its text-augmentation is insufficient to enhance the text feature space. To compensate for this weakness, we improve it by proposing a fine-grained \textbf{T}ext \textbf{A}lignment \textbf{C}leaner (TA-Cleaner) to cut off feature connections of backdoor triggers. We randomly select a few samples for positive and negative subtext generation at each epoch of CleanCLIP, and align the subtexts to the images to strengthen the text self-supervision. We evaluate the effectiveness of our TA-Cleaner against six attack algorithms and conduct comprehensive zero-shot classification tests on ImageNet1K. Our experimental results demonstrate that TA-Cleaner achieves state-of-the-art defensiveness among finetuning-based defense techniques. Even when faced with the novel attack technique BadCLIP, our TA-Cleaner outperforms CleanCLIP by reducing the ASR of Top-1 and Top-10 by 52.02\% and 63.88\%, respectively.
1. Introduction
Pre-trained multimodal contrastive models are vulnerable to backdoor attacks, while users who fine-tune downloaded models need defenses that work at that stage. CleanerCLIP responds to CleanCLIP’s weakness against covert attacks with positive and negative counterfactual subtexts; the authors report reduced attack success while retaining benign accuracy and usability.
1. Introduction
- Downloaded pre-trained models may carry unknown security risks, making lightweight defenses applied during fine-tuning important.Existing defenses primarily target pretraining, while users often download and fine-tune models for personalized applications.Source: §1 · p. 1
- CleanCLIP’s self-supervised defenses can fail against BadCLIP, which exploits hidden toxic features in the clean feature space.Traditional attacks create detectable pseudo-semantic clusters, whereas BadCLIP targets true feature regions without creating them.Source: §1 · p. 2
- CleanerCLIP augments fine-tuning with positive and negative subtexts to disrupt the semantic link between a trigger and its target.Negative subtexts alter semantic components, while positive subtexts preserve essential meaning for processing clean data.Source: §1 · p. 2
- Across six attack techniques, the authors report reduced attack success rates while maintaining benign accuracy and usability.The paper presents CleanerCLIP as a lightweight fine-tuning defense strategy.Source: §1 · p. 2
2. Related work and preliminaries
The paper reviews CLIP’s shared image-text representation and the backdoor risks of multimodal contrastive learning. It distinguishes fine-tuning defenses from retraining approaches and positions CleanCLIP as a relevant fine-tuning baseline.
2. Related work and preliminaries
- CLIP maps images and text into a shared feature space and learns by bringing matching pairs closer while separating mismatched pairs.Its image and text encoders are trained on large-scale internet image-text pairs.Source: §2 · pp. 2–3
- Backdoor attacks associate trigger patterns with malicious behavior, and CLIP attacks can poison image-text pairs to establish that association.Prior work reported a successful CLIP attack using 0.01% poisoned data.Source: §2 · p. 3
- Fine-tuning defenses address attacks on existing pretrained models when defenders cannot access the original poisoned training set.The paper contrasts this setting with full retraining using augmented data, as in RoCLIP.Source: §2 · p. 3
- CleanCLIP fine-tunes on clean data using a self-supervised loss based on multimodal data augmentation to reduce backdoor effects.The paper identifies CleanCLIP as a representative defense for the fine-tuning phase.Source: §2 · p. 3
3. Methodology
CleanerCLIP is designed for a fine-tuning threat setting and uses factual and counterfactual sub-captions to strengthen text-side self-supervision. It selectively augments samples and combines the existing CleanCLIP loss with a positive-negative loss.
3.1. Threat model
- The threat model allows an attacker to inject a small number of poisoned samples or fine-tune and distribute a poisoned pretrained model, while the defender has clean fine-tuning data.The attacker is assumed to know the model structure, training algorithm, and victim hyperparameters but cannot directly modify the training process.Source: §3.1 · p. 3
3.2. Counterfactual Text Augmentation
- CleanerCLIP generates factual positive and counterfactual negative sub-captions, randomly selecting a counterfactual strategy and augmenting only a small sample subset each epoch.The selective augmentation is described as limiting computational overhead.Source: §3.2 · pp. 3–4, Figure 2 · p. 4
- Factual sub-captions retain key nouns and relational verbs while simplifying or omitting adjectives to preserve the original caption’s core meaning.For very simple captions, the method may retain only the most critical word.Source: §3.2 · p. 4
- Counterfactual sub-captions randomly replace subject or object adjectives, relational verbs, or nouns to disrupt trigger-target binding.The method selects one of these replacement types for each sample.Source: §3.2 · p. 4
3.3. CleanerCLIP: Fine-grained Counterfactual Semantic Finetuning
- Augmenting only K randomly selected samples is intended to preserve clean image-text alignment and downstream generalization while reducing added computation.The paper avoids applying fine-grained augmentation to the whole dataset because it may lower downstream zero-shot accuracy.Source: §3.3 · p. 5
- The positive-negative loss uses image-to-text and text-to-image terms to jointly optimize consistency in the multimodal embedding space.Positive and negative sample temperatures affect similarity-score sensitivity, and the complete objective weights this loss alongside the CleanCLIP loss.Source: §3.3 · p. 5
4. Experiments
CleanerCLIP is evaluated against six backdoor attacks using ImageNet1K zero-shot classification and linear probing, with ablations of its loss weight, temperatures, and sample count. It reduces attack success while maintaining benign accuracy and transfer performance.
4.1. Setup
- Experiments use OpenAI CLIP fine-tuned on CC500K; six poisoned models are evaluated with Top-k BA/ASR on ImageNet1K zero-shot classification and linear probing.The paper notes that prior CLIP backdoor defenses had not reported Top-k metrics.Source: §4.1 · pp. 5–6, §4.2 · p. 6
4.2. CleanerCLIP performance
- 71.75% lower BadCLIP ASR relative to the victim model at Top-10; CleanCLIP’s Top-10 ASR is 91.96%.CleanerCLIP also achieves near-zero Top-1 ASR against BadNet and WaNet: 0.45% and 0.15%, respectively.Source: Table 1 · p. 6, §4.2 · p. 7
- CleanerCLIP reduces Top-1 ASR against BadNet from 91.28% to 0.45% and against WaNet from 91.83% to 0.15%.The reported zero-shot results compare CleanerCLIP with the victim model and evaluate six attack methods using Top-k BA and ASR.Source: §4.2 · pp. 6–7
- CleanerCLIP retains almost the same benign accuracies as CleanCLIP and produces comparable linear-probe results across datasets.The authors report reduced ASR without compromising performance and transferability in the linear-probe evaluation.Source: §4.2 · p. 7
- CleanerCLIP often reduces ASR within the first defense epoch and converges more steadily than CleanCLIP on BadNet, SIG, and BadCLIP.The authors attribute the faster defense to fine-tuning with a few thousand additional samples.Source: §4.2 · p. 7, Figure 3 · p. 8
4.3. Analysis
- Adding positive and negative sub-samples through lossp−n improves defense over CleanCLIP without compromising clean-sample performance; increasing β/α further improves defense.The weight ablation sets α to 1 and varies β.Source: §4.3 · p. 7
- When tp exceeds tn, negative samples receive less attention and defense worsens; the study adopts tp = tn = 0.3 as its default.The authors report minimal impact on BA when tp = 0.3.Source: §4.3 · p. 8
- Fifty samples suffice for BadNet, while 2,000–3,000 are needed for BadCLIP; increasing negative samples reduces ASR without notably affecting BA.These sample counts are small relative to the 500K fine-tuning dataset.Source: §4.3 · p. 8
5. Conclusion and limitation
CleanerCLIP is a fine-tuning defense for backdoor attacks in multimodal contrastive learning that reduces attack success rates while maintaining benign accuracy. Its defense scope is primarily image-modality attacks; performance against text-modality attacks remains unknown.
Related papers
This paper cites
- Learning Transferable Visual Models From Natural Language Supervision2021
- A Simple Framework for Contrastive Learning of Visual Representations2020
- Supervised Contrastive Learning2020
- Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoning2017
- EVA-CLIP: Improved Training Techniques for CLIP at Scale2023