Diffusion Models are Certifiably Robust Classifiers

Huanran Chen, Yinpeng Dong, Shitong Shao, Zhongkai Hao, Xiao Yang, Hang Su, Jun Zhu

TL;DR

Researchers have finally provided a theoretical foundation for why diffusion models are so resilient to adversarial attacks, proving they possess $O(1)$ Lipschitzness. By introducing Noised Diffusion Classifiers (NDCs), they've set new state-of-the-art records for certified robustness on CIFAR-10 and ImageNet—all using off-the-shelf models without any extra training data.

The Fragility of Standard Classifiers

Standard deep learning classifiers (discriminative models) are notoriously fragile. A tiny, human-imperceptible tweak to an image—an adversarial perturbation—can trick a world-class model into misclassifying a "dog" as a "toaster." While many defenses exist, most are empirical: they work only until a cleverer attacker finds a new "shortcut" in the model's decision logic.

Generative models, specifically diffusion models, have shown remarkable empirical robustness because they learn the underlying distribution of the data rather than just a decision boundary. However, the field has lacked a rigorous theoretical understanding of why they are robust. Furthermore, there was no established way to "certify" their robustness—providing a mathematical guarantee that the model's prediction won't change within a certain radius of noise.

Bridging Generative Modeling and Certified Robustness

The authors bridge the gap between generative modeling and Randomized Smoothing, a popular technique for certifying robustness.

  1. Theoretical Proof: They first prove that diffusion classifiers satisfy an $O(1)$ Lipschitz condition. In plain English, the model's output is mathematically guaranteed to change slowly relative to changes in the input, preventing "jittery" or fragile predictions.
  2. Noised Diffusion Classifiers (NDCs): To obtain tighter robustness guarantees, the authors generalized diffusion classifiers to handle Gaussian-corrupted (noisy) data. They derived new Evidence Lower Bounds (ELBOs) specifically for these noisy distributions.
Overview of the proposed Noised Diffusion Classifiers (EPNDC and APNDC) compared to standard Diffusion Classifiers (DC).

As shown in the pipeline above, the authors introduce two main variants:

  • EPNDC (Exact Posterior): A mathematically rigorous version that calculates the likelihood of noisy data.
  • APNDC (Approximated Posterior): A more efficient version that acts like an "ensemble" of classifiers, providing even better results with less computational overhead.
  • Efficiency Boosters: Because diffusion models are notoriously slow, the authors introduced practical speedups. They utilized Variance Reduction (using the same noise samples across all classes to stabilize predictions) and Sift-and-Refine (a search algorithm that quickly discards unlikely classes, reducing the computational burden by up to 1000x on large datasets like ImageNet).

Key Insights

  • Generative is Inherently Better: Unlike discriminative models that look for the easiest way to separate classes (often leading to non-robust "shortcuts"), diffusion models must understand the entire data manifold to reconstruct images. This "global" understanding is the root of their stability.
  • Lipschitzness is the Key: Proving $O(1)$ Lipschitzness provides the "why" behind the empirical success of diffusion classifiers and allows for the derivation of certified radii.
  • The "Strong Law" of Smoothing: By combining diffusion with randomized smoothing, the authors moved from "weak" constant Lipschitzness to "strong" non-constant Lipschitzness, which allows for much tighter theoretical robustness bounds.

State-of-the-Art Results

The researchers evaluated their methods on CIFAR-10 and ImageNet-64x64 using pre-trained, off-the-shelf diffusion models (like EDM), meaning no expensive adversarial re-training was required.

Certified accuracy on CIFAR-10, demonstrating APNDC's state-of-the-art performance.

The results represent a significant leap over previous state-of-the-art (SOTA) methods that don't use extra data:

  • CIFAR-10: APNDC achieved 82.2% certified robustness at an $\ell_2$ radius of 0.25. This beats the previous SOTA by an absolute margin of 5.6%.
  • Clean Accuracy: Their approach reached 91.2% clean accuracy, outperforming previous robust models by 3.6%.
  • ImageNet-64: On this much harder task, their APNDC method achieved 46.3% certified accuracy at radius 0.25, significantly outperforming traditional smoothed classifiers.
  • Speedup: Their "Sift-and-Refine" technique reduced the time to certify an ImageNet image from roughly 35 days (theoretical) to just 27 hours on a single GPU.

Limitations and Future Work

While the speedups are impressive, diffusion-based classification is still significantly slower than a simple forward pass through a standard ResNet. The authors also note that while they've derived a functional ELBO for noisy data, the "optimal" weighting for the terms in that ELBO remains an open question. Future work will likely focus on even faster sampling methods and finding a tighter theoretical lower bound for the standard (non-noised) diffusion classifier, which the authors suspect is even more robust than current proofs can show.

Summary updated

BibTeX
@inproceedings{chen2024diffusion,
  author = {Huanran Chen and Yinpeng Dong and Shitong Shao and Zhongkai Hao and Xiao Yang and Hang Su and Jun Zhu},
  title = {{Diffusion Models are Certifiably Robust Classifiers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=wGP1tBCP1E},
}
Figure