Adversarial training makes image classifiers resistant to tiny worst-case input perturbations. It does this by attacking the model during training: for every batch it first searches for the most damaging perturbation and then updates on it. That search multiplies training cost by roughly 7 to 30 times. A separate line of work borrows predictive coding, the idea that higher layers send predictions down to lower layers and only the mismatch (the "prediction error") is passed back up. It adds learned top-down feedback to a frozen classifier, trains that feedback only to reconstruct clean images, and lets the network iterate for several steps at test time. These papers report that attacks lose force as the iterations proceed, at no adversarial-training cost. But the cost has moved to inference, which runs 5 to 19 times slower. The robustness has also never been tested against an attacker who differentiates through the whole iterative loop.
This note asks whether clean-trained predictive feedback is a cheap complement to cheap adversarial training rather than a substitute for it. The design attaches predictive feedback to a backbone trained with single-step fast adversarial training, attacks the combined system end to end with the standard AutoAttack suite, and turns the feedback on only for inputs whose lowest-layer prediction error is unusually large. Every method is then charged for its total compute, training plus deployment. The core claim is falsifiable. If hierarchical prediction-error correction adds genuine worst-case robustness on top of fast adversarial training, then a gated version should beat simply spending the same compute on more adversarial training, for any realistic deployment volume. If it does not, the reported robustness of predictive-coding defenses is largely an evaluation artifact. Either result settles a question the literature has left open.
What exists and what is missing
Three papers build the predictive-coding defense this proposal starts from. Brain-inspired predictive coding dynamics improve the robustness of deep neural networks pairs a pretrained VGG16 with deconvolutional feedback blocks trained on clean reconstruction. Over 19 iterations, it raises Gaussian-noise accuracy from 35.25% to over 50%, and it raises the median Carlini-Wagner perturbation needed to fool the model from 1.98×10⁻³ to 5.9×10⁻³. Predify packages this as a PyTorch library and reports targeted attack success decaying across iterations. On the role of feedback in image recognition under noise and adversarial attacks extends the approach to ResNet18 and EfficientNetB0 and searches the four mixing weights: memory, feedforward drive, feedback drive, and error correction.
That last paper supplies the two observations this proposal relies on. First, tuned networks choose almost pure feedforward processing on clean images and turn feedback up only as noise grows. Second, error correction matters most at the lowest layers. Together these suggest that feedback is needed only on some inputs, and that the lowest-layer error is a natural signal for deciding which ones.
All three papers share three gaps that this proposal targets directly. Their backbones are trained on clean data only, so it is unknown whether feedback adds anything once the backbone is already robust. Their attacks either did not backpropagate through the unrolled loop or used heuristic attacks such as BIM, RPGD, and HopSkipJump. This matters because RobustBench found that published defenses often overstate robustness, sometimes by more than 10 points. RobustBench also excludes models with inference-time optimization loops precisely because such loops tend to hide gradients from the attacker. Finally, none of the three counts the inference bill.
The adversarial-training side supplies the backbone and the main competitors. Fast is better than free shows that a single attack step from a random starting point, combined with cyclic learning rates, trains a CIFAR-10 model in minutes. Adversarial training for free! reuses one backward pass for both weights and perturbation by replaying each minibatch several times. Both suffer from catastrophic overfitting, in which robustness against multi-step attacks suddenly collapses to near zero. Understanding Catastrophic Overfitting in Single-step Adversarial Training ties this collapse to distorted decision boundaries and up to 35-fold spikes in input-gradient norm, and counters it with checkpoint search.
Two further papers constrain the design. Bad Predictive Coding Activation Functions shows that ReLU's flat region creates spurious stationary points in predictive-coding dynamics, so the experiments include smooth-activation variants. Tight Stability, Convergence, and Robustness Bounds for Predictive Coding Networks proves exponential recovery from random perturbations only. Its result therefore offers no assurance against worst-case perturbations, and this proposal treats it that way.
Core Claim
The proposal makes three claims, each of which can be tested on its own:
- Complementarity. Clean-trained hierarchical feedback corrects a part of the perturbation that a fast-adversarially-trained backbone leaves uncorrected, and this survives a fully adaptive attacker. The mechanism is that the feedback projects early-layer activations back toward the clean-image manifold, which single-step training does not explicitly encourage.
- Gating. Because this correction is needed mainly when the lowest-layer prediction error is high, a threshold on that error can keep most clean inputs at single-pass cost.
- Price. The relevant comparison is robust accuracy per unit of total compute. That is what decides whether the feedback is worth deploying.
Research Program
The system. The system is a ResNet18, written PResNet18, augmented using the Predify recipe and trained on CIFAR-10 and CIFAR-100. It is chosen because On the role of feedback already made the ResNet variant work, and Predify itself noted skip connections as a difficulty. Training happens in three stages:
- The feedforward weights are trained with fast adversarial training, using a random start and an L∞ budget of 8/255. Checkpoint selection follows the catastrophic-overfitting paper.
- The backbone is frozen, and the feedback decoders are trained to reconstruct the layer below on clean images. This costs a few clean epochs of decoder training and involves no attack.
- The four mixing weights are tuned on a held-out set of clean and FGSM-perturbed images.
The gate. At inference, one feedforward pass plus one decoder call at the lowest stage gives the first-layer prediction error. If that error is below a threshold, calibrated as a percentile of clean validation errors, the model outputs immediately. Otherwise it runs T further iterations.
The cost metric. Every method is scored by
$$C(N) = C_{\text{train}} + N \cdot c_{\text{fwd}} \cdot \left(1 + \rho\,(T-1)\,\kappa\right),$$
where $C_{\text{train}}$ is training FLOPs and $N$ is the number of images served. $c_{\text{fwd}}$ is the cost of one feedforward pass. $\rho$ is the fraction of inputs for which the gate fires, and $\kappa$ is the relative cost of one feedback iteration. For a standard adversarially trained model, $\rho = 0$. The proposal reports robust accuracy against $C(N)$ and the break-even $N$ at which a method stops paying for itself.
The attacker. Evaluation is the heart of the work. Every system is attacked with AutoAttack differentiating through all T unrolled iterations. The hard gate is replaced for the attacker by both its branches: the attacker attacks the always-feedback model and the never-feedback model. A further gate-aware attack adds a penalty that keeps the first-layer prediction error below threshold while flipping the label. The reported number is the worst case across all of these. Expectation over randomness is added wherever any stochasticity remains. Gradient-free Square Attack serves as a check on gradient masking: if Square beats gradient-based attacks, the gradients are being hidden.
Baselines
Naive reference points. The first is the fast-adversarially-trained backbone alone, with no feedback, at single-pass inference. Every gain in this proposal is measured against it. A second reference is the clean-trained PResNet18 with feedback, reproducing the prior-work setting under adaptive attack, to measure how much of its reported robustness survives.
Fast AT, the cheapest strong competitor. Fast AT reports 45% PGD robust accuracy on CIFAR-10 in 6 minutes, against 80 hours for multi-step PGD training (Fast is better than free). Checkpoint search reports 33.9% against PGD-50 in 3.9 hours, versus 11.1 hours for 7-step PGD training (Understanding Catastrophic Overfitting).
Free AT. Free AT reports about 46% against PGD-20 in about 13 hours (Adversarial training for free!).
A caveat on these numbers. These figures come from PGD, not AutoAttack. No reported AutoAttack result was found on Lacuna for Fast AT or Free AT on CIFAR-10 in these papers, so all baselines will be re-run under the identical AutoAttack protocol.
The compute-matched competitor. This is the most important baseline: give the backbone the feedback system's extra compute as additional adversarial training. That means more multi-step PGD steps or more epochs, chosen so that $C(N)$ matches at a stated deployment volume.
Fairness. All methods share the same architecture, data, and augmentation, and receive equal hyperparameter-search trials, measured in GPU-hours.
What counts as beating them. The proposal succeeds if the gated feedback model exceeds the compute-matched adversarial-training model in worst-case AutoAttack accuracy. The margin must lie outside the seed-to-seed spread over three seeds, at clean accuracy within one point.
Ablations. Two ablations isolate the key ingredient. The first restricts feedback to the input level, so that a single decoder purifies the image before the classifier. This tests whether hierarchy matters. The second removes the gate and always runs T iterations, which tests whether gating trades away robustness.
Why not just…?
Why not just spend the compute on more adversarial training? This is the real threat, and the proposal is built so that it can lose to it. Free AT and Fast AT already reach mid-40s PGD robustness with single-pass inference (Adversarial training for free!; Fast is better than free). If the compute-matched baseline wins at every $N$, the conclusion is that predictive feedback is not worth its price on worst-case threats. That would be reported as the finding, perhaps with feedback retained only for the natural-noise benefits shown on CIFAR100-C.
Why not just put a denoiser in front of the classifier? Input purification is simpler and needs no recurrence. The evidence against it is indirect. Prior work found error correction most useful at the lowest stages but still distributed across the hierarchy, and found unsupervised generative feedback better than end-to-end-trained feedback (On the role of feedback). Neither result separates input-level from multi-level correction, so the input-only ablation decides the question directly. If it matches the full model, the hierarchical framing should be dropped.
Why not just use parameter-efficient robustness tokens? Robustness Tokens lifts DINOv2-G white-box accuracy from 0.3% to 63.1% after 200 training steps with single-pass inference. However, the defense depends on the tokens staying secret, and it exists only for transformers. This proposal assumes a full white-box attacker who knows all feedback weights and the gate threshold, which is a stronger guarantee if it holds.
Why not just train the feedback on adversarial images? This might well work better. It is cheap to test by training the decoders on FGSM images from the frozen backbone, which adds one attack step per decoder batch. It is included as a variant. The clean-only version is kept as the primary method because prior work found that unsupervised clean reconstruction generalized better, and because it adds no attack to the training loop.
Proposed Experiments
Experiment 1: does the prior-work robustness survive? The first experiment reproduces clean-backbone PResNet18 with Predify and evaluates it under the full-unroll AutoAttack and Square protocol. This is the first test of prior predictive-coding robustness against an adaptive attacker. A large drop relative to PGD-on-the-first-pass numbers would confirm that the earlier reported robustness was masking rather than genuine correction.
Experiment 2: the main comparison. The second experiment runs the main comparison on CIFAR-10 and CIFAR-100. It plots AutoAttack accuracy against $C(N)$ for $N$ from $10^4$ to $10^8$, alongside the gate's firing rate $\rho$ on clean and attacked inputs and clean accuracy.
Experiment 3: can the attacker evade the gate? The third experiment is the gate-aware attack. If the attacker can keep first-layer error below threshold and still flip labels at high rate, gating gives no security, and only the always-on model should be costed. Two further measurements accompany this. One records the feedback model's first-layer error and the backbone's input-gradient norm across fast adversarial training, to see whether high error predicts catastrophic overfitting. The other repeats the main comparison with GELU in place of ReLU, given the activation results in Bad Predictive Coding Activation Functions.
Experiment 4: ImageNet, if budget allows. A scaled check on ImageNet would use PVGG16 against Fast AT, which reports 43% PGD robustness in 12 hours.
Decisive outcome. The proposal is supported only if two things hold under the worst-case adaptive attack. The hierarchical feedback must beat the input-only ablation, and the gated system must beat compute-matched adversarial training at realistic $N$.
References
- Brain-inspired predictive coding dynamics improve the robustness of deep neural networks
- Predify: Augmenting deep neural networks with brain-inspired predictive coding dynamics
- On the role of feedback in image recognition under noise and adversarial attacks: A predictive coding perspective
- RobustBench: a standardized adversarial robustness benchmark
- Fast is better than free: Revisiting adversarial training
- Adversarial training for free!
- Understanding Catastrophic Overfitting in Single-step Adversarial Training
- Bad Predictive Coding Activation Functions
- Tight Stability, Convergence, and Robustness Bounds for Predictive Coding Networks
- Robustness Tokens: Towards Adversarial Robustness of Transformers