Learned Perturbation Distributions for Single-Step Adversarial Training

Adversarial training makes a classifier robust by training it on inputs that have been deliberately nudged to fool it. Finding a good nudge usually takes 7 to 20 extra gradient computations per training step, so robust training costs roughly 7 to 30 times more than ordinary training. The cheap alternative takes a single gradient step from a random starting point. It is fast, but it is fragile. It can suddenly undergo "catastrophic overfitting": the model learns to resist the one-step attack it is trained on while staying defenseless against stronger multi-step attacks.

This proposal treats the random starting point of single-step training as what it really is: a crude, fixed probability distribution over perturbations, namely uniform noise in a small box around each input. We propose to replace it with a learned distribution, $q_\phi(\delta \mid x, y)$, a small conditional generative model that outputs a whole spread of perturbations for each input. It is trained alongside the classifier to put mass on high-loss perturbations while keeping that mass spread out. The question that ties the two research directions together is how expressive this distribution needs to be. Variational-inference research shows that simple factorized Gaussians collapse onto one mode and underestimate spread. The catastrophic-overfitting literature shows that single-step training fails when its perturbations pile up on one boundary of the allowed region. We hypothesize that these are the same failure, and that a richer family of perturbation distributions prevents it at FGSM-level cost (FGSM is the fast gradient sign method, the standard one-step attack).

Core Claim

Single-step adversarial training avoids catastrophic overfitting when its perturbations come from a learned, entropy-regularized distribution that is expressive enough to cover several distinct high-loss regions of the allowed perturbation set. In practice, this means a normalizing flow (an invertible neural network whose output density can be computed exactly). Such training should match multi-step PGD robustness under AutoAttack at the cost of Fast adversarial training. Projected gradient descent (PGD) is the standard multi-step attack, and AutoAttack is the standardized attack suite behind RobustBench. Factorized Gaussian or uniform perturbation families should fail precisely in the regimes where overfitting is worst: larger perturbation budgets and longer training schedules.

The adversary is trained to maximize

$$ J(\phi) = \mathbb{E}_{\delta \sim q_\phi(\cdot \mid x,y)}\big[\mathcal{L}(f_\theta(x+\delta), y)\big] + \tau\, \mathcal{H}\big(q_\phi(\cdot \mid x, y)\big), $$

where $f_\theta$ is the classifier, $\mathcal{L}$ its training loss, $\mathcal{H}$ the differential entropy of the perturbation distribution, and $\tau > 0$ a temperature. The maximizer of $J$ is the Gibbs distribution $p_\tau(\delta \mid x,y) \propto \exp(\mathcal{L}/\tau)$ restricted to the $\ell_\infty$ ball of radius $\epsilon$. Maximizing $J$ is therefore exactly variational inference, by reverse Kullback–Leibler divergence, toward a "posterior over attacks." The same mode-seeking bias that makes factorized Gaussians underestimate posterior spread in the analysis of Variational Inference with Normalizing Flows should make a factorized perturbation distribution collapse onto a single attack direction.

The mechanism links directly to the diagnosis in Understanding Catastrophic Overfitting in Single-step Adversarial Training. That paper finds that catastrophic overfitting comes from decision-boundary distortion: the model resists perturbations of size exactly $\epsilon$ but fails at intermediate scales $k\epsilon$. An adversary distribution that keeps entropy over the whole ball keeps training on those intermediate scales automatically, with no extra line search.

Relation to Prior Work

Two existing methods supply the cost model we must match. Fast is better than free takes one FGSM step from a uniform random start. Adversarial training for free! replays each minibatch several times and reuses the input gradient from each weight update to advance the perturbation. We reuse that same trick: the gradient of $J$ with respect to $\phi$ needs only $\nabla_\delta \mathcal{L}$ at sampled perturbations, which the classifier's own backward pass already produces.

Two lines of work show that perturbations or attacks can be amortized, meaning produced by a trained generator instead of searched for per input. VERA fits a variational distribution over jailbreak prompts with an entropy term. Dual-Flow learns a deterministic ODE flow that produces transferable image attacks. Both are offline attacks against fixed victims. Dual-Flow's generator alone costs about 48 GPU hours, and its authors deliberately avoid stochastic formulations. We differ in three ways. Our adversary lives inside the training loop, tracks a moving classifier, and is stochastic by design, because the spread of the distribution is the hypothesized cure.

Rob-GAN combines a generator with adversarial training. However, its generator augments data while PGD still runs every iteration, so per-step cost stays high.

Bayesian defenses are a cautionary precedent rather than a method source. Defense Through Diverse Directions reports strong PGD robustness from stochastic Gaussian weights. Comment on "Adv-BNN" shows that such robustness largely disappears under attacks that average gradients over the randomness. We avoid this trap by construction. All randomness lives in the training-time adversary, and the deployed classifier is deterministic, so standard RobustBench AutoAttack evaluation applies with no gradient-masking loophole.

Finally, Adversarial robustness of amortized Bayesian inference is the closest paper connecting expressive variational families with adversarial cost. It defends a flow-based posterior estimator with a Fisher-information penalty that still costs 4× vanilla training. It explicitly leaves open using a flow as the adversary, which is the role we give it.

Research Program

The adversary is a conditional flow defined in an unconstrained space and then squashed into the $\ell_\infty$ ball by $\epsilon \tanh(\cdot)$. Including the log-determinant of the squash in the density keeps the entropy computable exactly. The flow is a few affine coupling layers, conditioned on a lightweight embedding of $x$ and $y$, and kept under 5% of the classifier's floating-point operations. The temperature $\tau$ is not hand-tuned. It is adjusted automatically to hold the adversary's entropy at a target fraction of the uniform distribution's entropy, which replaces one sensitive hyperparameter with an interpretable one.

We run two cost tiers. The one-pass tier recycles gradients in the manner of Free adversarial training: each classifier forward and backward pass on $x+\delta$ updates both $\theta$ and $\phi$. The two-pass tier matches Fast adversarial training's budget exactly. The flow additionally receives the sign of one input gradient at a random point and learns the distribution of step sizes and directions around it, giving a learned, input-dependent replacement for "uniform start plus fixed step."

The analysis has two parts. Throughout training we track the three signatures of catastrophic overfitting reported in the overfitting paper: the gap between single-step and PGD-50 accuracy, robustness at $\tfrac13\epsilon$ and $\tfrac23\epsilon$, and spikes in input-gradient norm, which the paper reports grow up to 35-fold. We also measure how many distinct high-loss regions the adversary covers by clustering its samples per input. This tests whether expressivity, rather than entropy alone, is what matters.

Baselines

The naive reference is FGSM from a uniform random start, run without early stopping and at larger step sizes. This configuration is known to overfit catastrophically; plain FGSM training reportedly falls to 0.1% PGD-50 accuracy on CIFAR-10 in Understanding Catastrophic Overfitting. We must at least avoid this collapse.

The strongest cost-matched competitor is Fast adversarial training Fast is better than free, which reports 45% PGD robust accuracy on CIFAR-10 in 6 minutes and 43% on ImageNet in 12 hours. Free adversarial training Adversarial training for free! reports about 46% against PGD-20 on CIFAR-10. The adaptive-checkpoint single-step method of Understanding Catastrophic Overfitting is the strongest dedicated fix for overfitting, reporting 33.9% PGD-50 accuracy in 3.9 hours versus 11.1 hours for PGD-7. The file reports no AutoAttack number on Lacuna for any of these, and its wall-clock figures come from different hardware and settings. We will therefore rerun all baselines ourselves on the same architecture, data, epoch schedule, GPU type, and hyperparameter-search budget (an equal number of trials per method). We report AutoAttack accuracy, PGD-50 accuracy, clean accuracy, and wall-clock time. PGD-7 serves as the expensive reference ceiling.

"Beating" a baseline means one of two things. Either we match Fast adversarial training's wall-clock time within 15% while exceeding its AutoAttack accuracy at large $\epsilon$, or we reach PGD-7's AutoAttack accuracy within one point at at least 3× lower cost. In addition, catastrophic overfitting must not occur in any of five seeds, at budgets where Fast adversarial training overfits in some seeds.

The key ablation swaps the flow for a factorized Gaussian over the unconstrained space. The swap keeps the squash, the entropy target, the conditioning network, and the cost the same, and changes only the family's expressivity. A second ablation sets $\tau=0$, giving a deterministic amortized generator in the spirit of Dual-Flow, to isolate the entropy term.

Why not just…?

Why not just use Fast adversarial training with careful tuning and early stopping? It works when tuned, but its own authors and the overfitting analysis both report sensitivity to step size, with collapse when misconfigured. Early stopping also forfeits the gains of longer training. Our seed-by-budget grid will show whether careful tuning alone closes the gap. If Fast adversarial training never overfits in any configuration we test, that is a real threat to the motivation. In that case we would report the result and restrict the claim to the large-$\epsilon$ regime, or abandon it.

Why not just use the adaptive checkpoint search or Free adversarial training? The checkpoint method fixes boundary distortion by brute-force evaluation along one line, at extra forward-pass cost. Free adversarial training trades clean accuracy for replay depth. Our method addresses the same failure by learning where to put mass, at no extra passes in the one-pass tier. The matched-budget comparison above decides which approach is better.

Why not just a Gaussian or uniform noise distribution with the entropy term, with no flow at all? This is the most serious alternative. It may be that entropy alone, rather than expressivity, prevents overfitting. The Gaussian ablation is designed to settle exactly this question. Expressivity should matter only if the loss surface inside the ball has several separated maxima. We therefore predict the flow's advantage grows with $\epsilon$ and with the number of high-loss clusters we measure. If the Gaussian matches the flow everywhere, the honest conclusion is that a cheap entropy-regularized learned adversary suffices. That would still be a useful and simpler method, and we would present it that way.

Why not just learn robustness tokens on a frozen backbone? Robustness Tokens restores DINOv2-G accuracy under attack from 0.3% to 63.1%. It is, however, specific to large Vision Transformers, and its security depends on keeping the tokens secret. It addresses fine-tuning a pretrained model, not robust training from scratch, so it is complementary rather than a substitute.

Proposed Experiments

The main study uses CIFAR-10 with a PreAct ResNet-18 at $\epsilon \in \{8/255, 12/255, 16/255\}$ with the $\ell_\infty$ norm, five seeds each, and short and long schedules. This grid deliberately spans the regime where Fast adversarial training is reported to work and the regime where catastrophic overfitting dominates. All final models are evaluated with the RobustBench AutoAttack protocol, alongside clean accuracy, wall-clock time, and the overfitting diagnostics.

The decisive checks are three:

  • whether the flow adversary never overfits at 16/255 while the uniform and Gaussian families do;
  • whether its AutoAttack accuracy tracks PGD-7 within a point at Fast-level cost;
  • whether robustness at intermediate scales $k\epsilon$ stays flat. Flat intermediate-scale robustness would confirm that the mechanism is the one proposed: mass spread over the ball, not a lucky step size.

A scaled check on ImageNet, compared against the reported 43% for Fast adversarial training at 12 hours, tests whether the conditioning network's overhead stays negligible at resolution. If the CIFAR-10 results hold, a final small experiment would reuse the adversary to robustify the amortized posterior networks of Adversarial robustness of amortized Bayesian inference. There we would replace its 4× Fisher penalty with a KL-based Gibbs adversary and compare cost and robustness on its SIR and Lotka–Volterra tasks.