General Adversarial Defense Against Black-box Attacks via Pixel Level and Feature Level Distribution Alignments

Xiaogang Xu, Hengshuang Zhao, Philip Torr, Jiaya Jia

TL;DR

This paper introduces a general defense mechanism against black-box adversarial attacks by training Deep Generative Networks (DGNs) to align the distributions of adversarial and clean images. By enforcing novel pixel-level and class-aware feature-level constraints, the authors successfully bridge the "distribution gap" that typically causes models to fail, providing robust protection across image classification, semantic segmentation, and object detection tasks.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are notoriously fragile when faced with adversarial attacks—small, human-imperceptible perturbations added to inputs that cause models to make wild errors. In real-world scenarios, attackers often don't have access to the target model's internal parameters (a black-box attack). Instead, they exploit transferability: an adversarial image designed to fool one model often fools others because they share similar "blind spots" in their feature space.

The authors identify that this vulnerability stems from a significant distribution gap in the feature space of target models between clean and adversarial samples. While existing defenses try to "denoise" images or match individual pairs, they often fail to align the overall distribution, leaving models vulnerable to unseen attacks.

Methods

The authors propose a defense-via-transformation framework using a Generator ($\mathcal{G}$) that processes input images before they reach the target model. The core innovation lies in two types of training constraints:

  1. Novel Pixel-level Alignment: Traditional methods try to make a generated adversarial sample $\hat{x}^a$ look like the original clean sample $x^c$. The authors argue this is an ill-posed problem. Instead, they use the generated clean sample $\hat{x}^c$ as an intermediate target. By minimizing the distance between $\hat{x}^a$ and $\hat{x}^c$, they find a smaller, more stable solution space that effectively "neutralizes" perturbations.

    Comparison of traditional vs. proposed pixel-level constraints
  2. Class-aware Feature-level Alignment: In the feature space of the target model, the authors don't just match individual features. They align the clustering centers of clean and adversarial samples for each class. They also introduce losses to maximize the distance between different classes (inter-class) and minimize the spread within the same class (intra-class), ensuring the model's internal representations remain organized even under attack.

Overall framework showing pixel and feature level constraints

Datasets

The authors evaluated their method across three major computer vision tasks using standard benchmarks:

  • Image Classification: CIFAR10, CIFAR100, and Tiny-ImageNet.
  • Semantic Segmentation: Cityscapes and PASCAL VOC2012.
  • Object Detection: PASCAL VOC07+12.

Key Insights and Ideas

  • Distribution Alignment > Point Matching: Simply denoising an image isn't enough. The goal should be to push the adversarial features back into the "manifold" of clean features where the model is trained to perform well.
  • The Power of Intermediate Targets: Using the generated clean image as a guide for the adversarial one (rather than the raw original) makes the optimization problem much easier for the generator to solve, leading to better convergence.
  • Generality and Transferability: Because the defense focuses on fundamental distribution properties, a generator trained to protect one model (e.g., WideResNet) can effectively protect a completely different, unseen model (e.g., ResNet50) without retraining.
  • Visualizing Success: t-SNE plots clearly show that while attacks "shatter" the clean feature clusters, the proposed generator successfully re-clusters them, restoring the model's ability to distinguish classes.
Figure 1. t-SNE visualizations in the feature space of the target model on CIFAR10 [17]. The target model O has proper distribution for clean samples xc and disordered distribution for adversarial samples xa. Our trained generator G turns xc into bxc, xa into bxa for correct distribution.

Key Results

The proposed method consistently outperformed state-of-the-art defenses like NRP and TRADES across various attack types (PGD, DeepFool, C&W).

  • Classification: On CIFAR10, while a "No Defense" model dropped to ~2% accuracy under PGD attack, this method maintained 81.4% accuracy.
  • Segmentation: On Cityscapes, it achieved a mean IoU of 59.5% under BIM attack, compared to just 3.6% for an undefended model and ~55% for previous top methods.
  • Detection: On VOC07+12, it achieved 60.9% mAP under combined classification and localization attacks, significantly higher than the 15.0% of an undefended model.
  • Quality: The method also preserves image quality better than competitors, achieving higher PSNR values for the transformed images.

Limitations and Future Work

  • Surrogate Dependency: While the defense generalizes well, training the generator still requires access to some representative target model for the task.
  • Inference Overhead: Adding a generative network before the main model increases the computational cost and latency of the overall system.
  • Adaptive Attacks: While the authors tested against attackers who know about the defense (using BPDA), the constant "arms race" in adversarial ML means future, more sophisticated adaptive attacks might still pose a threat.

The authors suggest that future work could explore even more complex distribution alignment techniques or optimize the generator architecture for real-time applications.

Summary updated

Abstract

Deep Neural Networks (DNNs) are vulnerable to the black-box adversarial attack that is highly transferable. This threat comes from the distribution gap between adversarial and clean samples in feature space of the target DNNs. In this paper, we use Deep Generative Networks (DGNs) with a novel training mechanism to eliminate the distribution gap. The trained DGNs align the distribution of adversarial samples with clean ones for the target DNNs by translating pixel values. Different from previous work, we propose a more effective pixel level training constraint to make this achievable, thus enhancing robustness on adversarial samples. Further, a class-aware feature-level constraint is formulated for integrated distribution alignment. Our approach is general and applicable to multiple tasks, including image classification, semantic segmentation, and object detection. We conduct extensive experiments on different datasets. Our strategy demonstrates its unique effectiveness and generality against black-box attacks.
BibTeX
@misc{xu2022general,
  author = {Xiaogang Xu and Hengshuang Zhao and Philip Torr and Jiaya Jia},
  title = {{General Adversarial Defense Against Black-box Attacks via Pixel Level and Feature Level Distribution Alignments}},
  year = {2022},
  eprint = {2212.05387},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.05387},
}
Figure