Abstract
Contrastive Language-Image Pretraining (CLIP) models are highly vulnerable to backdoor attacks, requiring as little as 0.01% poisoned training data to compromise the model. This paper reveals that backdoor samples in CLIP exhibit uniquely sparse local neighborhoods in their representation space, making them easily detectable using traditional local outlier detection algorithms. By applying simple density-based detectors like $k$-dist and Simplified Local Outlier Factor (SLOF), practitioners can efficiently clean million-scale web datasets in minutes and even uncover unintentional backdoors hiding in popular open-source datasets.
Introduction
Modern vision-language models are typically pre-trained using CLIP on massive, uncurated datasets scraped from the web. Because dataset curators often only maintain lists of URLs, an attacker can easily poison the data—for example, by purchasing expired domains and replacing images with backdoored ones. Recent studies show CLIP is incredibly fragile: poisoning just 0.01% of the training data is enough to successfully implant a backdoor. Unfortunately, existing backdoor detection methods designed for supervised learning are often computationally prohibitive for web-scale data, leaving a massive security gap for model developers.
Methodology
The authors take a representation-space approach to identify poisoned data. Because CLIP uses contrastive learning to pull similar features together, backdoor triggers (which are strong, consistent visual signals) cause poisoned samples to cluster in specific regions of the embedding space. However, due to the low poisoning rate, these clusters are incredibly sparse compared to the dense regions of clean data.
The authors exploit this sparsity by applying traditional local outlier detection metrics to the learned embeddings:
- $k$-dist: The distance to a sample's $k$-th nearest neighbor.
- Simplified Local Outlier Factor (SLOF): A density ratio comparing a point's neighborhood density to its neighbors' densities.
- Dimensionality-Aware Outlier Detection (DAO): An extension of SLOF that accounts for local intrinsic dimensionality.
Key Insights and Ideas
- Sparsity is the Attacker's Weakness: In a random batch of data, a poisoned sample is likely the only one of its kind. Therefore, its $k$-th nearest neighbor is almost certainly a clean sample located far away in the embedding space. This makes the backdoor sample an obvious local outlier.
- Old Tools Beat New Tricks: Classic data mining techniques (like $k$-dist and SLOF) drastically outperform state-of-the-art, deep-learning-specific backdoor defenses and are orders of magnitude faster.
- Natural Backdoors in the Wild: While testing their detector, the authors found an unintentional "natural" backdoor in the CC3M dataset. A specific "birthday cake" image appeared nearly 800 times with the exact same caption, successfully acting as a backdoor trigger on pre-trained OpenCLIP models.
Key Results
Local outlier methods (k-dist, SLOF, DAO) consistently achieved 97% to 99.9% AUC across 9 different trigger types and multiple multi-trigger settings. By filtering out the top 10% of data based on DAO outlier scores, the Attack Success Rate (ASR) dropped from ~100% to less than 1%. Notably, removing this data had virtually zero negative impact on the model's clean zero-shot accuracy.
The proposed detection pipeline is highly scalable, capable of cleaning a million-scale dataset (like CC3M) in just 15 minutes using 4 Nvidia A100 GPUs. It also remains robust against adaptive attacks where the attacker attempts to regularize the outlier score during training.
Limitations and Future Work
The method's sensitivity may decrease if an attacker poisons a much larger fraction of the dataset (e.g., >5%), though this can be mitigated by increasing the neighborhood size $k$. Future work could integrate this fast detection step with robust training strategies like SafeCLIP to train safely on both purified and risky subsets, potentially recovering useful features from noisy data.
Summary updated