Robust Multi-Layer Probes for Frozen Vision Transformers at a Fraction of Adversarial Training Cost

Adversarial training makes a classifier robust to small, deliberately crafted input perturbations. It works by attacking the model at every training step and learning from the attacked inputs. Each attack costs several extra forward and backward passes through the network, so for a billion-parameter vision transformer the bill becomes prohibitive. A separate line of work has shown that you can adapt a frozen transformer cheaply by training a small "probe," a lightweight head that uses cross-attention to read summary tokens from every layer and learn which depths matter for the task. These multi-layer probes beat final-layer linear probes on clean data while training in minutes. There is also evidence that adversarial noise grows as it moves deeper into a network, so intermediate layers often still carry the correct class when the output has been fooled.

This note proposes to put these facts together, and to test the combination honestly. We would train a depth-weighting probe on a frozen backbone to be robust under a fully public, white-box threat model. Because the backbone never changes, most of the expensive attack computation can be done once and cached, instead of being repeated at every step. If this works, practitioners could get certified-by-attack robustness for large frozen models at a small multiple of linear-probing cost. If it fails, the failure would show something worth knowing: whether the "intermediate layers stay clean" effect survives an attacker who knows which layers the probe trusts.

Core Claim

Our first claim is about cost. When the backbone is frozen, adversarial training of a multi-layer probe splits into two attack components. The first is expensive but does not depend on the probe: pixel perturbations that distort the backbone's own layer-wise features. These can be computed once per training image and stored as cached per-layer feature shifts. The second is cheap and does depend on the probe: perturbations applied directly to the cached per-layer summary tokens, within per-layer radii calibrated from the real attacks. A small number of occasional full white-box attacks through backbone and probe together keeps these two approximations honest.

Our second claim is about mechanism. A probe that weights layers by attention, trained this way, should match a probe trained with full per-step projected gradient descent attacks (PGD, the standard iterative attack used inside adversarial training) in white-box AutoAttack accuracy. It should do so at roughly a tenth of the backbone compute or less. We also expect it to beat a uniform layer average, because the gate learns to move weight toward depths whose features distort least under bounded attack.

What would be new is three things together. The probe is trained adversarially rather than for clean accuracy only. The attack cost is amortized because the backbone is frozen. And the defense is evaluated with every component known to the attacker.

Relation to Prior Work

Two papers supply the method. Attentive Multi-Layer Fusion for Vision Transformers builds Attentive Layer Fusion (ALF). ALF is a probe that cross-attends over the class token and an average-pooled patch token from every layer of a frozen ViT. It reports a 5.54-point average gain over linear probing and trains about 36 times faster than fine-tuning. Fantastic Features and Where to Find Them does the same across several frozen foundation models (ComBo). We reuse the ALF probe architecture unchanged. Neither paper evaluates against any attack, and that is the gap we fill.

Three papers motivate the proposal while leaving its central question open. FACM shows that intermediate layers keep ground-truth information under attack, and it fuses auxiliary-classifier logits with a small network. It reaches about 48.7% under PGD on CIFAR-10, but only in a grey-box setting where the attacker ignores the auxiliary modules, and only on small CNNs. Adaptive feature alignment for adversarial training learns input-dependent weights that blend clean and adversarial batch-normalization branches. It reports 46.5% adversarial accuracy at ε=8 on SVHN. However, it requires multi-strength adversarial training in its first stage, it is tied to batch normalization, and the authors flag adaptive attacks on the weight generator as untested. AGAIN shows that robust models narrow their attribution span, and it adds feature-statistics mixing to full TRADES/AWP training. That adds cost rather than removing it.

Our proposal differs from all three in the same ways. It fuses latent tokens across depth rather than logits or normalization branches. It works on frozen transformers. And it assumes the attacker sees the fusion weights.

Two papers constrain the design. Robustness Tokens is the closest parameter-efficient competitor. It trains 10 input tokens on a frozen DINOv2 in 200 steps, but its security partly rests on keeping those tokens secret. RobustBench documents that published defenses overstated robustness by more than 10% relative to AutoAttack. That finding is why we refuse grey-box numbers. Any learned, input-dependent gate is exactly the kind of component that can mask gradients without adding real robustness.

Research Program

The probe takes the class token and average-pooled token from each of the $L$ layers of a frozen ViT. That gives $2L$ tokens per image, collected into $T(x)$. A learned query attends over them to produce logits $g_\phi(T(x))$, where $\phi$ are the probe's parameters. This is ALF exactly.

The cost question is visible in the training objective:

$$\min_{\phi}\ \mathbb{E}_{(x,y)}\ \max_{\|\delta\|_\infty\le\epsilon}\ \mathcal{L}\big(g_\phi(T(x+\delta)),\,y\big).$$

Here $\epsilon$ is the pixel budget and $\mathcal{L}$ is cross-entropy. Every inner step needs a backbone forward and backward pass. Because $T$ is fixed, $\phi$ is the only thing that changes between epochs.

We build the procedure in three parts. First, we run $K$ steps of PGD once per training image, maximizing feature distortion across all layers. This is a probe-independent objective, similar in spirit to the one Robustness Tokens optimizes. We store the resulting shifts $\Delta_l(x)$ for each layer $l$. We also record per-layer quantiles $\rho_l$ of their norms, which tell us how far a real ε-bounded attack can move each depth.

Second, at every training step, the inner maximization starts from the cached attacked tokens $T(x)+\Delta(x)$. It then takes a few gradient steps on the tokens themselves, with layer $l$ constrained to radius $\rho_l$. These steps touch only the probe and are close to free.

Third, every $r$ epochs we refresh a random fraction of the cache. The refresh uses full white-box PGD through backbone and probe together, so the cache tracks the probe's current weak points.

We count cost in backbone passes. Full probe adversarial training costs about $E\cdot N\cdot(K+1)$ passes for $E$ epochs over $N$ images. Ours costs about $N\cdot K + E\cdot N + (E/r)\cdot f\cdot N\cdot K$, where $f$ is the refreshed fraction. With typical values ($E=20$, $K=10$, $r=5$, $f=0.25$), that is roughly a 6–10× reduction. That follows from the counting alone and is not a claim about accuracy.

A cheap diagnostic, run first, sets the ceiling for everything else. For each layer separately, we adversarially train a linear probe with full PGD and measure its white-box robust accuracy. This gives a "robustness profile across depth." If no single layer, and no mixture of layers, is markedly more robust than the final layer under a white-box attack aimed at it, the mechanism has nothing to exploit. In that case we report this negative result as the main finding, extending FACM's grey-box claim to a setting where it may not hold.

We also log the learned layer weights on clean and attacked inputs. This lets us check whether the gate actually shifts toward shallower layers under attack, or whether robustness comes from elsewhere.

Baselines

The naive reference point is a final-layer linear probe on the frozen backbone with no defense. On DINOv2-G, Robustness Tokens reports 0.3% ImageNet-1k accuracy under white-box attack for this setting. We also run a final-layer linear probe adversarially trained with full PGD at the same cost as our full-PGD control. This separates "adversarial training of any head" from "multi-layer fusion."

The strongest existing method is Robustness Tokens (Robustness Tokens). It is the strongest competitor because it already targets frozen large ViTs with a tiny trainable footprint and fast convergence. The paper reports 63.1% ImageNet-1k accuracy under white-box attack on DINOv2-G (versus 0.3% without), clean accuracy of 85.2% (versus 85.6%), and ADE20K mIoU rising from 4.7 to 23.3.

We will re-run it ourselves on the same backbone, data split, ε, and evaluation attack. The tokens will be treated as public, matching our threat model, and we will also report the secret-token number for continuity. We give it the same number of backbone passes as our method, which is generous to it given its 200-step budget. Beating it means higher AutoAttack accuracy with public parameters at equal or lower backbone-pass cost and within one point of its clean accuracy. Merely matching its reported secret-token figure would not count.

The key-ingredient ablation is ALF trained with full per-step PGD through the backbone. This is the obvious combination and the upper bound on what our cheap procedure should reach. If our amortized method falls more than about two points short of it in AutoAttack accuracy, the cost claim fails.

A second ablation replaces the attention probe with a uniform average of layer tokens and a linear head, trained by the same amortized procedure. This isolates whether adaptive weighting matters or whether simply using many layers is enough. Two further ablations remove the token-space inner steps and the white-box refresh, respectively. These show which part of the amortization carries the robustness.

All variants share hyperparameter search budgets and are evaluated with the same AutoAttack suite.

Why not just…?

Why not just use Robustness Tokens? They are a real threat on raw numbers. Their reported 63.1% white-box accuracy on DINOv2-G is a high bar. The weakness the file documents is that the defense is described as relying on token secrecy. In addition, the tokens act only at the input and do not use intermediate representations. Our comparison treats both defenses as public. If public Robustness Tokens still match our probe, we will say so. The contribution then shrinks to the cost-accounting technique and the depth-robustness profile.

Why not just adversarially train a final-layer linear probe? A linear probe is cheap to update, but it pays the same backbone attack cost per step as any other head. It also reads the layer that FACM finds most corrupted. Our final-layer adversarially trained baseline directly measures how much multi-layer access adds at equal cost.

Why not just average all layers instead of learning weights? ALF reports that naively concatenating all layer tokens overfits. But a uniform average trained adversarially has never been tested, and it might be as robust as a learned gate while being much harder to game. The uniform-average ablation settles this. If it ties the attention probe, we will recommend it and drop the adaptivity claim.

Why not just do full PGD on the probe, since the backbone is frozen anyway? Freezing the backbone saves optimizer state, not attack compute. Every PGD step still backpropagates through the full backbone to the pixels. Full-PGD ALF is included precisely so that the cost saving is measured against the strongest robust version of the same model, not against a weaker one.

Proposed Experiments

Our primary setting is ImageNet-1k with frozen DINOv2 backbones at two sizes, matching Robustness Tokens, under the ℓ∞ threat model. We add frozen supervised ViT and CLIP backbones on CIFAR-10 and CIFAR-100 (resized). We also use a subset of VTAB-1k tasks to check whether robustness transfers across the natural, specialized, and structured groups that ALF and ComBo report clean gains on. For frozen-ViT probes on CIFAR under AutoAttack, no reported result was found on Lacuna, so our full-PGD ALF and linear-probe baselines define the reference there.

Metrics are clean accuracy, AutoAttack robust accuracy, and robust accuracy across a sweep of ε values. The sweep tests the fixed-budget overfitting noted for standard adversarial training. We also report backbone passes and GPU-hours to reach a fixed robust accuracy, and the learned layer-weight profiles.

Two decisive checks govern interpretation. First, the white-box attack must target the full pipeline, including the gate. We supplement standard AutoAttack with an adaptive attack that explicitly pushes the gate toward the most corruptible layers. We also report the Square attack (gradient-free) separately; if Square beats the gradient attacks, that indicates gradient masking. Robustness that disappears under these attacks counts as failure, following RobustBench's warning.

Second, the per-layer robustness profile must show that some depth or mixture is more robust than the final layer under a matched white-box attack. Only then does the depth-adaptive story hold. Either outcome is reportable. A positive result yields cheap robust adaptation of frozen foundation models. A negative one shows that FACM's intermediate-layer correction does not survive an attacker who knows which layers the defense trusts.