Adversarial Training Through the Orbit Average

Image classifiers can be attacked in two ways at once. The attacker can rotate or flip the picture, and the attacker can add small, carefully chosen pixel noise. Prior work finds a stubborn tension between these two kinds of robustness: making a network tolerant to rotations tends to make it easier to fool with pixel noise, and training against both attacks charges a "robustness tax." This proposal tests a specific and checkable way around that tension. Take any standard network. Wrap it so that its prediction is the average of its predictions on all eight rotated and flipped copies of the input. This is orbit averaging: the "orbit" of an image is the set of its transformed copies, and the averaged model is exactly invariant to those transformations by construction. Then run adversarial training (training on worst-case perturbed inputs) through that wrapped model, so the attacker during training is attacking the average itself.

The reason to expect something non-trivial is a small algebraic fact. The eight symmetries of a square, the dihedral group $D_4$, move pixels around without interpolating them. Because they only rearrange pixels, they map a pixel-noise budget onto itself exactly. For an orbit-averaged model, a composite "rotate, then add noise" attack is therefore exactly no stronger than a noise-only attack. The two-threat problem collapses into a one-threat problem, and the only remaining price is that the model class is restricted to invariant functions. The proposal measures that price directly, asks whether it is smaller than the tax paid by current multi-threat training, and checks whether the apparent robustness is real or just gradient masking.

Core Claim

Let $G$ be a finite group of exact pixel permutations (here $D_4$ acting on square images). Let $f$ be any network, and let $f_{\text{inv}}(x) = \frac{1}{|G|}\sum_{g \in G} f(g \cdot x)$ be its orbit average. Let $\Delta_\epsilon$ be the $\ell_\infty$ ball of radius $\epsilon$. Since every $g$ permutes coordinates, $g\Delta_\epsilon = \Delta_\epsilon$. Invariance then gives $f_{\text{inv}}(g x + \delta) = f_{\text{inv}}(x + g^{-1}\delta)$, so for any loss $L$ and label $y$,

$$\max_{g \in G,\ \delta \in \Delta_\epsilon} L\big(f_{\text{inv}}(g x + \delta), y\big) \;=\; \max_{\delta \in \Delta_\epsilon} L\big(f_{\text{inv}}(x + \delta), y\big).$$

Adversarial training of $f_{\text{inv}}$ against pixel noise alone therefore optimizes the composite spatial-plus-pixel robust risk exactly. No "Max over attack types" search is needed, and the spatial part of the threat cannot be traded off against the pixel part.

The claim we will test empirically is about the cost of this restriction. We predict that the drop in upright $\ell_\infty$ robustness from restricting to $D_4$-invariant functions is smaller than the drop current multi-threat methods pay for the same composite threat. We also predict that this advantage depends on gradients flowing through the average during training, not merely on averaging at test time.

The claim is deliberately narrow. It covers exact permutation groups, not continuous rotations, where interpolation breaks closure. It covers $\ell_p$ balls that the group maps onto themselves. And it is an empirical bet about natural image distributions, not a refutation of known impossibility results.

Where This Sits in Prior Work

The file shows a direct contradiction that motivates the work. Bridging Symmetry and Robustness trains group-equivariant convolutional networks (G-CNNs, which build rotation symmetry into their layers) on clean data only. It reports 64.96% PGD accuracy on CIFAR-10 and frames symmetry as a replacement for adversarial training. Can we have it all? finds the opposite. Spatial invariance, including in G-CNNs, steadily erodes pixel robustness, with adversarial robustness falling by more than 50% for models trained on 180° rotations. Its CuSP curriculum only negotiates a middle point: 37.18% adversarial and 59.09% spatial accuracy, versus 44.88% / 33.07% for plain PGD training on VGG16.

Adversarial Training and Robustness for Multiple Perturbations supplies both a constraint and a baseline. It proves that some perturbation types are mutually exclusive, reports a 5–10% accuracy tax on CIFAR-10 when combining threats, and introduces the "Max" and "Avg" multi-threat objectives.

The constraint must be addressed directly. The cyclic-code theorem in Can we have it all? concerns a setting where the symmetry is itself a coordinate permutation, so exact invariance is not automatically free. Our equation does not contradict that theorem. It moves the whole cost into one measurable quantity: how much robust accuracy is lost by restricting to invariant functions. Whether that cost is large on natural images under $D_4$ is exactly the open empirical question.

The method comes from Equi-Tuning. It wraps black-box pretrained models in the averaging operator and shows that this gives the closest equivariant model in $L_2$. It does so only with clean fine-tuning and never under attack. Generalization Bounds for Canonicalization gives a reason to expect averaging to help adversarial training specifically. It shows that group averaging reduces variance and beats canonicalization at small sample sizes (test loss 0.425 vs 0.471 at $N=10$) but loses at larger $N$ (0.367 vs 0.290). Adversarial training is notoriously sample-hungry and overfits late in training, so averaging's variance reduction may help it. Its bias may also cap peak robustness.

Three works sit nearby but answer different questions. Robust Perception through Equivariance enforces consistency across transforms at test time, using about 1.6 s of iterative optimization per sample versus about 0.04 s for a plain forward pass, and leaves the weights unchanged. We bake invariance into the trained weights and keep inference to $|G|$ forward passes. Invariance-Aware Randomized Smoothing Certificates and (Provable) Adversarial Robustness for Group Equivariant Tasks certify already-invariant models after training. We study how such models should be trained, and their certificates could later be applied to our models.

Invariance-inducing regularization encourages invariance through a penalty on worst-case transforms. That gives approximate invariance; we impose it exactly. Its "no trade-off" theorem covers spatial transforms only, not additive noise, which is the regime we target.

Research Program

The core artifact is a training procedure. In each step, PGD (projected gradient descent, the standard iterative attack) computes $\delta$ against $f_{\text{inv}}$, which means backpropagating through all eight orbit copies. The parameter update is then taken on $L(f_{\text{inv}}(x+\delta), y)$, using either the standard PGD objective or TRADES. The input gradient of the averaged model is itself an average of rotated gradients. The attack is therefore searching for one perturbation that harms all eight views together, and this is the mechanism we want to isolate.

Full-orbit training costs about $8\times$ per step. We therefore also build a stochastic variant: during training, average over $k \in \{1, 2, 4\}$ randomly sampled group elements; at test time, always use the exact eight-element average. The $k=1$ endpoint is ordinary augmentation-based adversarial training followed by averaging at evaluation. This makes the cost/benefit curve continuous and turns the key ablation into a single knob.

Three analyses go alongside training.

The first measures the invariance price. We compare upright-input $\ell_\infty$ robustness of adversarially trained $f$ versus $f_{\text{inv}}$, at matched compute. CIFAR-10 has a canonical upright orientation, so this is the hard case for the method.

The second looks for gradient masking. Averaging smooths the loss surface, and Bridging Symmetry and Robustness reads that smoothing as robustness, but it may instead obscure attack directions. The averaged model is deterministic and exactly differentiable, so full AutoAttack applies directly. We add the gradient-free Square attack, sweeps over attack steps and restarts, and an $\epsilon$ sweep up to the point where accuracy must reach zero.

The third tests the sample-size hypothesis drawn from Generalization Bounds for Canonicalization. We train on 10%, 25%, 50%, and 100% of the training data and track robust overfitting curves across training. The question is whether averaging closes the gap between best-checkpoint and final-checkpoint robustness, and whether its advantage shrinks as data grows.

Baselines

The naive reference point is standard PGD adversarial training of the base ResNet-18 with no symmetry handling. For context, CAT reports 47.55% AutoAttack accuracy for standard AT, 49.21% for TRADES, and 51.02% for CAT on CIFAR-10 with ResNet-18. These are upright, $\ell_\infty$-only numbers. We will reproduce standard AT and TRADES in our own pipeline rather than quote them, then evaluate them under the composite $D_4 \times \ell_\infty$ threat. We expect the composite evaluation to expose a large drop.

The strongest competitor is Tramèr–Boneh "Max" training over the composite threat, from Adversarial Training and Robustness for Multiple Perturbations. For a group of eight elements, this means running PGD from each of the eight transformed inputs and updating on the worst one. It is the strongest competitor because it optimizes exactly the same composite objective, using the same per-step compute (eight PGD runs), with a single-pass model at test time. We also run "Avg" training, which mixes adversarial examples across the eight transforms.

No reported result was found on Lacuna for any method under a $D_4 \times \ell_\infty$ composite threat on CIFAR-10. The comparison will therefore be run fresh. Every method gets the same architecture, the same 8-copy-per-step compute budget (non-averaged methods may convert it into extra epochs if that helps them), and the same hyperparameter grid over learning rate, weight decay, and TRADES $\beta$, selected on a held-out validation split. Beating Max means higher composite AutoAttack accuracy at equal or better clean accuracy. We commit in advance that a gain below 1 point, or within seed variance across three seeds, counts as a tie.

We also run CuSP from Can we have it all?, retargeted to the $D_4$ threat, as the curriculum-based alternative. Its reported VGG16 numbers (37.18% adversarial, 59.09% spatial) refer to a continuous-rotation threat. They frame expectations but cannot be compared directly.

Two further baselines cover approximate invariance and built-in symmetry. One is the worst-of-$k$ KL-regularized method from Invariance-inducing regularization, stacked on top of TRADES. The other is a $P4M$ G-CNN trained with PGD. This second baseline also extends the clean-only study in Bridging Symmetry and Robustness, built from its released code (Role-of-Equivariance). Its clean-trained model, re-evaluated with AutoAttack, serves as the "symmetry without adversarial training" reference.

The key ablation isolates the proposal's main ingredient. We train $f$ with augmentation-based AT, or with Max AT, and only then wrap it in the average at test time. This uses the same inference cost as our method and the same exact invariance guarantee, but gradients never pass through the average during training.

Why not just…?

Why not just use Max multi-perturbation adversarial training? This is the real threat. A non-averaged network trained with worst-of-eight PGD could learn nearly invariant features, and it runs in one forward pass instead of eight. Two pieces of evidence count against it. Adversarial Training and Robustness for Multiple Perturbations reports a 5–10% tax for multi-threat training on CIFAR-10 and notes that robustness to each attack alone does not carry over to combined attacks. And Max offers no guarantee for transforms the attacker combines differently. Still, if Max ties our method on composite AutoAttack accuracy, the honest conclusion is that orbit averaging buys only a certificate of spatial invariance at $8\times$ inference cost. The head-to-head comparison at equal training compute settles this.

Why not just augment with rotations and average at test time? This is the cheapest way to get exact invariance, and it is precisely our $k=1$ ablation. Our hypothesis is that it underperforms. The attacker used during training never searched for a single perturbation that harms all eight views together, so the trained weights are not shaped by the averaged decision boundary. If the $k=1$ variant matches full-orbit training, the training-side contribution disappears and the paper becomes a study of test-time averaging. We would report it that way.

Why not just use a G-CNN with adversarial training? Can we have it all? already shows that adversarially trained G-CNNs still pay the spatial-versus-pixel trade-off. G-CNNs also cannot reuse standard pretrained weights, whereas averaging wraps any backbone, as in Equi-Tuning. We run the adversarially trained $P4M$ G-CNN anyway. If it equals our method at lower inference cost on CIFAR-10, the advantage of averaging narrows to the pretrained-backbone setting, which the Hymenoptera experiment tests.

Proposed Experiments and Decisive Checks

The main benchmark is CIFAR-10 at $\epsilon = 8/255$ with ResNet-18, plus WideResNet-34-10 for the top two methods. CIFAR-100 and SVHN serve as replication. Every model is reported on four quantities: clean accuracy, upright AutoAttack accuracy, composite $D_4 \times \ell_\infty$ AutoAttack accuracy (attacker picks the worst of eight transforms and then runs AutoAttack), and accuracy on CIFAR-10C corruptions. To test the method in the regime it was designed for, wrapping a pretrained network, we also fine-tune a pretrained ResNet on Hymenoptera, where Equi-Tuning reports clean accuracy rising from about 89% to about 92%. There we compare orbit-averaged adversarial fine-tuning against adversarial fine-tuning with augmentation.

Four outcomes decide the proposal.

First, the composite robust accuracy of $f_{\text{inv}}$ must equal its upright robust accuracy up to attack noise. This is the sanity check on the exact reduction in the Core Claim.

Second, the invariance price must be small. We define it as the drop in upright AutoAttack accuracy from adversarially trained $f$ to adversarially trained $f_{\text{inv}}$. If it exceeds the composite-accuracy gap between Max training and naive AT, the method fails on CIFAR-10.

Third, full-orbit training must beat the $k=1$ "average after training" ablation by more than seed variance. Otherwise the "train through the average" ingredient is not doing the work.

Fourth, robustness must survive the masking checks. The Square attack must not beat gradient attacks, and accuracy must fall to zero as $\epsilon$ grows. If either check fails, the robustness of clean-trained or averaged models (including the 64.96% PGD figure from Bridging Symmetry and Robustness) is evidence of obfuscated gradients rather than a structural shield.

The data-fraction sweep is reported regardless of these outcomes. It tells us whether averaging's variance reduction translates into less robust overfitting.