Abstract
Recently, self-supervised learning (SSL) was shown to be vulnerable to patch-based data poisoning backdoor attacks. It was shown that an adversary can poison a small part of the unlabeled data so that when a victim trains an SSL model on it, the final model will have a back-door that the adversary can exploit. This work aims to defend self-supervised learning against such attacks. We use a three-step defense pipeline, where we first train a model on the poisoned data. In the second step, our proposed defense algorithm (PatchSearch) uses the trained model to search the training data for poisoned samples and removes them from the training set. In the third step, a final model is trained on the cleaned-up training set. Our results show that PatchSearch is an effective defense. As an example, it improves a model's accuracy on images containing the trigger from 38.2% to 63.7% which is very close to the clean model's accuracy, 64.6%. Moreover, we show that PatchSearch outperforms baselines and state-of-the-art defense approaches including those using additional clean, trusted data.
Introduction
Self-supervised learning (SSL) has revolutionized AI by enabling models to learn from vast amounts of unlabeled data. However, this reliance on uncurated datasets introduces a significant security risk: backdoor attacks. In a patch-based poisoning attack, an adversary inserts a small trigger patch into a fraction of the training data. The resulting model learns to associate this trigger with a target representation, allowing the attacker to manipulate model behavior at test time.
Existing defenses often require labeled data or a "trusted" clean subset, which are frequently unavailable in SSL scenarios. This paper introduces PatchSearch, a defense mechanism that operates without any human labels or trusted data by exploiting the representational properties of SSL models.
Methodology: The PatchSearch Pipeline
The defense follows a three-stage process: initial training on potentially poisoned data, poison detection and removal via PatchSearch, and final training on the sanitized dataset.
PatchSearch Algorithm
The core of the defense is the PatchSearch algorithm, which consists of four main components:
- Clustering: SSL models naturally group visually similar images. Poisoned images sharing a trigger tend to form distinct clusters in the representation space.
- Trigger Localization: Using k-means cluster centers as proxy labels, the algorithm applies a modified Grad-CAM to identify the most influential regions in suspicious images, revealing candidate trigger patches.
- Poison Scoring: Candidate patches are "pasted" onto random images. If these modified images are consistently reassigned to the source cluster, the patch is confirmed as a high-scoring trigger.
- Iterative Search: To ensure efficiency, the algorithm iteratively prunes clusters with low poison scores, focusing computational resources on the most likely poisoned samples.
Additionally, the authors propose i-CutMix, an SSL-specific data augmentation that encourages models to focus on global image features rather than local patches, providing an inherent layer of resistance to backdoor triggers.
Experimental Results
The defense was evaluated on ImageNet-100 using various architectures (ResNet-18, ViT-B) and SSL frameworks (MoCo-v2/v3, BYOL, MAE).
As shown in the results, PatchSearch effectively restores model performance. For a ViT-B model trained with MoCo-v3 at a 0.5% poison rate, accuracy on patched data dropped to 46.9% in the backdoored state. PatchSearch restored this to 64.5%, nearly matching the clean model's 64.6%. Furthermore, PatchSearch achieved high recall (up to 99%) and approximately 55% precision in identifying poisoned samples. By using iterative search, the algorithm only required scoring about 6% of the training set to find the vast majority of poisons, demonstrating significant computational efficiency. It consistently outperformed state-of-the-art defenses that utilize up to 25% trusted clean data.
Conclusion
PatchSearch demonstrates that the inherent clustering capabilities of SSL can be leveraged to detect and mitigate backdoor attacks without the need for external labels or trusted datasets. By combining algorithmic data sanitization with robust training techniques like i-CutMix, SSL models can be effectively secured against sophisticated patch-based poisoning.
Summary updated