Vision Transformers lack a running memory of their training data, and this is a basic reason test-time adaptation is harder for them than for convolutional networks. Test-time adaptation means adjusting a trained model on the fly to new, shifted inputs, such as foggy or noisy images, without labels. Convolutional networks use Batch Normalization, a layer that keeps running averages of each channel's mean and variance over the training set. Many adaptation, data-free quantization and distillation methods rely on those cached averages. Transformers use Layer Normalization instead. It standardizes each token on its own and keeps no running record, so those methods break (Gong et al., Li et al.). This proposal argues that the right replacement for Batch Normalization's cached mean and variance in a Layer Normalization network is a cached subspace: the few directions in which a layer's normalized tokens mostly vary.
Two properties make this plausible. First, Layer Normalization already removes each token's mean and rescales its length. What corruption can still change, then, is mainly the direction structure of the features, and a subspace records exactly that. Second, a single image already supplies roughly two hundred tokens. A subspace can therefore be estimated and updated even when test images arrive one at a time, which is where methods built on batch statistics fail. We store a small orthonormal basis per layer from source data. At test time we track the corresponding test-time subspace online using rank-one updates along the Grassmannian, the curved space whose points are subspaces rather than bases. We then adapt only the layer's scale and shift parameters to pull the test subspace back toward the stored one.
Core Claim
The claim has three parts. Under common corruptions, the principal subspaces of Transformer Layer Normalization outputs rotate away from their clean-data positions. That rotation predicts accuracy loss better than shifts in per-channel moments. Correcting it through the post-normalization scale $\gamma$ and shift $\beta$ gives stable adaptation, including in continual, single-image streaming. Concretely, for layer $\ell$ we store a source basis $S_\ell \in \mathbb{R}^{d \times k}$ with orthonormal columns, where $d$ is the token width and $k \ll d$. We maintain a tracked test basis $T_\ell$. We adapt $\gamma_\ell$ by minimizing the projection distance
$$ \mathcal{L}_\ell(\gamma_\ell) = k - \big\| S_\ell^\top \, \mathrm{qf}(\mathrm{diag}(\gamma_\ell)\, T_\ell) \big\|_F^2 , $$
where $\mathrm{qf}(\cdot)$ is the orthonormal factor of a thin QR decomposition. The QR step is needed because rescaling channels with $\mathrm{diag}(\gamma_\ell)$ destroys orthonormality. Placing the QR decomposition inside the objective is taken directly from Joint Normalization and Dimensionality Reduction on Grassmannian, which does this for supervised dimensionality reduction on subspace-valued data; here it serves a different purpose, differentiating a subspace distance with respect to normalization parameters. The shift $\beta_\ell$ is set in closed form so that the mean of the post-normalization tokens matches a stored source mean. The loss is zero when the rescaled test subspace coincides with the source subspace. Because it ignores eigenvalue magnitudes, it is insensitive to the roughly uniform variance inflation that noise corruptions cause.
This builds on and departs from several lines of work. Revisiting Layer Normalization for Point Cloud Test Time Adaptation shows that pre-affine Layer Normalization reduces to mean removal plus length normalization. From this it argues that only the scale and shift should be adapted, using closed-form moment or prototype matching. We accept its conclusion about which parameters to adapt, but we challenge its implication that scalar statistics suffice, since length normalization does nothing about direction. Robustifying Vision Transformer … by Test-Time Class-Conditional Feature Alignment (CFA) also stores source statistics, namely class centroids and higher central moments, and matches them at test time. Our stored object is unlabeled and rotation-aware rather than per-class and per-coordinate. Subspace Alignment for Vision-Language Model Test-time Adaptation minimizes chordal (subspace) distance between visual and text embeddings of CLIP. It projects features at the output, recomputing an eigendecomposition per batch. We act inside the backbone, on normalization parameters, with a tracked rather than recomputed subspace.
Research Program
The work begins with a diagnostic that could kill the idea. On ImageNet-C (Hendrycks and Dietterich), using a ViT-B/16 and a DeiT backbone, we compute for every Layer Normalization and every corruption and severity the Grassmannian distance between clean and corrupted token subspaces, at both $k=16$ and $k=64$. We also compute the moment discrepancy CFA uses and the per-channel mean and variance gaps. We then ask which quantity, layer by layer, better predicts the drop in top-1 accuracy. If the subspace distances carry no information beyond the moments, the proposal reduces to CFA and we stop.
If the diagnostic passes, we build the method in three parts. The first part is the stored fingerprint. It is computed once from a few thousand unlabeled source images: one $d \times k$ basis and one mean vector per layer, under a megabyte for ViT-B. That is far smaller than per-class moment dictionaries and contains no training samples.
The second part is the tracker. We follow the rank-one geodesic update of GROUSE: each incoming token residual moves $T_\ell$ along the Grassmannian while keeping it exactly orthonormal. Its known narrow step-size window is handled by tying the step to a forgetting horizon measured in tokens. Tracked per-direction energies weight the update. The Grassmannian view matters here for a concrete reason, not efficiency: because the tracked object is a subspace rather than a basis, distances between $T_\ell$ at different times are well defined. The same tracker therefore also serves as a shift detector, triggering a reset toward source parameters when $d(S_\ell, T_\ell)$ jumps. This replaces the heuristic KL trigger used in PACE.
The third part is the update. We take one gradient step on $\sum_\ell \mathcal{L}_\ell$ with respect to all $\gamma_\ell$, optionally adding a small entropy term.
We also settle the placement question left open by the tension between the Layer Normalization analysis and the SubTTA results. Subspaces can be computed on the pre-affine normalized tokens or on the post-affine outputs. The correction can act through $\gamma$ or through an explicit projection of features onto $S_\ell$. We run all four combinations.
Baselines
The naive reference is the unadapted source model, together with Tent on the same Transformer. Tent minimizes prediction entropy by updating normalization scale and shift, and reports 44.0% top-1 error on ImageNet-C with a ResNet-50. It represents the lightweight default, and it is known to collapse under continual shift.
The strongest statistic-storing competitor is CFA, which reports 19.8% top-1 error on ImageNet-C with a BeiT-L16 backbone. That number comes from a much larger backbone than ours. We therefore rerun CFA on every backbone we use, with the same source-image budget for its statistics as for our fingerprint.
The strongest competitor for stability over long corruption sequences is LCoTTA. It filters normalization-parameter gradients through a principal subspace recomputed by SVD over a queue, and reports that standard methods collapse to near 0% accuracy while it stays stable. No reported ImageNet-C accuracy was found on Lacuna for LCoTTA, so it is rerun with its published rank and queue length.
We also include the closed-form prototype calibration from the Layer Normalization paper, which reports +12.35% over source on ScanObjectNN-C. PACE's random-subspace evolutionary search is included for the backpropagation-free comparison.
All methods use the same backbone, the same stream order, the same batch sizes and the same unlabeled source budget. Each gets an equal hyperparameter search of twenty configurations on a held-out corruption set (the ImageNet-C extra corruptions). Beating the field means lower mean error than both CFA and LCoTTA across the full continual 15-corruption sequence at batch sizes 1 and 16. At batch size 1, the result must hold without collapse across ten repeated cycles.
Two ablations isolate the key ingredient. The first replaces the stored subspace with a stored full covariance, a CORAL-style match on the manifold of positive-definite matrices as in Deep LogCORAL. The second replaces geodesic tracking with per-batch eigendecomposition.
Why not just…?
Why not just keep an exponential running covariance per layer and match it? This is the most serious threat. A running covariance is the obvious full-rank analogue of Batch Normalization's running variance, and for ViT-B it is cheap enough to store. We therefore do not argue memory cost. The substantive difference is that covariance matching also forces eigenvalue magnitudes to match, and noise corruptions inflate those magnitudes in ways the scale parameters cannot undo without also distorting signal directions. The covariance ablation settles this directly. If it matches or beats the subspace loss, the honest conclusion is that the missing memory is second-order statistics in general, not subspaces in particular.
Why not just use LCoTTA's gradient subspace, perhaps with geodesic instead of SVD tracking? Swapping the SVD for GROUSE would be the obvious combination at this intersection. We rejected it as the main idea because the gradient queue is small, so thin SVD over it is already cheap, and speed would be the only gain. LCoTTA's subspace also filters an entropy gradient, so it inherits entropy's failure modes. Our signal is a feature-geometry target that contains no entropy term at all. Running LCoTTA as a baseline, and our method with and without the entropy term, shows whether the target matters beyond the gradient filtering.
Why not just use CFA's stored moments or the closed-form prototype calibration? Both are stateless per batch. Both reportedly depend on batch size, and the prototype paper names batch-size sensitivity as its own limitation. The diagnostic tests whether moments already capture what subspace rotation captures. The batch-size-1 streaming experiment tests whether token-level subspace tracking removes the batch dependence. If CFA equals us at batch size 1, the subspace adds nothing.
Proposed Experiments
The first decisive check is the diagnostic correlation study on ImageNet-C described above. The second is continual adaptation over the 15-corruption ImageNet-C sequence at severity 5 on ViT-B/16 and DeiT-S, at batch sizes 1, 16 and 64, repeated for ten cycles. Here we report mean top-1 error, the worst-cycle error, and the number of runs that collapse below 5% accuracy. CIFAR-10-C and CIFAR-100-C with ViT backbones test transfer to low resolution. Following the reported comparison of the Adaptive Cascading Network against CoTTA, which found 81.19% versus 26.93%, we use a 135-domain CIFAR-10-C sequence to stress long horizons. ScanObjectNN-C with a Transformer point-cloud backbone tests whether the idea holds outside images, compared directly with the Layer Normalization calibration method.
Cost is reported as images per second and peak memory against Tent and CFA. The shift detector is evaluated by the delay and false-alarm rate of resets at corruption boundaries, compared with PACE's trigger. The four-way placement ablation and the covariance ablation are run on every benchmark. A single clear outcome would resolve the pre-affine versus post-affine tension between the Layer Normalization analysis and SubTTA. That outcome would be subspace alignment on post-affine features through $\gamma$ beating both moment matching and full covariance matching at batch size 1.
References
- NOTE: Robust Continual Test-time Adaptation Against Temporal Correlation
- Patch Similarity Aware Data-Free Quantization for Vision Transformers
- Joint Normalization and Dimensionality Reduction on Grassmannian: A Generalized Perspective
- Revisiting Layer Normalization for Point Cloud Test Time Adaptation
- Robustifying Vision Transformer without Retraining from Scratch by Test-Time Class-Conditional Feature Alignment
- Subspace Alignment for Vision-Language Model Test-time Adaptation
- Benchmarking Neural Network Robustness to Common Corruptions and Perturbations
- Online identification and tracking of subspaces from highly incomplete information
- Subspace Optimization for Backpropagation-Free Continual Test-Time Adaptation
- Tent: Fully Test-Time Adaptation by Entropy Minimization
- Lifelong Test-Time Adaptation via Online Learning in Tracked Low-Dimensional Subspace
- Deep Domain Adaptation by Geodesic Distance Minimization