(Certified!!) Adversarial Robustness for Free!

Nicholas Carlini, Florian Tramer, Krishnamurthy Dj Dvijotham, Leslie Rice, Mingjie Sun, J Zico Kolter

Introduction

Researchers have discovered a way to achieve state-of-the-art certified adversarial robustness by simply plugging in off-the-shelf, pretrained diffusion models as denoisers. By using "one-shot" denoising, they improved certified accuracy on ImageNet by a staggering 14 percentage points over previous records—all without retraining a single model parameter.

The Challenge of Adversarial Robustness

Deep learning models are notoriously fragile; a tiny, invisible perturbation to an image (an "adversarial attack") can cause a classifier to fail. While many "empirical" defenses exist, they are often broken by newer, more sophisticated attacks. Certified robustness aims to solve this by providing a mathematical guarantee: a prediction is guaranteed to remain constant within a specific "radius" of noise (usually measured by the $L_2$ norm).

The gold standard for achieving this is randomized smoothing, where Gaussian noise is added to an image many times, and a majority vote is taken from the classifier's predictions. However, standard classifiers perform poorly on noisy images. To fix this, researchers previously used denoised smoothing, which passes the noisy image through a custom "denoiser" before classification. The bottleneck? Training high-quality denoisers is incredibly difficult and usually results in a significant drop in overall accuracy.

Diffusion Denoised Smoothing (DDS)

The authors introduce Diffusion Denoised Smoothing (DDS). Their key insight is that Denoising Diffusion Probabilistic Models (DDPMs)—the technology powering image generators like DALL-E and Midjourney—are inherently designed to be the world's best denoisers.

Algorithms for Noise, Denoise, Classify and Randomized Smoothing

The DDS approach relies on three core pillars:

  1. The Mapping: They developed a simple mathematical relationship to map the noise level ($\sigma$) used in randomized smoothing to the specific "timestep" ($t$) in a diffusion model's schedule.
  2. One-Shot Denoising: Instead of running the full, slow iterative diffusion process (which can take 1000+ steps), they use the model to predict the final "clean" image in a single step.
  3. Plug-and-Play: They take a standard pretrained diffusion model and a standard pretrained classifier (like a ViT or BEiT) and chain them together. No fine-tuning or joint training is required.

Key Insights

  • Diffusion Models are "Natural" Denoisers: Because diffusion models are trained to reverse Gaussian noise across a vast range of intensities, they are far more generalizable than custom denoisers trained on a single noise level.
  • Faithfulness over Photorealism: In generative AI, iterative steps are used to create "pretty" images. However, for classification, iterative steps often "hallucinate" new details that weren't in the original image, tricking the classifier. The authors found that one-shot denoising stays more faithful to the original input, even if the result looks slightly blurrier to a human.
  • The "For Free" Aspect: Traditionally, making a model robust meant a massive "robustness tax"—sacrificing clean accuracy and spending huge amounts of compute on specialized training. This paper shows you can inherit robustness entirely from existing generative models.

Key Results

The approach was evaluated on two industry-standard benchmarks: CIFAR-10 and ImageNet. The authors used publicly available pretrained models, such as OpenAI's 552M-parameter diffusion model and the BEiT-large classifier.

The results represent a massive leap for the field of certified robustness:

Certified accuracy vs. L2 radius on CIFAR-10 and ImageNet
  • ImageNet: At an $L_2$ perturbation radius of $\epsilon = 0.5$, DDS achieved 71.1% certified accuracy. This is a 14% improvement over the previous state-of-the-art and a 30% improvement over prior denoised smoothing techniques.
  • CIFAR-10: DDS achieved 70.6% certified accuracy at $\epsilon = 0.25$, outperforming models that were specifically trained for months to be robust.
  • Clean Accuracy: Because the method uses high-performance off-the-shelf classifiers, the "clean" (non-adversarial) accuracy remains much higher than previous robust models.

Limitations and Future Work

While highly effective, the approach has a few limitations:

  • Computational Cost: While "one-shot" is faster than full diffusion, randomized smoothing still requires passing thousands of noisy samples through the model to get a mathematical certificate. This makes real-time certification expensive.
  • Hallucinations at High Noise: At very high noise levels (large $\sigma$), even diffusion models start to hallucinate features from other classes, causing accuracy to drop off compared to models specifically trained for extreme noise.

For future directions, the authors suggest that using more advanced deterministic samplers could further bridge the gap between one-shot and iterative denoising, potentially pushing certified limits even further.

Summary updated

BibTeX
@inproceedings{carlini2023certified,
  author = {Nicholas Carlini and Florian Tramer and Krishnamurthy Dj Dvijotham and Leslie Rice and Mingjie Sun and J Zico Kolter},
  title = {{(Certified!!) Adversarial Robustness for Free!}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=JLg5aHHv7j},
}
Figure