MixDefense: A Defense-in-Depth Framework for Adversarial Example Detection Based on Statistical and Semantic Analysis

Yijun Yang, Ruiyuan Gao, Yu Li, Qiuxia Lai, Qiang XuarXiv 2021 · arXiv

Abstract

Deep Neural Networks (DNNs) are vulnerable to adversarial examples (AEs)—inputs crafted with subtle perturbations to cause misclassification. Existing defenses often suffer from high computational overhead, reduced accuracy on clean data, or vulnerability to adaptive attacks. This paper introduces MixDefense, a "plug-and-play" two-layer framework that detects AEs by analyzing both statistical noise and semantic consistency. By combining a noise-based detector for large perturbations with a generative model for semantic verification, MixDefense achieves high detection accuracy and robustness against adaptive adversaries without compromising clean-image performance.

Introduction

Adversarial examples pose a significant threat to the deployment of DNNs in security-critical applications. While adversarial training and input purification are common defenses, they often introduce significant overhead or degrade the model's original accuracy. Furthermore, many defenses are fragile when faced with adaptive attacks where the adversary has knowledge of the defense mechanism.

MixDefense addresses these challenges through a "defense-in-depth" strategy. It treats adversarial detection as a multi-stage process, filtering out "loud" statistical anomalies first and then scrutinizing "quiet" semantic contradictions.

Methodology

The MixDefense framework consists of two complementary layers designed to cover the full spectrum of adversarial perturbation budgets.

Overview of the MixDefense two-layer framework.

LP-Defense (Large Perturbation)

The first layer, LP-Defense, utilizes a Simple Adversarial Example Catcher (SAEC). This component treats large adversarial perturbations as high-frequency noise. It generates pseudo-saturation maps to suppress image content and highlight "salt-and-pepper" noise typical of AEs.

Visual and statistical analysis of adversarial perturbations across different budgets.

As shown in Figure 2, as the perturbation budget increases, the statistical variance of the noise feature histogram (Noise Level Score) becomes more pronounced. If this score exceeds a predefined threshold, the input is flagged as adversarial before reaching the classifier.

SP-Defense (Small Perturbation)

For subtle perturbations that evade statistical detection, the SP-Defense layer (ContraNet) looks for semantic contradictions. When the classifier predicts a label, ContraNet uses a conditional Generative Adversarial Network (cGAN) to reconstruct the image based on that predicted label.

If the input is legitimate, the reconstruction will closely match the original. However, if the input is an AE (e.g., a "Speed Limit" sign perturbed to be classified as a "Stop Sign"), the cGAN will generate a "Stop Sign," creating a significant semantic gap. A Triplet Network-based Deep Metric Model measures this distance in a high-dimensional embedding space to distinguish between benign and adversarial samples.

Experimental Results

MixDefense was evaluated on MNIST, CIFAR-10, and GTSRB datasets. Key findings include:

  • High Detection Accuracy: SAEC achieved over 97% accuracy for large perturbations, while ContraNet effectively caught subtle attacks.
  • Preserved Clean Accuracy: The framework has negligible impact on the classification of legitimate images (e.g., maintaining 98.2% accuracy on MNIST).
  • Adaptive Robustness: By breaking the gradient path—using non-differentiable operations like argmax and separate training for components—MixDefense remains resilient even when attackers attempt to target the defense itself.

Conclusion

MixDefense offers a robust, attack-agnostic solution for adversarial detection. By layering statistical and semantic analysis, it provides comprehensive protection across various perturbation levels while remaining computationally efficient and easy to integrate into existing DNN pipelines. Future work will focus on scaling this approach to more complex datasets like ImageNet.

Summary updated

Abstract

Machine learning with deep neural networks (DNNs) has become one of the foundation techniques in many safety-critical systems, such as autonomous vehicles and medical diagnosis systems. DNN-based systems, however, are known to be vulnerable to adversarial examples (AEs) that are maliciously perturbed variants of legitimate inputs. While there has been a vast body of research to defend against AE attacks in the literature, the performances of existing defense techniques are still far from satisfactory, especially for adaptive attacks, wherein attackers are knowledgeable about the defense mechanisms and craft AEs accordingly. In this work, we propose a multilayer defense-in-depth framework for AE detection, namely MixDefense. For the first layer, we focus on those AEs with large perturbations. We propose to leverage the `noise' features extracted from the inputs to discover the statistical difference between natural images and tampered ones for AE detection. For AEs with small perturbations, the inference result of such inputs would largely deviate from their semantic information. Consequently, we propose a novel learning-based solution to model such contradictions for AE detection. Both layers are resilient to adaptive attacks because there do not exist gradient propagation paths for AE generation. Experimental results with various AE attack methods on image classification datasets show that the proposed MixDefense solution outperforms the existing AE detection techniques by a considerable margin.
BibTeX
@misc{yang2021mixdefense,
  author = {Yijun Yang and Ruiyuan Gao and Yu Li and Qiuxia Lai and Qiang Xu},
  title = {{MixDefense: A Defense-in-Depth Framework for Adversarial Example Detection Based on Statistical and Semantic Analysis}},
  year = {2021},
  eprint = {2104.10076},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.10076},
}
Figure