Making a large vision transformer robust to adversarial examples, meaning inputs with tiny, deliberately chosen perturbations that flip the model's prediction, normally requires adversarial training. That procedure retrains the whole network on attacked inputs and costs roughly ten to forty times as much as ordinary training. It also usually lowers accuracy on clean images. For billion-parameter backbones such as DINOv2, this is rarely done. We propose a cheaper route. Fit a small, curved model of where each attention layer's outputs normally live, using only clean images and forward passes through a frozen backbone. Then, at test time, pull every attention output back onto that learned surface before it continues through the network. Clean inputs already lie on the surface and pass through almost unchanged. Perturbations that push internal features off the surface get partially removed.
The geometric reason for intervening at the attention output comes from recent theory. Gating Enables Curvature proves that an ungated attention output is confined to the flat affine hull of its value vectors. An attention layer therefore cannot curve its representation back toward the data, and any off-distribution direction an attacker injects into the values is passed straight to the next layer. A thin, curvature-aware projection after attention restores the missing constraint without touching the backbone weights. The open question is whether a curved constraint does better than a flat one. We expect it to, because it can hug the clean data tightly enough to strip attack directions without also stripping the rare, fine-grained clean features whose loss produces the robustness-accuracy trade-off.
Core Claim
A mixture of local low-rank linear charts is a piecewise approximation of a curved manifold. If it is fitted to clean attention outputs of a frozen transformer and applied as a soft projection after selected attention blocks, it should give a better clean-versus-robust trade-off than a single global linear subspace with the same parameter budget. It should do so under fully white-box, adaptive attacks, at a training cost of a few forward passes over a subset of the training data, with no inner-loop attack generation. Robust accuracy alone is not the novel part. The specific prediction is that curvature, here the number of local charts, is the knob that moves the trade-off. A global flat projection has to choose between being too loose, which keeps attack directions, and too tight, which loses clean features. Local charts avoid that choice.
Relation to Prior Work
Three manifold-based defenses motivate this work. All three place an expensive external generative model around a conventional Euclidean classifier. Enhancing the Adversarial Robustness via Manifold Projection trains a pixel-space autoencoder and inserts it into the PGD adversarial training loop, which adds cost rather than removing it. Dual Manifold Adversarial Robustness generates both pixel attacks and StyleGAN latent attacks at every step. It improves clean accuracy on OM-ImageNet to 77.96% against 73.31% for standard adversarial training, at a large compute cost. Breaking the Adversarial Robustness-Performance Trade-off in Text Classification via Manifold Purification learns a Riemannian normalizing flow over BERT sentence embeddings and solves an iterative geodesic problem at inference. Together these papers show that "stay on the data manifold" reduces the trade-off. We keep that principle and change where and how it is applied: inside the attention stack, with a closed-form projection, and with no generative model and no adversarial inner loop.
Two lines of work supply the efficiency constraint and the strongest competitors. Robustness Tokens freezes DINOv2 and learns ten prefix tokens in about 200 steps. Its robustness, however, depends on the tokens staying secret. Our chart parameters are assumed public, so the defense must survive a fully informed attacker. Manifold-Guided Attention Steering projects attention-head activations out of a linear PCA "error subspace" built from paired correct and incorrect reasoning traces. Its mechanism is the closest to ours, but it is flat and supervised by contrastive pairs. Ours is curved and needs only clean data, which also gives us our main ablation.
Two further papers constrain the design. Lipschitz-Guided Stochastic Depth gains robustness on ViT-Tiny without adversarial training by bounding the global sensitivity of the network. It also reports that the maximum local sensitivity still fluctuates, so we measure local sensitivity directly rather than assuming the projection bounds it. Expensive Riemannian operations such as eigendecompositions and matrix logarithms are the known bottleneck of manifold attention, a problem DyGMoCE addresses for graphs with polar approximations. We avoid such operations entirely: the charts use only matrix multiplications.
Research Program
The operator works as follows. At a chosen attention block, let $o \in \mathbb{R}^d$ be a token's attention output. The block holds $k$ charts, each with a center $c_j$ and an orthonormal basis $U_j$ of rank $r \ll d$. The corrected output is
$$o' = o - \gamma\Big(o - \sum_{j=1}^{k} \pi_j(o)\,\big[c_j + U_j U_j^\top (o - c_j)\big]\Big),$$
where $\pi_j(o)$ is a softmax over the negative chart reconstruction errors divided by a temperature $\tau$, and $\gamma \in [0,1]$ is a learned per-layer strength. With $k=1$ the operator reduces to a global linear subspace projection of the MAGS type. As $k$ grows it tracks an increasingly curved surface. The cost is $O(krd)$ per token, which is negligible next to attention itself.
Fitting happens in three stages. The charts are first fitted by expectation-maximization for a mixture of probabilistic PCA on attention outputs collected from forward passes of the frozen backbone over a clean training subset. On ImageNet we use 50k images, a few GPU-hours on a giant model. We then tune only $\gamma$ and $\tau$ per layer with a clean-data invariance loss, the same one Robustness Tokens uses, that keeps final features close to those of the unmodified model. We also evaluate a variant that adds a ROB-style adversary-correction loss computed with single-step attacks, to see whether a small amount of attack data helps. Layer placement is chosen on a held-out validation split: all layers, last third, or every other layer.
Analysis follows the fitting. For each layer, we measure the residual energy $\|o - \mathrm{Proj}(o)\|$ on clean versus attacked tokens. If the clean-versus-attack gap does not widen with $k$, the core claim is false regardless of accuracy. We also estimate the maximum local Lipschitz constant around test points with and without the projection, which tests the concern raised by the stochastic-depth paper. Finally, we plot clean accuracy against robust accuracy as $k$ and $r$ vary at a fixed total parameter count $k \cdot r \cdot d$, so that "curved" and "flat" are compared on equal capacity.
The threat model is white-box, and the attacker knows the charts, $\gamma$, and $\tau$. Soft assignment keeps the operator differentiable, so standard gradient attacks apply directly. Because projection-style defenses can look strong only because they disrupt the gradients an attacker relies on, we also attack a hard-assignment surrogate, run attacks with many more steps and random restarts, and run a feature-space attack that targets on-manifold directions directly by optimizing perturbations whose induced attention outputs stay within the charts.
Baselines
The naive reference is the frozen backbone with a linear probe and no defense. On DINOv2-G ImageNet, Robustness Tokens reports white-box accuracy collapsing to 0.3%, so any meaningful gain is easy to detect against this baseline.
The strongest existing method on the efficiency question is Robustness Tokens itself. It reports 63.1% white-box accuracy with clean accuracy of 85.2% (versus 85.6% undefended) on DINOv2-G ImageNet, and ADE20K mIoU under attack rising from 4.7 to 23.3. We will reproduce it on the same backbone, data subset, attack budget, and GPU-hour budget. We evaluate it twice, once under its original secrecy assumption and once with the tokens exposed to the attacker, because only the second condition matches our threat model. Beating it means matching its clean accuracy within half a point while exceeding its exposed-token robust accuracy. Approaching its secret-token number without relying on secrecy would be a strong result in its own right.
The key ablation is global linear subspace projection: our operator with $k=1$ and rank chosen to match the total parameter count, which is the MAGS mechanism adapted to clean-only fitting following Manifold-Guided Attention Steering. It uses the identical fitting data, tuning procedure, and layer search. This baseline isolates curvature. If it matches the multi-chart operator, the curved part of the proposal is unnecessary.
On CIFAR-10 with ViT-Tiny, the strongest training-free comparison is Lipschitz-Guided Stochastic Depth. It reports 90.88% clean accuracy and 32.1% AutoAttack accuracy at 0.273G FLOPs. We run it with the same backbone and training recipe and also apply our projection on top of it, since the two mechanisms are compatible. As an upper reference for robustness at high cost, we run full PGD adversarial training on ViT-Tiny with the same recipe. For that exact configuration the file provides only a relative improvement for the autoencoder variant in Enhancing the Adversarial Robustness via Manifold Projection, so we treat our own run as the reference number and report its GPU-hours alongside ours.
Why not just…?
Why not just use Robustness Tokens, which already cost about 200 steps? Their reported robustness assumes the attacker cannot recover the tokens, and the file explicitly flags this as security by obscurity. Our method is designed to hold when every parameter is public. The exposed-token evaluation of Robustness Tokens settles whether this distinction matters in practice. If exposed tokens stay robust, this advantage disappears and our contribution narrows to the curvature finding.
Why not just project onto a global PCA subspace, which is simpler and needs no mixture fitting? This is the most serious threat, and it is why $k=1$ is our central ablation. Our argument is that a single flat subspace large enough to retain clean fine-grained features must also span many attack directions. The clean-versus-attack residual gap as a function of $k$ at fixed capacity will show directly whether that is true. If the gap and the trade-off curve do not improve with $k$, we will report that a flat projection suffices and abandon the curvature claim.
Why not just bound the network's Lipschitz constant with stochastic depth? That approach already gives 32.1% AutoAttack accuracy on CIFAR-10 for free, but its authors find that local sensitivity still spikes. It also requires training the model with the drop schedule, so it does not apply to an already-trained frozen giant backbone. We run the two methods both separately and together, so complementarity or redundancy will be visible.
Why not just use an external purifier such as an autoencoder or flow? These defenses work but add an extra network to every training step or an iterative solver to every inference, as documented for DMAT and MC²F. We report wall-clock fitting and inference cost against an autoencoder purifier on CIFAR-10 to make the cost gap concrete. We concede that a strong purifier may still win on raw robustness.
Decisive Checks
The experiments use ImageNet-1k linear probes on DINOv2 (base and giant), ADE20K segmentation with the same backbone, and CIFAR-10 with ViT-Tiny. Each setting is evaluated with the attack protocol of the corresponding cited paper, plus AutoAttack, many-step PGD with restarts, the hard-assignment surrogate, and the on-manifold feature attack. We report clean accuracy, robust accuracy or mIoU, clean-versus-attack feature cosine similarity (Robustness Tokens reports 0.12 rising to 0.89), and total GPU-hours including chart fitting.
Three results would decide the proposal. First, the multi-chart operator should dominate the $k=1$ flat projection on the clean-versus-robust curve at equal capacity. Without this, the curvature hypothesis fails. Second, robust accuracy should not collapse under the hard-assignment surrogate and on-manifold attacks. A collapse would mean the gains came from masked gradients rather than real robustness. Third, clean accuracy should stay within about one point of the undefended model while total fitting cost stays below one percent of full adversarial training on the same backbone. If all three hold, the result shows that adding curvature after attention, rather than retraining weights, is a practical way to make frozen foundation models robust at low cost.
References
- Gating Enables Curvature: A Geometric Expressivity Gap in Attention
- Enhancing the Adversarial Robustness via Manifold Projection
- Dual Manifold Adversarial Robustness: Defense against Lp and non-Lp Adversarial Attacks
- Breaking the Adversarial Robustness-Performance Trade-off in Text Classification via Manifold Purification
- Robustness Tokens: Towards Adversarial Robustness of Transformers
- Manifold-Guided Attention Steering
- Adversarial robustness through Lipschitz-Guided Stochastic Depth in Neural Networks
- Fast Mixture of Curvature-Aware Experts for Diverse and Dynamic Graph Topologies