Adversarial Training at the Cost of Standard Training, Using Stale Perturbations

Adversarial training teaches a network to resist small, worst-case input perturbations by training on them. It usually costs 7 to 30 times more than ordinary training, because each weight update waits for an inner attack loop of several forward and backward passes. "Free" adversarial training removes most of that cost. It reuses the input gradient that every backward pass already computes, so one pass updates both the weights and the perturbation. To build a strong attack it must replay each mini-batch several times, and that replay costs clean accuracy. We propose a different route to the same saving. Store one perturbation per training example. Each time the example comes back in a later epoch, train on the stored perturbation and advance it by one step using the gradient that the weight update already produced. Training then costs exactly one forward and one backward pass per example per epoch, the same as standard training, with no replay.

The enabling property is a kind of transferability. A perturbation crafted against the network at one epoch has to stay adversarial against the slightly different network one epoch later. Earlier work shows this holds when perturbations are refined in a separate attack pass. Nobody has used it inside a single shared backward pass, and nobody has measured when it breaks. That measurement comes for free, because the forward pass already reports how much loss the stale perturbation still causes. We use it as a controller that spends extra computation only on examples whose stored perturbation has stopped working.

Core Claim

Per-example perturbation memory, advanced by recycled gradients at one step per epoch, can match the robustness of mini-batch replay at lower wall-clock cost and higher clean accuracy. How much robustness it keeps is governed by a quantity we can observe directly: the fraction of its original loss increase that a stored perturbation still produces one epoch later. When this "carry-over ratio" is high, stale perturbations are nearly as good as fresh ones. When it is low, which we expect early in training, after learning-rate changes, and for hard examples, a small budget of targeted refresh steps restores robustness.

Where This Sits in Prior Work

Two papers supply the mechanism. Adversarial training for free! introduced gradient recycling with mini-batch replay: each batch is shown $M$ times, and the perturbation advances once per replay. It reports about 46% accuracy against a 20-step projected gradient descent (PGD) attack on CIFAR-10 in about 13 hours, and it documents that larger $M$ lowers clean accuracy because each epoch sees fewer distinct batches. Its perturbation is warm-started across batches of different images. It is therefore a running "universal-ish" direction, not a per-example attack. Efficient Adversarial Training With Transferable Adversarial Examples (ATTA) showed the complementary fact: per-example perturbations carried across epochs keep their strength. It reuses them through a "connection function" that undoes random crops and flips. It reports a 14.1× speedup over 40-step PGD on CIFAR-10 and up to 7.2% higher robust accuracy than the standard PGD baseline. ATTA still runs a separate attack pass before each weight pass, so it pays roughly twice the cost of standard training. We take ATTA's cross-epoch memory and connection function, drop its separate attack pass in favor of Free AT's shared backward pass, and set $M=1$.

Other work constrains the design. Stability and Generalization in Free Adversarial Training argues that Free AT generalizes well because weights and perturbations co-evolve. It reports a robust generalization gap of 6.9% versus 34.4% for sequential training under $L_2$ attacks on CIFAR-10. Our perturbations are one epoch stale, which weakens that coupling, so the gap is a result we must report, not assume. Layer-Aware Analysis of Catastrophic Overfitting shows that single-step training can suddenly lose all multi-step robustness through large early-layer "shortcut" weights. Its layer-aware weight perturbation (LAP) prevents this at 7% extra cost and reaches 19.55% AutoAttack accuracy at $\epsilon=16/255$ on CIFAR-10. Our method is a one-step-per-visit method, so it is exposed to the same failure, and LAP is both a competitor and a possible add-on. Fast AdvProp reaches about 1× cost with recycled gradients, but only for corruption robustness and clean accuracy, and it depends on batch normalization tricks. Its setting differs from ours, which targets worst-case robustness. Its reliance on batch normalization is a warning for our Vision Transformer experiment, since those models use a different normalization scheme.

Cross-model transferability enters as an evaluation tool. Stability and Generalization in Free Adversarial Training uses transfer attacks to show that robustness is not an artifact of broken gradients, and we do the same. Why Does Little Robustness Help? and Early Stop And Adversarial Training Yield Better surrogate Model explain why lightly robust models make strong attack sources: smoothness trades off against gradient similarity. That lets us ask a secondary question with a clear prediction. Do stored perturbations, which were optimized against a moving sequence of weights, transfer to independently trained models better than fresh PGD perturbations do?

The Method

For example $i$ we keep a stored perturbation $\delta_i$ and the loss $\ell_i^{\text{old}}$ it produced when it was last updated. On each visit at weights $\theta$, the network sees the augmented input $x_i+\delta_i$, after the connection function has mapped $\delta_i$ into the current crop and flip. One backward pass then gives both gradients. The weights take their usual step. The perturbation takes a signed step, is projected back into the $\epsilon$-ball, and is written back to memory. The carry-over ratio is

$$ \rho_i = \frac{\mathcal{L}(\theta, x_i+\delta_i, y_i) - \mathcal{L}(\theta, x_i, y_i)}{\ell_i^{\text{old}} - \ell_i^{\text{clean,old}}}, $$

In this ratio, the numerator is the loss increase that the stale perturbation causes under the current weights, and the denominator is the increase it caused when it was created. The ratio is a direct measure of temporal transferability. The adversarial term of the numerator comes from the pass we already run. The clean terms are the one thing the core loop does not supply, and we handle them in one of two ways. We can log them from occasional clean passes on a small audit subset, or we can replace the ratio with the cheaper $\mathcal{L}(\theta,x_i+\delta_i,y_i)/\ell_i^{\text{old}}$. We will check that the two versions rank examples the same way.

The controller works with a fixed extra-compute budget $b$, for example 10% of samples per batch. The examples with the lowest $\rho_i$ receive one extra replay step. With $b=0$ the method costs 1×. Memory is the main expense. On CIFAR-10 the stored perturbations fit in a few hundred megabytes even at full precision, and much less if stored as 8-bit integers, since each update is a signed step inside a small ball. On ImageNet they sit in host memory or on disk and stream with the data loader, following what ATTA already did at that scale.

Research Program

The first stage is descriptive. We track $\rho$ across training on CIFAR-10 with PreActResNet-18 and WideResNet-34. We look at how it varies with epoch, learning-rate schedule, per-class difficulty, and augmentation strength, and we test whether its distribution predicts final robust accuracy. The second stage tests the core claim. At $b=0$, does per-example memory plus recycled gradients match replay-based Free AT at equal or lower wall-clock time? The third stage tests the controller: does spending $b$ on low-$\rho$ examples beat spending the same $b$ on random examples? The fourth stage covers failure modes. We look for catastrophic overfitting at $\epsilon=8/255$ and $16/255$ and measure the robust generalization gap against Cheng et al.'s numbers. We then scale to Tiny-ImageNet, to ImageNet with ResNet-50, and to ViT-Small, where batch normalization tricks are unavailable.

Baselines

The naive reference points are standard training (zero robustness, 1× cost) and 10-step PGD adversarial training (the robustness ceiling at roughly 11× cost). The strongest existing method on this question is Free AT from Adversarial training for free!, because it is the only published method that already uses shared backward passes and targets worst-case robustness. The number to beat on CIFAR-10 is its reported ~46% PGD-20 accuracy in about 13 hours. On ImageNet it is 40% PGD accuracy for ResNet-50 trained in 2 days on 4 GPUs. We rerun Free AT ourselves with $M\in\{2,4,8\}$, the same architecture, augmentation, and learning-rate schedule, and the same total number of backward passes as our method plus its budget. Hyperparameters get an equal tuning budget of the same number of grid points for each method. Beating it means equal or higher AutoAttack accuracy with higher clean accuracy at equal wall-clock time, or equal accuracy in less time.

ATTA from Efficient Adversarial Training With Transferable Adversarial Examples is the closest relative. It uses the same memory with a decoupled attack pass, and it reports a 14.1× speedup over PGD-40 and 97 hours for ImageNet ResNet-50 on one GPU. We run ATTA-1 with an identical connection function. Our method should roughly halve its per-epoch time while giving up at most about one point of AutoAttack accuracy. LAP from Layer-Aware Analysis of Catastrophic Overfitting is the strongest single-step competitor at about 2× cost, with 19.55% AutoAttack at $\epsilon=16/255$. We compare against it at matched wall-clock and also test LAP combined with our method.

Three ablations isolate the key ingredients. The first is Free AT at $M=1$ with its original cross-batch warm start. It tests whether per-example memory is what matters. The second is per-example memory where the refresh budget goes to random rather than low-$\rho$ examples. It tests whether the carry-over signal matters. The third removes the connection function, which tests whether alignment under augmentation matters.

Why not just…?

Why not just use Free AT with a small replay factor? This is the most direct threat. The answer depends on whether one step per epoch on a per-example perturbation beats $M$ steps on a perturbation that jumps between different images. The $M=1$ cross-batch ablation and the $M\in\{2,4\}$ sweep settle it directly. If $M=2$ Free AT matches us at equal time, the memory is not worth its storage and we will say so.

Why not just run ATTA, which already works? ATTA's reported speedups are relative to 40-step PGD. Its separate attack pass still roughly doubles per-epoch cost over standard training. The question is whether folding that pass into the weight pass loses robustness because the perturbation is computed at weights one step older. Matched-time comparison against our own ATTA-1 run answers this. If the robustness loss exceeds the halving of cost, ATTA remains the better choice.

Why not just use fast single-step training (FGSM with a random start) plus LAP? At about 2× cost this is simple and well understood, and plain single-step training at $\epsilon=16/255$ collapses to 0% AutoAttack according to Layer-Aware Analysis of Catastrophic Overfitting. Accumulating perturbations across epochs may avoid that collapse or may reproduce it. We will plot multi-step robustness per epoch to see which. If our method overfits catastrophically and LAP does not, the honest conclusion is that memory must be combined with LAP, and we test that combination.

Why not just freeze the backbone and tune a few robustness tokens? Robustness Tokens is very cheap, but it protects a frozen model only while its tokens stay secret. Its inner attack still runs sequentially. It addresses a different threat model from full-model robustness, so we treat it as out of scope rather than as a competitor.

Proposed Experiments and Decisive Checks

On CIFAR-10 and CIFAR-100 with PreActResNet-18 and WideResNet-34, at $L_\infty$ $\epsilon=8/255$ and $16/255$, we report clean accuracy, PGD-20 accuracy, AutoAttack accuracy, wall-clock time, total backward passes, memory, and the train–test robust gap. Tiny-ImageNet and ImageNet ResNet-50 test scale. ViT-Small tests whether the method needs batch normalization. For Tiny-ImageNet, CIFAR-100, and SVHN, no reported numerical result was found on Lacuna for Free AT or LAP, so we rerun both.

To rule out broken gradients, we attack each model with transfer attacks crafted on independently trained standard and robust models. Robust accuracy under transfer attacks must exceed white-box accuracy. As a secondary study, we measure how well final stored perturbations transfer to held-out architectures (VGG16, DenseNet, ViT-Small) compared with fresh PGD perturbations crafted on the same model. The smoothness–similarity account in Why Does Little Robustness Help? predicts that perturbations optimized against a moving sequence of weights will transfer better.

Three results decide the claim. First, at 1× cost our method must reach AutoAttack accuracy within two points of our Free AT reproduction at its best $M$, with higher clean accuracy. Second, low-$\rho$ targeting must beat random targeting at every budget $b$. Third, $\rho$ measured early in training must correlate with final per-class robust accuracy. If the first check fails, temporal transferability through shared gradients is too weak and the method is not viable. If only the second fails, the carry-over ratio is a useful diagnostic but not a useful controller.