Adversarial training is the standard way to make an image classifier resist adversarial examples, which are tiny, deliberately crafted pixel changes that flip its prediction. It is expensive because every weight update first runs several gradient steps to find the worst-case perturbation. A cheaper alternative is purification: a pretrained diffusion model (a generator that learns to turn noise into images by repeated denoising) first adds noise to the incoming image and then denoises it, washing out the perturbation before the image reaches an unmodified classifier. The best purifiers have two costs. They run dozens of denoising steps per test image. They also need an extra signal to keep the cleaned image from drifting to a different class. That signal comes from "negative guidance": at each step, push the image away from what it should not become. Recent work shows this negative guidance is what makes purification work well, and separately shows that a slow multi-step generator can be compressed into a one-step generator. Nobody has asked whether the drift-preventing effect of adversarial negative guidance survives that compression.
We propose to distill a contrastively guided diffusion purifier into a single-step student. The teacher is a multi-step denoiser that, at every step, pulls toward the input's own signal and pushes away from other classes. The student learns to reproduce the teacher's guided output in one forward pass. The central claim is testable: most of the accuracy gap between guided and unguided purification can be kept in a one-step model. If it can, distillation also removes the teacher's dependence on minibatches and labels at test time, because the student needs neither. The result would be a defense with roughly adversarial-training-free cost at deployment and a one-time offline training cost that we account for explicitly.
Where this sits in prior work
Three papers motivate the proposal by showing that guidance matters for purification. Diffusion Models for Adversarial Purification (DiffPure) introduced noise-then-denoise purification with an off-the-shelf diffusion model. Its known weakness is that a small noise level leaves the perturbation in place and a large one changes the class. Diffusion Models Demand Contrastive Guidance for Adversarial Purification to Advance adds, at every reverse step, a gradient of a contrastive loss that repels the sample from other-class samples in the minibatch. On CIFAR-10 with a WideResNet-28-10 classifier under AutoAttack it reports 82.81% robust accuracy against DiffPure's 70.64%, and on GTSRB roughly 69% against roughly 42%. It pays for this with a gradient computation at every one of many steps and a test-time dependence on batch-mates. Adversarial Guided Diffusion Models for Adversarial Purification guides denoising with an auxiliary latent network trained adversarially. It keeps both the multi-step cost and an inner min-max training loop. We take the contrastive guidance as our teacher's mechanism and change only where it is paid for.
Two papers supply the compression method. MFSR: MeanFlow Distillation for One Step Real-World Image Super Resolution distills a multi-step super-resolution teacher, including negative-prompt guidance inside its classifier-free guidance, into a one-step student. It trains the student to predict the average velocity over an interval rather than the instantaneous one. It also reports that the student cannot supply this guidance itself. MFSR addresses camera degradations, not adversaries, and does not show that guidance which depends on a batch and labels can be distilled. Continuous Adversarial MeanFlow Transfer shows that MeanFlow students can match teacher quality with up to 125× fewer network evaluations. We reuse the MeanFlow objective essentially unchanged.
The closest competitor is Instant Adversarial Purification with Adversarial Consistency Distillation (OSCP). It distills a one-step consistency purifier with a small set of extra low-rank weights (LoRA) and anchors structure with Canny edges through a ControlNet. It reports 74.19% robust accuracy on ImageNet against AutoAttack at about 0.1 s per image, roughly 100× faster than DiffPure. OSCP prevents drift with a fixed, non-differentiable edge map rather than a learned repulsion from wrong classes. An adversary can move edges, and edges say little about texture-defined classes. Our proposal differs in one ingredient: the drift-preventing signal is the distilled contrastive negative guidance rather than an edge condition. The ablations below isolate exactly that ingredient.
Work from the artifact-suppression side shapes the design without being reused directly. Negative Token Merging repels transformer tokens from a reference image at under 4% overhead. FashionR2R learns a negative embedding for synthetic-render artifacts. Both show negative guidance works when the negative is well defined. Neither has been tested against gradient attacks, and both need a reference or a learned negative token at inference. Distillation lets us avoid that requirement. We considered a learned "adversarial artifact token" as the negative condition, but rejected it as the core idea. Adversarial perturbations are input-specific and attacker-chosen, so a single fixed negative embedding is a weaker target than class-contrastive repulsion, which already has published evidence behind it.
Core Claim
A one-step student trained to match a contrastively guided purification teacher keeps at least half of the teacher's robust-accuracy advantage over unguided purification. It does so under fully adaptive end-to-end attacks, at roughly the per-image cost of one network forward pass, and with no minibatch or label needed at test time.
Research Program
Teacher. Use DiffPure's pretrained score models (CIFAR-10, GTSRB, ImageNet) with the published contrastive guidance and its recommended noise level $t^*$. During offline training we construct class-diverse minibatches with known labels, so the teacher's dependence on batches and labels is satisfied at training time only.
Data for distillation. Inputs are clean training images and adversarial versions of them. To keep the "overhead" story honest, adversarial inputs come from a cheap source: a fixed pool of perturbations generated once against the undefended classifier, refreshed rarely. They are not generated against the student in an inner loop. A secondary variant refreshes the pool against the current student every $K$ steps. Comparing the two tells us whether an inner loop is actually needed.
Student. The student is initialized from the teacher's denoiser and trained with low-rank adapters, following OSCP's parameter budget. It is trained with the MeanFlow objective on the guided velocity field. Let $z_t$ be the noised input at time $t$, $v(z_t,t)$ the teacher's denoising velocity, $g(z_t,t)$ its contrastive guidance term with weight $\lambda$, and $u_\theta(z_t,r,t)$ the student's predicted average velocity from $t$ back to $r$. The student is trained toward
$$u_\theta(z_t,r,t) \approx v(z_t,t)+\lambda\, g(z_t,t) - (t-r)\,\frac{d}{dt}u_\theta(z_t,r,t),$$
which is the MeanFlow identity applied to the guided field. Purification is then the single step $\hat x = z_{t^*} - t^*\,u_\theta(z_{t^*},0,t^*)$. Because $g$ appears only in the training target, the student never computes it.
Analysis. We measure three things. The first is the drift gap: the guided teacher's robust accuracy minus the unguided teacher's. The second is the retained fraction: the guided student's accuracy minus an identically trained unguided student's, divided by the drift gap. The third is clean-input class-flip rate, which measures the "clean accuracy tax" that purifiers and test-time correction such as ATAC incur. We also sweep $t^*$ for the student. The teacher's sweet spot for $t^*$ may move once guidance is baked in, and a shift toward larger $t^*$ without drift would be direct evidence that the distilled repulsion is doing work.
Baselines
The do-nothing reference is the undefended classifier: WideResNet-28-10 on CIFAR-10, the GTSRB classifier used by the contrastive-guidance paper, and the ImageNet classifier used by OSCP. AutoAttack drives its accuracy to near zero. The file reports a 100% undefended AutoAttack success rate on CIFAR-10 in Is RobustBench/AutoAttack a suitable Benchmark for Adversarial Robustness?.
Unguided DiffPure is the original multi-step purifier. It anchors the drift gap, with a reported 70.64% under AutoAttack on CIFAR-10 WRN-28-10, as reported in the contrastive-guidance paper. We rerun it with the same classifier, the same score model and the same attack code rather than copying numbers.
Contrastive-guided DiffPure is our teacher. It is the accuracy ceiling we hope to approach, at 82.81% on CIFAR-10 WRN-28-10 under AutoAttack and roughly 69% on GTSRB as reported in Diffusion Models Demand Contrastive Guidance for Adversarial Purification to Advance. We report its wall-clock per image alongside its accuracy.
OSCP is the strongest one-step competitor, with 74.19% ImageNet AutoAttack robust accuracy at about 0.1 s per sample on an NVIDIA F40 GPU, as reported in Instant Adversarial Purification with Adversarial Consistency Distillation. The file has no CIFAR-10 or GTSRB number for OSCP, so we will retrain it on those datasets ourselves. On every dataset it gets the same diffusion backbone, the same LoRA rank, the same distillation data and steps, and the same tuning budget for its guidance strength as our student. Beating it means higher robust accuracy under our adaptive attack suite at equal or lower per-image latency, on at least two of the three datasets, with clean accuracy no worse by more than one point.
AGDM (Adversarial Guided Diffusion Models for Adversarial Purification) is included where its code permits, as the representative of guidance learned through adversarial training. Its reported numbers are relative gains, and the file gives no absolute robust accuracy. Standard PGD adversarial training of the classifier is the cost reference. The file gives no absolute robust-accuracy number for it, only that DiffPure exceeded the best adversarial-training methods by 5.44 points on CIFAR-10. We will train it and log GPU-hours.
Two ablations isolate the key ingredient. The first is an unguided student: identical architecture, data and training, but distilled from unguided DiffPure. Comparing it with our student measures exactly what the distilled negative guidance contributes. The second is a hybrid student that adds OSCP's Canny condition to our guided student, which tests whether the two drift-prevention signals are complementary or redundant.
Why not just…?
Why not just use OSCP, which is already one-step? OSCP is the real threat, and the proposal is designed to be judged against it. Its anchor is an edge map that the adversary can perturb and that carries no class-discriminative texture information. Our anchor is repulsion from other classes, learned from a teacher with a documented 12-point advantage over unguided purification. Whether that advantage beats edges is an empirical question, settled by the head-to-head and hybrid runs at matched budget. If OSCP matches the guided student, we will report that the guidance adds nothing once structure is anchored, and that is a useful negative result.
Why not just run the guided teacher with only a handful of steps? Truncating the sampler is cheaper than distillation and needs no training. However, every step still needs a contrastive gradient and a class-diverse batch at test time, so it cannot serve single images in a stream. We include few-step guided samplers (one, two, four steps) at matched wall-clock as a baseline. If four-step guided sampling matches the student's accuracy at similar latency, the distillation is not worth its training cost, and we will say so.
Why not just filter high frequencies or detect attacks spectrally? Is RobustBench/AutoAttack a suitable Benchmark for Adversarial Robustness? shows a Fourier-domain detector drops AutoAttack's success rate to 0.33% on CIFAR-10. The same paper shows Carlini & Wagner keeps over 40% success. A detector also rejects inputs instead of recovering them. We therefore evaluate every method, including a low-pass filter baseline, on C&W and DeepFool as well as AutoAttack, so that a defense that only removes loud perturbations cannot look strong.
Why not just use parameter-efficient robustness such as robustness tokens? Robustness Tokens recovers 63.1% white-box accuracy for DINOv2-G with ten learned vectors and 200 steps. It applies only to transformer encoders, and its authors note its security degrades if the tokens are known to the attacker. Our purifier sits in front of any classifier and is evaluated with full white-box access. We include ROB tokens only on the ImageNet transformer setting, as a cost-matched comparison.
Proposed Experiments and Decisive Checks
Benchmarks are CIFAR-10 (WRN-28-10), GTSRB, and ImageNet, with CelebA-HQ face verification as an optional transfer check following OSCP. The student is a single differentiable network, so attacks pass gradients through it exactly, with no approximation of the purifier's gradient. We run AutoAttack in $\ell_\infty$ and $\ell_2$ with expectation over the random noise draw (20 samples), C&W, DeepFool, and an attack that targets the student's output to land in a wrong class's region. We also run transfer attacks from the guided teacher. Metrics are clean accuracy, robust accuracy, class-flip rate on clean inputs, per-image latency, and total GPU-hours: teacher generation plus distillation, compared with PGD adversarial training of the classifier.
The decisive check is the retained fraction on CIFAR-10 and GTSRB, where the drift gap is large and published. The proposal succeeds if the guided student keeps at least half the gap over the unguided student under the full adaptive suite, beats retrained OSCP at matched budget, and is not matched by four-step guided sampling at equal latency. It fails cleanly if the guided and unguided students are statistically indistinguishable. That outcome would mean the benefit of negative guidance lives in the iterative correction itself and cannot be compressed into a fixed map. The cost accounting is a second check that the proposal must pass to support its framing. If distillation with a refreshed adversarial pool costs as much as adversarial training, the overhead claim does not hold, and we will report that the fixed-pool variant is the only one that saves compute.
References
- Diffusion Models for Adversarial Purification
- Diffusion Models Demand Contrastive Guidance for Adversarial Purification to Advance
- Adversarial guided diffusion models for adversarial purification
- MFSR: MeanFlow Distillation for One Step Real-World Image Super Resolution
- Continuous Adversarial MeanFlow Transfer
- Instant Adversarial Purification with Adversarial Consistency Distillation
- Negative Token Merging: Image-based Adversarial Feature Guidance
- FashionR2R: Texture-preserving Rendered-to-Real Image Translation with Diffusion Models
- ATAC: Augmentation-Based Test-Time Adversarial Correction for CLIP
- Is RobustBench/AutoAttack a suitable Benchmark for Adversarial Robustness?
- Robustness Tokens: Towards Adversarial Robustness of Transformers