Defending Against Backdoor Attacks by Layer-wise Feature Analysis

Najeeb Moharram Jebreel, Josep Domingo-Ferrer, Yiming Li

Introduction

As the computational cost of training state-of-the-art deep learning models continues to rise, many organizations have turned to outsourcing training to cloud providers or utilizing pre-trained models from public repositories. This shift has introduced a significant security vulnerability known as the "backdoor attack." In such an attack, an adversary poisons a small fraction of the training data with a specific trigger—such as a small pixel pattern—and labels these samples with a target class. The resulting model behaves normally on clean inputs but misclassifies any input containing the trigger into the attacker's chosen category.

Existing defenses often attempt to detect these poisoned samples by analyzing the final layer of the network's feature extractor. However, this paper argues that by the time features reach the final layer, the network has already merged the representations of benign and poisoned samples, making them indistinguishable. This research introduces DBALFA (Defending Against Backdoor Attacks by Layer-wise Feature Analysis), a novel defense that identifies a "critical layer" within the network where the distinction between clean and poisoned data is most pronounced.

Methodology: The DBALFA Framework

The core insight of DBALFA is that the "spectral signatures" of backdoor attacks are most visible at an intermediate stage of the network, rather than at the end. The framework consists of three primary components: locating the Layer of Interest (LOI), calculating cosine similarity, and implementing a multi-layer firewall.

1. Locating the Layer of Interest (LOI)

To find the optimal layer for detection, the authors use a small set of clean validation images. They track how these samples align with their true class centroids as they propagate through the network. The researchers observed that benign samples typically experience a sharp "jump" in alignment toward their class centroid at a specific point—the LOI. This is the critical juncture where the network effectively decides the object's identity. Poisoned samples, conversely, are "dragged" toward the target class by the trigger, but their underlying features remain alienated from the class centroid until the very final layers.

2. Cosine Similarity Filtering

While many defenses focus on the magnitude of neuron activations, DBALFA focuses on the direction of the feature vectors. By calculating the average feature vector (centroid) for each class at the LOI using clean data, the system can measure how well a new input aligns with the expected features of its predicted class. The authors found that cosine similarity is a far more reliable indicator of a backdoor than Euclidean distance, as it is less susceptible to the noise inherent in high-dimensional activation magnitudes.

3. The Multi-Layer Firewall

To increase robustness, the defense does not rely on a single layer. Instead, it measures the sum of cosine similarities across the LOI and the two layers immediately preceding it. If the cumulative similarity score for a sample is significantly lower than the average for benign samples (falling below a specific threshold $\tau$), the system flags the input as a backdoor attempt and blocks it.

Experimental Evaluation

The researchers evaluated DBALFA against six different types of attacks, ranging from traditional pixel-patch attacks (BadNets) to more sophisticated "invisible" attacks like WaNet (which uses image warping) and ISSBA (which uses frequency-domain triggers). The defense was tested on two benchmark datasets:

  • CIFAR-10: A standard dataset for image classification research.
  • GTSRB (German Traffic Sign Recognition Benchmark): A real-world dataset critical for autonomous driving security.

Performance Results

DBALFA demonstrated superior performance compared to existing baselines like Activation Clustering and SCAn:

  • Detection Accuracy: On CIFAR-10, the method achieved an average True Positive Rate (TPR) of 98.09% with a False Positive Rate (FPR) of only 1.34%.
  • Reliability: On the GTSRB dataset, where several baseline defenses failed to detect certain sophisticated attacks entirely, DBALFA maintained a 100% TPR.
  • Efficiency: Because the defense only requires analyzing three specific layers and does not involve retraining or complex statistical modeling, it is computationally efficient and suitable for real-time deployment.

Discussion and Limitations

A key finding of this research is the "Last Layer Fallacy." By demonstrating that the strongest poison signatures exist earlier in the network, the authors provide a new direction for backdoor defense research. Furthermore, the defense proved robust against "adaptive attackers." Even when an attacker attempted to force poisoned features to mimic benign features at the LOI, the resulting model's overall accuracy dropped so significantly that the attack became impractical.

However, the method does have requirements and limitations. It necessitates a small set of known-clean samples (approximately 10% of a typical test set) to establish the benign baseline. Additionally, while highly effective for image classification, further research is needed to determine if similar "critical layers" exist in models for Natural Language Processing (NLP) or audio analysis.

Conclusion

DBALFA offers a simple yet powerful mechanism for securing deep learning models against supply chain attacks. By shifting the focus from the final output to the intermediate "critical layers" where feature alignment occurs, this method provides a high-performance filter that can stop poisoned inputs without the need for expensive model retraining.

Summary updated

BibTeX
@inproceedings{jebreel2024defending,
  author = {Najeeb Moharram Jebreel and Josep Domingo-Ferrer and Yiming Li},
  title = {{Defending Against Backdoor Attacks by Layer-wise Feature Analysis}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=RfwxV4TmCF},
}
Figure