Diffusion Models for Adversarial Purification

Adversarial purification refers to a class of defense methods that remove adversarial perturbations using a generative model. These methods do not make assumptions on the form of attack and the classification model, and thus can defend pre-existing classifiers against unseen threats. However, their performance currently falls behind adversarial training methods. In this work, we propose DiffPure that uses diffusion models for adversarial purification: Given an adversarial example, we first diffuse it with a small amount of noise following a forward diffusion process, and then recover the clean image through a reverse generative process. To evaluate our method against strong adaptive attacks in an efficient and scalable way, we propose to use the adjoint method to compute full gradients of the reverse generative process. Extensive experiments on three image datasets including CIFAR-10, ImageNet, and CelebA-HQ with three classifier architectures including ResNet, WideResNet, and ViT demonstrate that our method achieves state-of-the-art results, outperforming current adversarial training and adversarial purification methods, often by a large margin. Code is available at our project page.


Brandon Guo (Caltech)
Yujia Huang (Caltech)
Anima Anandkumar (NVIDIA)

Publication Date