One-shot Neural Backdoor Erasing via Adversarial Weight Masking

Shuwen Chai, Jinghui Chen

Abstract

Deep Neural Networks (DNNs) are vulnerable to backdoor attacks, where an adversary injects malicious triggers into the training data to manipulate model behavior at inference time. While several purification methods exist, they typically require significant amounts of clean training data to be effective. This paper introduces Adversarial Weight Masking (AWM), a novel defense mechanism designed to erase backdoors even in extreme "one-shot" scenarios where only a single clean image per class is available. By formulating backdoor removal as a min-max optimization problem, AWM recovers surrogate triggers and applies fine-grained soft masks to sensitive weights, preserving model utility while neutralizing the threat.

Introduction

The widespread practice of training Deep Neural Networks (DNNs) on massive, often uncurated datasets or outsourcing training to third-party platforms has introduced significant security risks. Chief among these is the backdoor attack, where a model is trained to function normally on clean inputs but produce a specific, incorrect output when a "trigger" pattern is present.

Defending against such attacks usually involves "purifying" the model. However, state-of-the-art defenses like Adversarial Neuron Pruning (ANP) often require substantial clean data to distinguish between malicious and benign features. In many practical scenarios, a defender may only have access to a very small set of clean samples. In these low-data or "one-shot" regimes, traditional defenses often fail, either leaving the backdoor intact or severely degrading the model's accuracy on legitimate tasks.

Methodology: Adversarial Weight Masking (AWM)

To address the limitations of coarse-grained neuron pruning, we propose Adversarial Weight Masking (AWM). AWM operates on the premise that backdoors can be identified and suppressed by analyzing the model's sensitivity to adversarial perturbations. The method employs a min-max optimization framework consisting of two interleaved processes.

1. Adversarial Trigger Recovery (The Inner Loop)

Since the defender does not know the specific trigger used by the attacker, AWM attempts to synthesize a surrogate. The inner loop searches for a universal adversarial perturbation ($\Delta$) that, when added to the small set of clean images, maximizes the model's loss or induces misclassification. This recovered pattern acts as a stand-in for the hidden backdoor trigger.

2. Soft Weight Masking (The Outer Loop)

Once a potential trigger is identified, the outer loop seeks to neutralize it. Unlike pruning methods that remove entire neurons—a "blunt" approach that often destroys useful features—AWM applies a soft mask ($m$) to individual weights. The optimization objective for the mask is three-fold:

  • Utility Preservation: Minimize the loss on the available clean data to maintain standard accuracy.
  • Backdoor Erasure: Minimize the model's sensitivity to the recovered surrogate trigger.
  • Sparsity: Use $L_1$ regularization to ensure that only the weights most critical to the backdoor behavior are suppressed.

This weight-level granularity allows AWM to be much more surgical than previous methods, especially in compact architectures like MobileNet or ShuffleNet where every neuron is vital for performance.

Experimental Evaluation

The effectiveness of AWM was evaluated against a diverse array of attacks, including BadNets, Trojan-SQ, WaNet, and various inversion attacks ($l_0, l_2$). Testing was conducted on the CIFAR-10 and GTSRB (German Traffic Sign Recognition Benchmark) datasets across multiple architectures, including ResNet-18, VGG, ShuffleNet V2, and MobileNet V2.

Performance in the One-Shot Regime

The most significant finding is AWM's robustness in the "one-shot" setting (e.g., 10 images total for CIFAR-10). While competing methods like IBAU or ANP saw their performance collapse—often failing to reduce the Attack Success Rate (ASR) or causing a massive drop in clean accuracy—AWM remained stable. For instance, on a BadNets-infected CIFAR-10 model with only 100 clean images, AWM reduced the ASR from 97.9% to 11.1% while maintaining a clean accuracy of 83.5%.

Discussion and Insights

AWM highlights the "over-killing" problem inherent in neuron-level defenses. In smaller networks, neurons often represent overlapping features; pruning a "backdoored" neuron frequently removes "robust" features necessary for clean classification. By moving to the weight level, AWM provides the fine-grained control necessary to decouple malicious triggers from benign functionality.

Furthermore, the success of AWM demonstrates that exact trigger recovery is not necessary for effective defense. By finding any pattern that the model is overly sensitive to, the defense can identify the underlying weights that facilitate the backdoor.

Conclusion and Future Work

Adversarial Weight Masking represents a significant step forward in making backdoor defenses practical for real-world scenarios where clean data is scarce. While AWM currently requires at least one image per class, future research could explore truly data-free defenses. Additionally, investigating the sensitivity of different network layers to masking could lead to more computationally efficient implementations. As attackers develop more sophisticated, adaptive triggers, the surgical precision of weight-level masking will likely remain a cornerstone of robust DNN defense.

Summary updated

Abstract

Recent studies show that despite achieving high accuracy on a number of real-world applications, deep neural networks (DNNs) can be backdoored: by injecting triggered data samples into the training dataset, the adversary can mislead the trained model into classifying any test data to the target class as long as the trigger pattern is presented. To nullify such backdoor threats, various methods have been proposed. Particularly, a line of research aims to purify the potentially compromised model. However, one major limitation of this line of work is the requirement to access sufficient original training data: the purifying performance is a lot worse when the available training data is limited. In this work, we propose Adversarial Weight Masking (AWM), a novel method capable of erasing the neural backdoors even in the one-shot setting. The key idea behind our method is to formulate this into a min-max optimization problem: first, adversarially recover the trigger patterns and then (soft) mask the network weights that are sensitive to the recovered patterns. Comprehensive evaluations of several benchmark datasets suggest that AWM can largely improve the purifying effects over other state-of-the-art methods on various available training dataset sizes.
BibTeX
@inproceedings{chai2022one,
  author = {Shuwen Chai and Jinghui Chen},
  title = {{One-shot Neural Backdoor Erasing via Adversarial Weight Masking}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=adOUi4D1LY},
}
Figure