Axis-Aware Test-Time Normalization for Shared Video Transformers

When a video model is deployed on a robot or a car, its input degrades in ways training never covered: fog, sensor noise, compression, motion blur. For convolutional networks there is a cheap fix that needs no labels and no gradient steps. Swap the normalization statistics frozen at training time (per-channel means and variances) for statistics measured on incoming test data. This fix breaks in exactly the deployment setting that matters. Frames arrive one at a time, consecutive frames are nearly identical, and modern video models are transformers that use layer normalization rather than batch normalization. The gradient-based alternatives, which update weights by minimizing a self-supervised loss on test data, are slow. They also need a loss tailored to each output type, so a single backbone shared across classification, segmentation and tracking would need a separate adapted copy per task. That reintroduces the fragmentation that unified backbones were built to remove.

We propose that video transformers with decoupled attention, meaning attention computed within each frame and then across frames as separate sub-layers, already contain the structure needed for a cheap, forward-only, task-agnostic fix. Appearance corruptions such as noise, fog and blur act on each frame. They should mainly shift the token statistics entering the within-frame (spatial) sub-layers. The across-frame (temporal) sub-layers carry motion information, and that is precisely where re-estimating statistics on correlated frames is known to destabilize video models. The method re-centers token statistics only on the spatial pathway. Within a single frame the many patch tokens supply enough samples even at batch size one. The temporal pathway keeps its training statistics unless a temporal shift is detected. Because the correction lives entirely in the shared backbone, one adapted model serves every task head at once.

Core Claim

The claim has three parts, and each can be tested and falsified. First, in a divided spatio-temporal transformer, appearance corruptions shift the channel statistics of spatial sub-layer inputs much more than those of temporal sub-layer inputs. Temporal corruptions such as frame dropping, frame-rate change and compression flicker do the reverse. Second, a forward-only correction should follow this split. It should adapt spatial sub-layers aggressively from the current frame's tokens, smoothed over time, and leave temporal sub-layers at source statistics by default. Under appearance corruption, this should beat both uniform adaptation of every normalization site and a depth-only schedule that adapts shallow layers regardless of axis. Third, the gain should transfer across heterogeneous task heads on one backbone without any task-specific loss. The comparison is against gradient-based video adaptation run separately per task.

What is new is the unit of adaptation. Prior normalization adaptation chooses how much to trust test statistics per channel or per depth. We choose per attention axis, and we use the within-frame token set, not a batch of images, as the sample over which statistics are estimated.

Where this sits in prior work

The cheap fix comes from Improving robustness against common corruptions by covariate shift adaptation. It replaces frozen batch-norm statistics with test-batch statistics and cuts ResNet-50 mean corruption error on ImageNet-C from 76.7% to 62.2%. We reuse that idea of correcting only the moments, with no weight updates, but apply it to layer-normalized transformers, which that work does not address.

Three papers refine how much to trust test statistics. TTN learns channel-wise blending factors between source and test statistics. It finds that shallow layers prefer test statistics and deep layers prefer source statistics, but calibrating those factors needs labeled source data. Unraveling Batch Normalization for Realistic Test-Time Adaptation uses a test-time moving average with adaptive momentum and KL-guided layer-wise rectification. It holds CIFAR-10-C error near 21% at batch size 1, where entropy minimization reaches 90%. Test-time Batch Normalization preserves the training-time gradient form during adaptation and notes that these moment tricks do not map directly onto token-wise layer normalization. All three treat a layer as the unit and assume convolutional batch-norm networks. TTN in particular is the main constraint on our design: if its depth rule explains our results, our axis rule adds nothing.

Two papers motivate the temporal half of the idea. Self-supervised Test-time Adaptation on Video Data shows that fully replacing statistics with the current frame (momentum 1.0) catastrophically destabilizes video object segmentation because of inter-frame redundancy. It also shows that self-supervised proxy losses can hurt clean accuracy. Un-Mixing Test-Time Normalization Statistics handles temporally correlated streams by splitting statistics into $K$ Gaussian components updated online. It reports a 23% accuracy improvement over standard test-time batch norm on ImageNet-VID-C. Both work with monolithic convolutional features. Neither separates within-frame from across-frame statistics.

The closest video method is Video Test-Time Adaptation for Action Recognition (ViTTA). It aligns feature moments online and enforces prediction consistency across temporally resampled views, using full backpropagation through the backbone. It improves corrupted UCF101 accuracy on TANet from 51.35% to 78.20% at batch size 1. ViTTA is gradient-based, single-task, and treats space and time together. We test whether a forward-only, axis-split correction can recover most of that gain at a fraction of the cost and across several tasks at once.

The decoupling evidence supplies the structural premise. Sparse Video-Gen shows that even unconstrained 3D attention heads split into spatial and temporal specialists. TS2-Net and the Dual-Level Decoupled Transformer build spatial-then-temporal pipelines and find that early layers should stay purely spatial. None of these touch test-time adaptation.

From the unification line, Video Task Decathlon shows that one shared backbone can serve ten driving tasks with roughly 80% less compute than separate models. SeqTrack shows tracking can be posed as coordinate-token generation. Both are entirely static at test time. They define our constraint: the adaptation must not depend on which head is reading the features.

Research Program

The backbone is a divided spatio-temporal vision transformer, built in the style of the sequential spatial-then-temporal designs above. Every block contains a spatial attention sub-layer over the $N$ patches of each frame, followed by a temporal attention sub-layer over the $T$ positions of each patch, each preceded by layer normalization. The two sub-layer types alternate at every depth. This matters because it lets us separate the effect of attention axis from the effect of depth, which TS2-Net-style designs confound.

On this backbone we attach three light heads trained jointly:

  • an action classifier;
  • a mask propagation head for video object segmentation;
  • a SeqTrack-style coordinate-token decoder for single-object tracking.

During training we record, for every normalization site $\ell$, the per-channel source mean $m^{s}_\ell$ and standard deviation $\sigma^{s}_\ell$ of its input tokens. This needs no labels and is the same bookkeeping batch norm already does.

At test time, a token $z$ entering site $\ell$ is corrected before its layer normalization:

$$ \tilde z = \alpha_{a(\ell)}\left(\frac{z - \hat m_\ell}{\hat\sigma_\ell}\,\sigma^{s}_\ell + m^{s}_\ell\right) + \left(1-\alpha_{a(\ell)}\right) z . $$

Here $\hat m_\ell$ and $\hat\sigma_\ell$ are test-time channel statistics, $a(\ell)\in\{\text{spatial},\text{temporal}\}$ is the axis of the sub-layer that site feeds, and $\alpha_a$ is one blending weight per axis. The correction maps test-time channel moments back onto source moments, which layer normalization alone cannot do because it normalizes across channels within a single token.

For spatial sites, $\hat m_\ell$ and $\hat\sigma_\ell$ are computed over the $N$ tokens of the current frame and smoothed across frames with a moving average. This gives hundreds of samples per frame even at batch size one. For temporal sites, $\alpha_{\text{temporal}}$ defaults to zero. It is switched on only when a forward-only shift detector fires: the KL divergence between running temporal-site statistics and source statistics, borrowed from Unraveling Batch Normalization, crossing a threshold.

Content bias is a real risk. A frame that is mostly sky biases its own statistics. A variant therefore replaces the single moving average with the $K$-component mixture of UnMix-TNS on spatial sites only.

The two axis weights and the detector threshold are chosen once, on a held-out set of corruption types disjoint from the evaluation corruptions. No source labels are needed and nothing is tuned per task. The first deliverable is a diagnostic study, before any method comparison. For each corruption family, we measure the per-site KL shift separately for spatial and temporal sites at every depth. If appearance corruptions do not shift spatial sites markedly more than temporal sites at matched depth, the premise is wrong, and we stop and report that.

Baselines

The naive reference point is the source model with frozen statistics, run frame by frame on the corrupted streams. Every other number is reported as a gain over it.

The first adaptation baseline applies the same moment correction uniformly to every normalization site with one shared $\alpha$. This is the direct transformer analogue of covariate shift adaptation combined with the moving average of Unraveling Batch Normalization. It isolates whether the axis split matters at all.

The second applies UnMix-TNS uniformly to all sites. It is the strongest forward-only method designed for temporally correlated streams, and it reports a 23% accuracy gain over test-time batch norm on ImageNet-VID-C.

The third is a TTN-style depth schedule, after TTN. It adapts the shallowest $k$ blocks and keeps deeper blocks at source statistics, regardless of axis, with $k$ chosen on the same held-out corruptions. We compare it to our method at an equal number of adapted sites. This is the ablation that isolates the key ingredient.

The strongest existing method is ViTTA. It is reported at 78.20% on corrupted UCF101 with TANet at batch size 1, up from 51.35%. That figure comes from a different backbone, so we rerun ViTTA on our backbone with its published recipe. Its moment-alignment term is given the same source statistics we use, and it receives the same held-out tuning budget. Because ViTTA's consistency loss is defined for classification, we also run per-task gradient variants: the cycle-consistency test-time training of Self-supervised Test-time Adaptation on Video Data for segmentation, and token-entropy minimization on the coordinate decoder for tracking. Each task then gets its own adapted backbone copy, and we charge that cost explicitly.

We count the method as beating ViTTA if it comes within two accuracy points of ViTTA on corrupted UCF101 while using only forward passes, and matches or exceeds it on the segmentation and tracking heads. We count it as beating the forward-only baselines if it shows a consistent gain across corruption families, with no loss on clean video.

Why not just…?

Why not just adapt the shallow layers, as TTN found? In spatial-then-temporal designs shallow layers are spatial, so a depth rule could reproduce everything we attribute to the axis. This is the most serious threat. The alternating backbone and the matched-site comparison are designed to settle it. If the depth schedule equals the axis schedule when both axes are present at every depth, the axis claim is false, and we would report the result as an extension of TTN to transformers.

Why not just use the frozen statistics of a very large pretrained model? The evidence in hand says scale shrinks the problem but does not remove it. Covariate shift adaptation still helps models pretrained on billions of images (Improving robustness). The 3B-parameter Large Vision Model still shows degeneration and task confusion. We also run the frozen reference on the largest backbone our budget allows, to measure the remaining gap directly.

Why not just run gradient-based adaptation such as ViTTA? It is likely to be more accurate on the classification task it was built for, and we expect it to win there. The question is whether that accuracy is worth the cost. It needs backward passes and multiple temporal views per clip. It needs one proxy loss per output type, which means one backbone copy per task. And proxy losses can hurt clean accuracy, as Self-supervised Test-time Adaptation on Video Data documents. We report accuracy against frames per second and memory, so a reader can see the trade.

Why not just normalize each frame independently with its own token statistics, ignoring time? This is our method with momentum set to one on spatial sites and nothing on temporal sites. It is cheap and plausible. The ablation over spatial momentum, including full per-frame replacement, tells us whether temporal smoothing earns its place. If it does not, we simplify the method accordingly.

Proposed Experiments and Decisive Checks

Clean training uses Kinetics-400 for the backbone. Fine-tuning uses UCF101 and Something-Something v2 for actions, DAVIS2017 for segmentation, and LaSOT and GOT-10k for tracking.

We evaluate under two kinds of corruption. Appearance corruptions follow the ImageNet-C protocol applied per frame at severity 5. Temporal corruptions are frame dropping, frame-rate change, motion blur and H.265 compression, as in ViTTA. Evaluation is streaming at batch size 1. Metrics are top-1 accuracy for UCF101 and SSv2, the J-score for DAVIS2017, AUC for LaSOT-C, and average overlap for GOT-10k, plus frames per second and peak memory.

Several reference points come from the file. The cited prior result on DAVIS2017 under fog is a J-score rising from 19.27 to 37.97 with test-time training on VideoWalk. No reported result was found on Lacuna for LaSOT-C numbers alone, or for ViTTA on corrupted SSv2 or Kinetics-400, so those baselines are produced here. As a secondary check that the method is not tied to our backbone, we apply the spatial-site correction to the shared backbone of Video Task Decathlon on corrupted BDD100K. No reported result was found on Lacuna for VTDNet under corruption; its clean VTDA is 225.3.

Four results would decide the claim:

  • Diagnostic. Appearance corruptions must shift spatial-site statistics more than temporal-site statistics at matched depth, and temporal corruptions must do the reverse.
  • Depth versus axis. At equal adapted-site count on the alternating backbone, the axis schedule must beat the depth schedule on appearance corruptions.
  • Temporal sites. Turning on temporal-site adaptation under appearance corruption should reproduce the instability seen with momentum 1.0 on video. Turning it on under temporal corruption should help.
  • Task agnosticism. A single adapted backbone must improve all three heads simultaneously, with no clean-video regression and at near-source frame rate.

If the first check fails, the project reverts to a careful negative result on moment adaptation for layer-normalized video transformers. If only the second fails, it reverts to a transformer port of depth-wise blending.