Rethinking the Necessity of Labels in Backdoor Removal

Zidi Xiong, Dongxian Wu, Yifei Wang, Yisen WangBANDS @ ICLR 2023

TL;DR

This paper introduces Contrastive Backdoor Defense (CBD), a novel method to remove backdoor attacks from pre-trained neural network backbones using only unlabeled data. By leveraging unsupervised contrastive learning to identify and then neutralize backdoor triggers, CBD offers a practical solution for securely deploying readily available pre-trained models without the need for costly data labeling.

What Problem Does This Paper Address?

The widespread practice of using pre-trained deep learning models (backbones) from third-party sources offers significant convenience by saving computational resources and training time. However, these pre-trained models can be vulnerable to "backdoor attacks." In such attacks, a model is subtly manipulated during its training so that it behaves normally on clean data but misclassifies inputs containing a specific, often imperceptible, "trigger." This poses a serious security risk when these backdoors are deployed in downstream applications.

Existing methods for removing these backdoors typically require access to clean, labeled data. This presents a significant hurdle, as obtaining such labeled data can be expensive and time-consuming, especially when the pre-trained backbone might not even have a classifier head (e.g., in self-supervised learning models). This paper addresses this gap by proposing a method that can effectively remove backdoors from both supervised and self-supervised pre-trained backbones using only unlabeled data.

Methods

The core of the proposed method, Contrastive Backdoor Defense (CBD), lies in its ability to identify and neutralize backdoor triggers without relying on labels. The authors achieve this through a three-pronged approach:

  1. Discovering Backdoor Features with Unsupervised Contrastive Loss: The key insight is to use contrastive learning to probe the feature space. By creating adversarial examples that maximize the difference between an augmented view of an image and a perturbed version of another augmented view, the method aims to mimic the behavior of backdoored examples. This is achieved by crafting adversarial perturbations using PGD (Projected Gradient Descent) that push features apart in the contrastive loss landscape. The paper visualizes how these adversarial examples (grey circles) tend to cluster around the regions occupied by actual backdoor examples (black circles) in the t-SNE feature space.
  2. Backdoor-to-Standard Pulling: Once these "mimicked" backdoored examples are generated, the goal is to "pull" them back towards their benign counterparts. This is done by aligning the features of these adversarial examples with the features of clean, unperturbed versions of the same images. This step effectively mitigates the backdoor's influence by making the features of triggered inputs more similar to those of clean inputs.
  3. Embedding Distillation and Standard Fine-tuning: To ensure the purified backbone retains its utility on clean data, two additional steps are incorporated. Embedding Distillation uses the original backdoored model as a "teacher" to guide the purified "student" model, preserving the representation of benign features. Standard Fine-tuning then further aligns the features of clean augmented samples, similar to standard contrastive learning practices, to maintain overall performance. The final loss is a weighted combination of these three components.

Datasets

The experiments were conducted on the following datasets:

  • CIFAR-10: A widely used benchmark for image classification.
  • ImageNet-100: A subset of ImageNet, offering a more complex dataset.

The models used were ResNet-18 backbones trained using both supervised learning and self-supervised learning (specifically SimCLR).

Key Insights and Ideas

  • Backdoors Manifest as Feature Space Anomalies: The paper demonstrates that backdoor attacks create distinct clusters or anomalies in the feature space, even in self-supervised models where explicit class labels are absent. This observation is crucial for developing label-free detection methods.
  • Contrastive Learning as a Backdoor Detector: Unsupervised contrastive loss can be effectively used to generate adversarial examples that mimic backdoored inputs, allowing for the identification of backdoor behavior without labels.
  • Adversarial Mimicry for Defense: The core idea of using contrastive adversarial examples to "evoke" backdoor behavior and then "erase" it by aligning features is a novel approach to backdoor removal.
  • Label-Free Defense is Achievable: The most significant insight is that effective backdoor removal can be achieved without the need for clean labeled data, overcoming a major practical limitation of existing methods.

Key Results

  • Comparable or Superior Performance: CBD achieved comparable or even better defense performance than existing label-dependent methods on CIFAR-10 and ImageNet-100, across various backdoor attacks (BadNets, Blend, SIG, WaNet).
  • High Clean Accuracy Retention: The method successfully purified backdoored models while maintaining high clean accuracy, with performance drops typically less than 5%.
  • Effective on Both Supervised and Self-Supervised Backbones: CBD demonstrated its effectiveness on both types of pre-trained backbones, highlighting its versatility.
  • Object Detection Utility: A case study on object detection showed that CBD could mitigate backdoor effects and improve patched average precision even in complex downstream tasks.

Limitations and Future Work

  • Hyperparameter Tuning: The performance of CBD relies on the careful selection of hyper-parameters (λ₁, λ₂, λ₃) for the different loss components. While the paper provides default settings and ablation studies, optimal tuning might still be required for specific scenarios.
  • Adversarial Example Generation Cost: Generating contrastive adversarial examples can be computationally intensive, especially for self-supervised backbones which require more steps.
  • Future Work: The authors suggest that adjusting loss weights or exploring different adversarial strategies could further enhance performance. They also hint at the potential for applying these techniques to other downstream tasks beyond object detection. The paper also notes that while their default settings are good, further research could explore more optimal adversarial settings.

Summary updated

BibTeX
@inproceedings{xiong2023rethinking,
  author = {Zidi Xiong and Dongxian Wu and Yifei Wang and Yisen Wang},
  title = {{Rethinking the Necessity of Labels in Backdoor Removal}},
  booktitle = {BANDS @ ICLR},
  year = {2023},
  url = {https://openreview.net/forum?id=Noj1Fydegod},
}
Figure