Abstract
Deep neural networks are vulnerable to backdoor attacks where malicious triggers cause misclassification during inference. Traditional defenses often require access to the original training set or extensive clean data, which is impractical for users of third-party pre-trained models. This paper introduces Test-Time Backdoor Defense (TTBD), a novel framework that detects and mitigates backdoors on-the-fly using only small batches of potentially poisoned test data. TTBD employs a two-stage process: Detection During Pruning (DDP) to identify poisoned samples and Shapley-based neuron estimation to surgically remove malicious components. Experimental results across multiple benchmarks show that TTBD significantly reduces Attack Success Rates (ASR) with minimal impact on standard accuracy.
Introduction
Backdoor attacks pose a significant threat to the security of deep learning deployments. By injecting triggers into training data, attackers can create models that function normally on clean inputs but execute malicious actions when presented with a specific trigger. Most existing defenses are designed for the training or post-training phases, requiring substantial clean datasets. However, in real-world scenarios, a model owner might only have access to a small batch of test data that could itself be partially poisoned. TTBD addresses this challenge by providing a defense mechanism that operates during the inference stage.
Methods
The TTBD framework consists of two primary stages designed to identify and then neutralize the backdoor without requiring the original training data.
-
Stage 1: Detection via DDP (Detection During Pruning): Identifying poisoned samples within a test batch is the first critical step. TTBD introduces DDP, which utilizes the observation that poisoned and clean samples exhibit distinct behaviors when model neurons are pruned. By calculating a Prediction Change Score (PCS), the system measures output fluctuations during pruning. Poisoned samples, which often rely on a specific, overfitted set of neurons, show higher sensitivity to pruning than clean samples, allowing for accurate detection.
-
Stage 2: Repair via Shapley Estimation: After detection, the model is "repaired" by removing malicious neurons. TTBD employs Shapley values from cooperative game theory to quantify the contribution of each neuron to the Attack Success Rate (ASR) versus standard Accuracy (ACC). This allows for surgical pruning of neurons that primarily serve the backdoor while preserving those essential for general task performance.
Experimental Evaluation
The authors evaluated TTBD against seven backdoor attacks (e.g., BadNets, Blended, WaNet) using computer vision benchmarks including CIFAR-10, CIFAR-100, and Tiny-ImageNet. The defense was tested on various architectures like PreAct-ResNet18, VGG19, and DenseNet161 to ensure broad applicability.
Results and Discussion
TTBD demonstrated high efficacy in neutralizing backdoors across different settings. On the CIFAR-10 benchmark using ResNet18, the TTBD-DDP variant reduced the average ASR from 88.18% to 2.32%, significantly outperforming baseline methods like Fine Pruning (FP) and Adversarial Neuron Pruning (ANP).
Crucially, this defense is achieved with only a minor reduction in clean data accuracy (approximately 2.6%). Furthermore, TTBD proved to be architecture-agnostic, maintaining effectiveness on models like VGG19 where previous detectors often failed due to the lack of batch normalization layers.
Conclusion and Future Work
TTBD provides a robust solution for defending deployed models against backdoor attacks at test time. By combining pruning-based detection with game-theoretic neuron estimation, it offers a precise and efficient way to "clean" compromised models. While the computational cost of Shapley estimation remains a challenge for real-time applications, TTBD represents a significant step forward in practical backdoor defense. Future work will focus on optimizing the speed of neuron localization for real-time deployment.
Summary updated