Unified Neural Backdoor Removal with Only Few Clean Samples through Unlearning and Relearning

Nay Myat Min, Long H. Pham, Jun Sun

TL;DR

The paper introduces ULRL (UnLearn and ReLearn), a highly data-efficient defense mechanism that removes malicious backdoors from Deep Neural Networks (DNNs) using as little as 1% clean data. By intentionally maximizing loss to expose compromised neurons and then recalibrating them using a novel cosine similarity regularization, ULRL effectively neutralizes backdoor triggers without sacrificing the model's accuracy on legitimate data.

What Problem Does This Paper Address?

Deep neural networks are incredibly powerful, but they suffer from a dangerous security vulnerability: backdoor attacks. During training, an attacker can covertly inject a hidden trigger (like a small pixel pattern or a specific semantic feature) into the dataset. The resulting model behaves perfectly normally on clean data, but when it encounters the trigger, it reliably misclassifies the input to a target malicious class.

Defending against these attacks post-training is notoriously difficult. Existing mitigation strategies usually require large amounts of clean data, demand massive computational resources, or severely degrade the model's performance on normal tasks (Clean Accuracy). The authors address this critical gap by designing a defense that is lightweight, requires minimal clean data, and precisely targets only the compromised neurons.

Methods

ULRL breaks away from traditional defense paradigms by introducing a distinct two-phase framework: Unlearning and Relearning.

Fig. 1. Overview of our proposed ULRL method. (1) A DNN model with embedded backdoors. (2) Unlearning by maximizing loss to identify suspicious neurons, applying MAD thresholds for aggregated weight changes, and Relearning by reinitialization and fine-tuning neuron weights with regularization, ensuring divergence from compromised states. (3) Purified model.

Phase 1: Unlearning (Diagnosis)

Instead of training the model to perform better, the authors counterintuitively force the model to perform worse. Using a tiny subset of clean data (typically 1%), they apply gradient ascent to maximize the classification loss.

Because backdoor-related neurons are uniquely adapted to recognize malicious triggers, they react differently to this sudden "unlearning" process compared to benign neurons. By tracking the absolute weight changes ($\Delta w$) in the final classifier layer and applying a robust statistical metric—Median Absolute Deviation (MAD)—the defense flags the extreme outliers as suspicious backdoor neurons.

Fig. 2. Details of Unlearning

Phase 2: Relearning (Recalibration)

Once the suspicious neurons are isolated, their weights are reset using standard He initialization. The model is then fine-tuned on the clean data. Crucially, the authors introduce a cosine similarity regularization term into the loss function. This term forces the weights of the suspicious neurons to actively diverge from their original, compromised orientations.

Fig. 4. Details of Relearning

Datasets

The authors rigorously evaluated ULRL across four widely recognized computer vision benchmarks:

  • CIFAR-10 and CIFAR-100 (Object classification)
  • GTSRB (German Traffic Sign Recognition Benchmark)
  • Tiny-ImageNet (Large-scale image classification subset)

They tested these datasets against 12 different backdoor attack types (including BadNets, Blended, WaNet, and even triggerless Semantic attacks) across multiple architectures like PreAct-ResNet18, VGG19-BN, and the Vision Transformer (ViT-B-16).

Key Insights and Ideas

  • Unlearning as a Diagnostic Tool: Intentionally destroying a model's accuracy is a highly effective way to expose hidden vulnerabilities. Backdoor neurons show pronounced malleability during clean data unlearning because the backdoor task was trained on significantly fewer samples than the primary task.
  • Orientation Over Magnitude: Traditional defenses often regularize weight magnitude (e.g., using inner products). However, this paper demonstrates that backdoor features primarily alter the orientation of weight vectors. Minimizing cosine similarity allows the defense to steer neurons away from malicious configurations without destroying the underlying feature representations needed for clean accuracy.
  • Precision Targeting: Rather than resetting the entire classifier layer (which discards valuable learned features), ULRL precisely surgically alters only the top 1-2 flagged neurons, minimizing the side effects on benign performance.
Fig. 3. Neuron Weight Distribution Comparison

Key Results

  • Massive Backdoor Reduction: ULRL achieved an average Attack Success Rate (ASR) reduction of 94.94% for PreAct-ResNet18 and 90.46% for VGG19-BN, often bringing the backdoor success rate down to near 0%.
  • Performance Preservation: Clean Accuracy (C-ACC) remained stable, even showing a slight average increase of 1.61% on PreAct-ResNet18 architectures.
  • Data & Time Efficiency: The defense remains highly effective using just 1% clean data and runs in under 3 minutes on a standard NVIDIA RTX 3090 GPU for most datasets, significantly outperforming state-of-the-art baselines like Fine-pruning, I-BAU, ANP, RNP, and FST.
  • ViT Robustness: On Vision Transformers (ViT-B-16), ULRL successfully dropped the average ASR from 94.06% to a mere 0.55%.

Limitations and Future Work

While highly effective, ULRL's performance begins to degrade if the clean defense dataset drops below 0.5%, as it becomes harder to statistically isolate the backdoor neurons. Additionally, if an attacker distributes a backdoor across an exceptionally large number of neurons, the MAD thresholding technique might miss some of them.

The authors note that future work will focus on scaling ULRL to other network modalities (like NLP models) and exploring completely data-free backdoor removal settings.

Summary updated

BibTeX
@article{min2024unified,
  author = {Nay Myat Min and Long H. Pham and Jun Sun},
  title = {{Unified Neural Backdoor Removal with Only Few Clean Samples through Unlearning and Relearning}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2024},
  url = {https://openreview.net/forum?id=mf4OAfOPCg},
}
Figure