Blind-Budget Preprocessors: Adversarially Trained Denoisers That Leave Clean Images Alone

Defenses against adversarial examples, meaning tiny worst-case input perturbations that flip a classifier's prediction, usually cost accuracy on ordinary clean inputs. When the defense is a preprocessing filter, the cause is easy to see. Filters such as diffusion purification apply the same fixed cleaning strength to every image, so clean images get scrubbed as hard as attacked ones. Image denoising faced the same problem years ago under a different name. Early denoisers needed to be told the noise level. Set it too high and they erased texture; set it too low and grain remained. "Blind" denoisers fixed this by training a single residual network over a continuous range of noise levels. Such a network works out how much to remove from the input itself, and when there is nothing to remove it outputs roughly nothing.

This note proposes carrying that recipe into adversarial defense and testing it honestly. We would train a small, deterministic, single-pass residual denoiser in front of a frozen, normally trained classifier. The denoiser is trained adversarially end to end, over a continuous range of unknown attack budgets that includes zero. A helper-example loss borrowed from margin-reduction work stops it from over-correcting. The question is whether this recovers the clean accuracy that input defenses usually lose, without a separate "is this attacked?" gate that an attacker could fool. It must also survive attacks that see the whole pipeline, and it must transfer across classifiers that cannot be retrained.

Core Claim

Clean-accuracy loss in input-level defenses is excess correction. The preprocessor changes clean inputs that needed no change, the input-space analogue of the "excessive margin" that Reducing Excessive Margin to Achieve a Better Accuracy vs. Robustness Trade-off found in adversarially trained classifiers. Two ingredients should remove most of that excess.

The first is blind training over budgets. Attack budgets are sampled from a continuous range with mass at zero, the way blind denoisers such as Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising sample noise levels. The residual network then learns to output near-zero corrections on unperturbed inputs.

The second is helper anchoring. The preprocessor is explicitly told not to make predictions invariant beyond the budget it needs.

Because the whole pipeline is deterministic and differentiable, its robustness can be measured directly with AutoAttack. It does not rely on stochasticity or shattered gradients.

Written out, let $f$ be the frozen standard classifier, $D_\theta(x) = x - R_\theta(x)$ the residual preprocessor, and $\delta$ an attack found against $f \circ D_\theta$ within a budget $\epsilon$. The budget is drawn per example from a distribution $p(\epsilon)$ on $[0, \epsilon_{\max}]$ with a point mass at zero. We train

$$ \min_\theta \; \mathbb{E}_{\epsilon \sim p}\Big[\mathrm{CE}\big(f(D_\theta(x)), y\big) + \beta\,\mathrm{KL}\big(f(D_\theta(x)) \,\|\, f(D_\theta(x+\delta))\big) + \gamma\,\mathrm{CE}\big(f(D_\theta(x+2\delta)), \hat y_{2\delta}\big)\Big]. $$

Here CE is cross-entropy, KL is Kullback–Leibler divergence, $\beta$ and $\gamma$ are weights, and $\hat y_{2\delta} = \arg\max f(x+2\delta)$ is the undefended classifier's own label on the helper point $x+2\delta$. The second term is the TRADES-style consistency term. The third is the Helper-based Adversarial Training (HAT) term, which penalizes pulling far-out points back to the clean label.

How This Differs From Closest Work

Four prior lines motivate this design or rule out alternatives to it.

Defense Against Adversarial Attacks Using High-Level Representation Guided Denoiser is the closest ancestor. It trained a U-Net to remove precomputed adversarial noise using a classifier-feature loss, and showed that pixel fidelity is not what matters. However, it was trained on a fixed set of non-adaptive attacks, and Obfuscated Gradients Give a False Sense of Security showed that such preprocessors fall to adaptive attacks. We differ in three ways: attacks are regenerated through the current denoiser at every step, the budget is blind, and there is an explicit anti-over-correction term.

Towards Better Adversarial Purification via Adversarial Denoising Diffusion Training also retrains a denoiser on adversarial examples. It does so inside a costly stochastic diffusion model and targets robustness rather than clean accuracy. We keep a single deterministic pass and measure clean loss as the primary quantity.

IntensPure is the clearest evidence for the gap: adapting strength to estimated attack intensity kept benign re-identification accuracy at 88.36% where DiffPure fell to 74.73%. But its estimator depends on re-identification rank and attribute heads, and it acts as a detector-like gate that was never tested against adaptive attacks. We have no gate. The "strength" is implicit in the residual network that the attacker differentiates through.

Finally, Blind Adversarial Training adapts per-instance budgets during classifier training, and HAT anchors margins in classifier weights. We move both ideas out of the classifier and into a plug-in module. That module is the only option when the classifier cannot be retrained.

Research Program

The build has three parts.

First, we pretrain a DnCNN-style residual denoiser on blind Gaussian denoising over a continuous noise range including zero. This gives the network an identity-like starting point on clean inputs.

Second, we fine-tune it with the objective above against a frozen standard WideResNet or PreAct ResNet-18 trained with the HAT codebase's standard-training script. Attacks are generated with PGD through $f \circ D_\theta$ at per-example budgets from $p(\epsilon)$.

Third, we analyze what the module does. We measure the norm of $R_\theta(x)$ on clean versus attacked inputs as a function of budget. We also measure margin along adversarial directions, following the analysis in the excessive-margin paper, to test whether the helper term actually reduces over-correction and does not just shift numbers.

The key scientific question is attribution: how much of any clean-accuracy gain comes from the blind budget distribution, how much from the helper term, and how much from the denoising prior itself.

Baselines

The naive reference points are the undefended standard classifier, which sets the clean-accuracy ceiling and near-zero robustness, and the same classifier behind a pretrained blind Gaussian denoiser with no adversarial training. The latter shows what "denoising alone" buys.

The strongest existing input-level competitor is diffusion purification, Diffusion Models for Adversarial Purification. We would run it on the same frozen classifier and evaluate it with the exact-gradient DiffGrad tools and deterministic white-box seeds. Under those tools, Unlocking The Potential of Adaptive Attacks on Diffusion-Based Purification reports that diffusion-purification robust accuracy on CIFAR-10 drops from about 62% to 17.19%. I found no reported absolute clean-accuracy number for DiffPure on CIFAR-10 on Lacuna, so we would measure it ourselves. Beating it means higher clean accuracy and higher exact-adaptive robust accuracy at a fraction of its cost.

The strongest method overall, and the one we treat as an upper reference rather than something we expect to beat, is HAT trained on the full classifier. Its paper reports about 49% AutoAttack robustness on PreAct ResNet-18 for CIFAR-10, with clean accuracy about 2.17 points above TRADES. With extra DDPM data and wider networks it reaches 91.30% clean and 62.50% robust. On CIFAR-100, Blind Adversarial Training reports 63.7% clean accuracy against 57.5% for PGD adversarial training.

We would also run TRADES-trained preprocessors under the same frozen-classifier constraint, with identical attack steps, epochs, and hyperparameter search budget. Success is a preprocessor that, at matched AutoAttack robustness, keeps clean accuracy measurably closer to the undefended ceiling than both a TRADES-trained preprocessor and diffusion purification. A secondary success criterion is coming within a few points of full-classifier HAT robustness while touching no classifier weights.

The ablations isolate each ingredient. One replaces blind budgets with a fixed budget. One removes the helper term. One replaces the denoiser with a randomly initialized network of equal parameter count, which tests whether the denoising prior matters. The most important one replaces the denoiser with an equally sized trainable classifier stem, meaning the first few layers of $f$ unfrozen.

Why not just…?

Why not just adversarially train the classifier with HAT? When retraining is allowed, this is a real threat. A preprocessor plus a frozen classifier is strictly less flexible than training everything, and we expect full HAT to remain ahead on robustness. The proposal's case rests on the frozen-classifier regime and on transfer. If a preprocessor trained against classifier A, then attacked end to end together with classifier B, retains most of its robustness, it offers something HAT cannot. That cross-model transfer is what HGD reported in the non-adaptive setting. If transfer fails under adaptive attack, the claim shrinks to "parameter-efficient adversarial training," and we would report that plainly.

Why not just unfreeze the first layers of the classifier instead of adding a denoiser? This is the sharpest skeptic, because $D_\theta$ could simply be extra early layers. The stem ablation settles it. At matched trainable parameters, budget, and attack compute, the denoiser must show either a better clean/robust trade-off or better transfer across classifiers. If it shows neither, the "blind denoising" framing adds nothing, and we would say so.

Why not just use fixed-timestep diffusion purification? It over-cleans benign inputs, as the IntensPure Market1501 drop to 74.73% shows. It also collapses under exact adaptive gradients (17.19% on CIFAR-10, and about 0% under the low-frequency attack) and costs 366 ms per image. We rerun it rather than rely on these numbers alone.

Why not just detect attacks and denoise only flagged inputs? A gate that passes "clean-looking" inputs untouched is a detector. Adversarial Examples Are Not Easily Detected bypassed all ten detectors it tested with roughly 10% more distortion. Our design deliberately has no discrete decision for the attacker to target. We still run an attack that specifically minimizes $\|R_\theta(x+\delta)\|$ while fooling $f$, to check that the implicit strength cannot be driven to zero.

Proposed Experiments

We run on CIFAR-10 and CIFAR-100 at $\ell_\infty$ budgets of 8/255, plus a sweep from 0 to 16/255 scored by average adversarial accuracy (avg-AA) in the style of Blind Adversarial Training. We then scale to ImageNet-100 with a frozen pretrained ResNet-50.

The robustness evaluation is full AutoAttack from RobustBench on the end-to-end pipeline. We add three checks. The first is identity-BPDA and transfer attacks, to confirm that the end-to-end gradients are not masked. The second is the attack-failure diagnostics from Indicators of Attack Failure. The third is the residual-suppression attack described above.

Because blind denoising exists to handle benign noise, we also measure benign accuracy on test images corrupted with Gaussian and Poisson–Gaussian noise at unknown levels, including zero. An adversarially trained classifier gets no help on such inputs, whereas the preprocessor might. Real-camera noise in the style of SIDD, as described in the NTIRE 2019 Challenge on Real Image Denoising, is an optional extension at ImageNet-100 resolution.

There are two decisive checks. The first is whether, at matched AutoAttack robustness, the blind-budget, helper-anchored preprocessor loses less clean accuracy than the fixed-budget and no-helper ablations and the equal-size stem. The second is whether its robustness survives white-box end-to-end attack when paired with a classifier it was not trained with. Positive answers to both justify the idea. A positive first answer with a negative second means the result is an efficient adversarial-training trick, not a plug-in defense.