Enhancing Adversarial Robustness via Score-Based Optimization

Boya Zhang, Weijian Luo, Zhihua Zhang

ScoreOpt is a novel adversarial defense mechanism that leverages pre-trained diffusion models as "priors" to purify images at test-time. By framing image purification as an optimization problem rather than relying on slow sequential simulation, ScoreOpt achieves state-of-the-art robustness against adaptive attacks while significantly reducing the computational time required for inference.

The Challenge of Adversarial Attacks

Deep Neural Networks (DNNs) are notoriously fragile. Tiny, human-imperceptible perturbations—known as adversarial attacks—can easily trick them into making incorrect predictions. While adversarial training (training models on attacked images) is a common defense, it is rigid. It often fails against novel attack types and requires expensive retraining of the classifier.

Adversarial purification offers a more flexible alternative: a separate model "cleans" the image before the classifier ever processes it. Recently, diffusion models have shown great promise in this area, but they suffer from two major flaws:

  1. Efficiency: They rely on solving complex stochastic differential equations (SDEs) step-by-step, which is incredibly slow.
  2. Suboptimality: Their performance is highly sensitive to hyperparameters, such as the exact amount of noise to add before starting the cleaning process.

The ScoreOpt Approach

To address these limitations, the authors introduce ScoreOpt, which treats purification as a Maximum A Posteriori (MAP) estimation problem. Instead of the traditional "add noise and then slowly denoise" approach, ScoreOpt optimizes the adversarial image directly toward the clean data manifold.

The ScoreOpt framework: An adversarial sample is iteratively optimized using a score-based prior to produce a purified sample.

Key Innovations

  • Score Regularization (SR) Loss: Standard optimization often uses Mean Squared Error (MSE) to keep the purified image close to the original. However, MSE is highly sensitive to weighting. The authors propose a hyperparameter-free SR loss that encourages the "score" (the gradient of the log-density) of the optimized image to match the score of the adversarial image across various noise levels.
  • ScoreOpt-N (One-Shot Denoising): To further boost speed, the researchers propose optimizing a noisy version of the image and then applying a single "one-shot" denoising step. This completely bypasses the need for the full reverse-diffusion chain.

Key Insights and Results

The researchers evaluated ScoreOpt on standard computer vision benchmarks, including CIFAR10, CIFAR100, ImageNet, and CIFAR10-C (for common corruptions).

Optimization over Simulation: The core insight of ScoreOpt is that simulating the entire diffusion process is unnecessary. By using the score-based prior to guide a gradient-descent optimization, the system can reach the "clean" data manifold in far fewer steps.

Stability through Score Matching: Standard MSE-based optimization can cause accuracy to drop if too many steps are taken. In contrast, the SR loss is remarkably stable, maintaining high standard accuracy while steadily improving robust accuracy.

Comparison of robustness performance. Note how the SR loss converges to stable values compared to the more volatile MSE loss.

Superior Robustness and Speed: * On CIFAR10, ScoreOpt achieved 90.59% robust accuracy against the strong BPDA+EOT attack, marking an absolute improvement of over 9% compared to previous state-of-the-art diffusion defenses. * ScoreOpt is significantly faster than previous methods. It requires only about 5 optimization steps to outperform sequential diffusion methods that typically require 100 denoising steps. * Because ScoreOpt is a pre-processor, it acts as a plug-and-play defense that can be combined with any off-the-shelf classifier without retraining. It also proved highly effective against "unseen" threats and common corruptions.

Limitations and Future Work

While ScoreOpt is faster in terms of iterations, the optimization process involves calculating the Jacobian of the U-Net (the core of the diffusion model). This is computationally heavy and requires significant GPU memory, currently limiting its use on the most extreme adversarial benchmarks. Furthermore, while empirical evidence strongly suggests the optimization converges to a local optimum, a formal theoretical convergence analysis is still needed.

Future work will focus on reducing this memory overhead and exploring the application of these score-based priors to domains beyond image classification.

Summary updated

BibTeX
@inproceedings{zhang2023enhancing,
  author = {Boya Zhang and Weijian Luo and Zhihua Zhang},
  title = {{Enhancing Adversarial Robustness via Score-Based Optimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=MOAHXRzHhm},
}
Figure