Abstract
While Deep Neural Networks (DNNs) excel in many tasks, the huge training resources they require become an obstacle for practitioners to develop their own models. It has become common to collect data from the Internet or hire a third party to train models. Unfortunately, recent studies have shown that these operations provide a viable pathway for maliciously injecting hidden backdoors into DNNs. Several defense methods have been developed to detect malicious samples, with the common assumption that the latent representations of benign and malicious samples extracted by the infected model exhibit different distributions. However, a comprehensive study on the distributional differences is missing. In this paper, we investigate such differences thoroughly via answering three questions: 1) What are the characteristics of the distributional differences? 2) How can they be effectively reduced? 3) What impact does this reduction have on difference-based defense methods? First, the distributional differences of multi-level representations on the regularly trained backdoored models are verified to be significant by introducing Maximum Mean Discrepancy (MMD), Energy Distance (ED), and Sliced Wasserstein Distance (SWD) as the metrics. Then, ML-MMDR, a difference reduction method that adds multi-level MMD regularization into the loss, is proposed, and its effectiveness is testified on three typical difference-based defense methods. Across all the experimental settings, the F1 scores of these methods drop from 90%-100% on the regularly trained backdoored models to 60%-70% on the models trained with ML-MMDR. These results indicate that the proposed MMD regularization can enhance the stealthiness of existing backdoor attack methods.
Introduction
Backdoor (or Trojan) attacks represent a significant security threat in modern machine learning workflows, particularly when training is outsourced or data is sourced from untrusted third parties. In a typical backdoor attack, a model is trained to behave normally on clean inputs but to misclassify inputs containing a specific "trigger" (such as a small pixel pattern) into a target class.
Current state-of-the-art defenses, such as Activation Clustering (AC) and Spectral Signatures (SS), operate on the premise that malicious inputs, despite achieving the target classification, leave distinct traces in the model's internal latent representations. These defenses attempt to identify clusters or statistical anomalies in hidden layers to filter out poisoned data.
Quantifying Latent Distributional Differences
To understand why current defenses are effective, we first quantify the distributional differences between benign and malicious samples in standard backdoored models. Using statistical metrics—Maximum Mean Discrepancy (MMD), Energy Distance (ED), and Sliced Wasserstein Distance (SWD)—we observe that these distributions are significantly divergent across multiple network depths. This "loudness" in the latent space is what allows clustering-based defenses to achieve near-perfect detection F1 scores (90%-100%).
Multi-Level MMD Regularization (ML-MMDR)
To counter these defenses, we propose Multi-Level Maximum Mean Discrepancy Regularization (ML-MMDR). This technique integrates a "cloaking" mechanism directly into the training objective.
The ML-MMDR loss function augments the standard training loss (which optimizes for clean accuracy and attack success) with a multi-level MMD constraint. This constraint penalizes the model when the distributions of benign and malicious representations diverge at intermediate layers. By applying this regularization across the network hierarchy, rather than just at the final layer, the model is forced to learn features that make triggered inputs indistinguishable from clean inputs to internal diagnostic tools.
Experimental Evaluation
We evaluated ML-MMDR on CIFAR-10 and CelebA datasets using various architectures including VGG-11, VGG-16, ResNet-18, and PreActResNet-18.
Impact on Defense Effectiveness
The proposed method was tested against three major difference-based defenses: Activation Clustering (AC), Spectral Signatures (SS), and Subspace Reconstruction (SR). Our results demonstrate a significant collapse in defense performance:
- F1 Score Reduction: Detection F1 scores dropped from nearly 100% on regularly trained models to approximately 60%–70% with ML-MMDR, which is close to the performance of random guessing.
- Attack Success Rate (ASR): Despite the increased stealth, ML-MMDR maintains an ASR of nearly 100%, proving that stealth does not necessitate a trade-off with attack potency.
The Importance of Multi-Level Alignment
A key finding of our ablation studies is that single-level regularization (targeting only the final hidden layer) is insufficient. Defenses can often still detect anomalies in earlier layers if the alignment is not consistent throughout the network. ML-MMDR ensures that the "islands" of malicious and benign samples in the latent space overlap completely, making them indistinguishable to clustering algorithms.
Conclusion
ML-MMDR demonstrates that existing representation-based backdoor defenses are vulnerable to distributional alignment. By forcing malicious samples to mimic benign ones across multiple layers, attackers can maintain high success rates while remaining virtually invisible to current detection methods. This work highlights the need for more robust defense mechanisms that do not rely solely on latent distribution differences.
Prototype code is available at: https://github.com/xpf/Multi-Level-MMD-Regularization
Summary updated