Semantic Adversarial Attacks via Diffusion Models

Chenan Wang, Jinhao Duan, Chaowei Xiao, Edward Kim, Matthew C. Stamm, Kaidi Xu · DOI

Introduction

Adversarial attacks traditionally rely on adding imperceptible pixel-level noise to images to fool machine learning models. While effective, these $\ell_p$-norm constrained perturbations are often fragile and do not represent realistic variations encountered in the real world. Semantic adversarial attacks offer a more robust alternative by modifying high-level attributes such as color, texture, or specific features. However, previous semantic attack methods, largely based on Generative Adversarial Networks (GANs), often suffer from poor image quality and require extensive manual labeling.

This paper introduces a novel framework that leverages the superior generative capabilities and structured latent space of Diffusion Models (DMs) to generate highly realistic and effective semantic adversarial attacks. By manipulating high-level attributes rather than pixel-level noise, the authors achieve near-perfect attack success rates while maintaining significantly higher image realism.

Methodology

The proposed framework utilizes the rich semantic information inherent in diffusion latents to perform attacks without requiring manual attribute annotations. Two primary approaches are developed:

Semantic Transformation (ST)

The ST method involves fine-tuning the latent representation of an image and/or the parameters of the diffusion model itself. The optimization process is guided by a specialized loss function that balances misclassification (maximizing the difference between original and new predictions using KL divergence) and perceptual fidelity (minimizing the Learned Perceptual Image Patch Similarity, or LPIPS). ST can be applied in both white-box settings, where the target model's gradients are available, and black-box settings using a surrogate model.

Latent Masking (LM)

LM is a faster, optimization-free alternative designed for targeted feature manipulation. It employs interpretability tools such as Grad-CAM or saliency maps to identify regions of the target image that are most influential for a specific classification. These features are then "transplanted" into the source image's latent space, allowing for precise semantic changes—such as swapping a specific facial feature—to induce misclassification.

Experimental Evaluation

The framework was evaluated across several challenging tasks and datasets:

  • CelebA-HQ: Used for human facial identity recognition and gender classification.
  • AFHQ: Used for animal category recognition (categorizing cats, dogs, and wildlife).
  • ImageNet: A pre-trained InceptionV3 model was used as a surrogate for testing black-box attack transferability.

Results and Discussion

The diffusion-based framework demonstrates significant improvements over existing GAN-based baselines in both attack effectiveness and image realism.

Visual comparison of adversarial examples generated using Semantic Transformation (ST) and Latent Masking (LM) approaches.

Attack Success and Realism

The ST approach achieved a near-perfect Attack Success Rate (ASR) of approximately 100% on the CelebA-HQ dataset. Crucially, this was achieved while maintaining superior image quality. The framework recorded a Fréchet Inception Distance (FID) of 36.61, a massive improvement over the GAN-based LatentHSJA method, which yielded an FID of 83.52 (where lower values indicate better quality).

Robustness and Transferability

Unlike pixel-noise attacks, these semantic modifications are highly robust to common defensive measures like JPEG compression or blurring, as the attack is embedded in the image content itself. Furthermore, attacks generated against a ResNet18 model successfully transferred to other architectures, including ResNet101 and DenseNet121, indicating that the semantic vulnerabilities exploited are fundamental to the classification task rather than specific to a single model architecture.

Conclusion

By exploiting the latent space of diffusion models, this work provides a powerful tool for generating realistic semantic adversarial attacks. While the ST approach can occasionally produce deformations in black-box settings and the LM approach lacks perfect boundary control, the framework sets a new standard for semantic attack realism and robustness. Future research will focus on enhancing the precision of masked areas and extending the framework to more diverse domains beyond facial and animal recognition.

Summary updated

BibTeX
@inproceedings{wang2023semantic,
  author = {Chenan Wang and Jinhao Duan and Chaowei Xiao and Edward Kim and Matthew C. Stamm and Kaidi Xu},
  title = {{Semantic Adversarial Attacks via Diffusion Models}},
  booktitle = {BMVC},
  year = {2023},
  url = {https://openreview.net/forum?id=iWLkQ-vJpe},
}
Figure