Where Drift Enters a Residual Network

When a deployed image model starts seeing foggy, noisy or otherwise unfamiliar inputs, current practice treats the network as a single box. Drift detectors test either the raw inputs or the final features. Test-time adaptation methods (methods that update a model on unlabeled test data) either update every normalization layer or reset a uniformly random 1% of weights. Networks with skip connections do not behave like a single box, though. Each residual block adds its own contribution on top of a running "stream" that carries earlier features forward unchanged. Work on information flow has shown that, as a result, how much a layer knows about the input or the label rises and falls with depth instead of decaying steadily. This proposal asks the same question about distribution shift: at which blocks does a shift actually enter the network, and at which blocks is it amplified or cancelled?

The core proposal is to measure drift separately on each residual block's added contribution, rather than on the summed stream. Drift in the summed stream at depth $l$ mixes shift carried forward by the skip path with shift newly created by block $l$. Only the block's own output tells you where corruption enters. We expect this "drift-entry profile" over depth to be non-monotonic and to differ by shift type. We test whether it does two useful things. First, it should pick where to monitor, so that shifts are detected with fewer samples. Second, it should pick where to adapt and where to restore source weights during continual test-time adaptation. With a few delayed labels, the same profile should also distinguish covariate shift (the inputs change) from concept drift (the input-to-label mapping changes).

Core Claim

In a residual network with blocks $h_{l+1} = h_l + f_l(h_l)$, the label-free statistic that best locates distribution shift is computed on the residual branch output $f_l(h_l)$, not on the stream $h_l$. We define the drift-entry score of block $l$ at stream time $t$ as an energy distance between a reference window from the source distribution and the current window:

$$E_l(t) = 2\,\mathbb{E}\|a - b\| - \mathbb{E}\|a - a'\| - \mathbb{E}\|b - b'\|.$$

Here $a, a'$ are independent pooled branch outputs $f_l(h_l)$ on source inputs, and $b, b'$ are the same quantity on current-window inputs. The score is normalized by its value under source-versus-source resampling so that blocks of different widths can be compared. We claim three things. The profile $E_l(t)$ is non-monotonic in $l$. Its shape depends on the type of shift: noise should enter early, while blur and weather may enter at middle blocks. And blocks with high entry scores are the ones whose adaptation helps, while blocks with low entry scores should be held near their source weights.

The parts that would be new are the branch-versus-stream decomposition, its use as a label-free signal, and its use to allocate adaptation and restoration. Existing analyses of non-monotonic information flow are supervised and run offline on stationary data.

Relation to Prior Work

Three papers motivate the claim by showing that information is non-monotonic in skip architectures. Information Flow Through U-Nets plots mutual information with input and output across U-Net layers and finds U-shaped curves, along with skip connections whose usefulness depends on training duration. On the Information of Feature Maps and Pruning of Deep Neural Networks finds deeper layers with higher label dependence than shallower ones. Using Sliced Mutual Information to Study Memorization and Generalization in Deep Neural Networks shows that deep layers react to label noise differently from shallow ones. All three measure a stationary, labeled distribution. We measure the difference between two unlabeled distributions over time.

The method borrows from three sources. From On The Energy Statistics of Feature Maps in Pruning of Neural Networks with Skip-Connections we take model-free energy statistics on feature maps. PED uses them as a supervised dependence on labels for offline pruning; we use energy distance between time windows, which needs no labels. From the sliced estimators of the mutual-information work and from Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test we take the streaming estimator. IKS is a univariate Kolmogorov–Smirnov test kept current in $O(\log N)$ per update. We run it on fixed random one-dimensional projections of each block's output, which lets us track the profile online without high-dimensional density estimation. Information Theoretic Pruning of Coupled Channels in Deep Neural Networks shows that channels tied together across residual paths must be treated as one unit. This constrains the design: restoration decisions are made per block and per coupled channel group, never per scalar weight.

Four papers are the competitors we must beat. Sequential Covariate Shift Detection Using Classifier Two-Sample Tests detects shift with an online source-versus-target classifier on fixed features and controls the false positive rate. It treats the feature extractor as a black box. Continual Test-Time Domain Adaptation (CoTTA) combines a mean-teacher setup with random restoration of 1% of weights. The restoration is uniform and ignores network topology, which is exactly the assumption we challenge. TEA: Test-Time Energy Adaptation adapts normalization layers using the energy of the output logits. Its "energy" is an output-layer score, unrelated to the layerwise energy distance used here, and it updates all normalization layers alike. An Information-Theoretic Analysis for Federated Learning under Concept Drift models the environment's drift as a Markov chain but treats the network as one block of parameters. That is complementary to our focus on the inside of the network.

Research Program

The first stage is measurement. We take pretrained residual classifiers and stream them through continual corruption sequences from CIFAR-10-C, CIFAR-100-C and ImageNet-C. For every block we record branch-level and stream-level profiles, using exact energy distance on held-out windows and the sliced incremental estimator online. The study asks whether the profile is non-monotonic, whether it clusters by corruption family, and whether it is stable across seeds and window sizes. One concrete prediction is that the stream-level profile will look smooth and rising, because shift accumulates along the skip path. The branch-level profile should instead show sharp entry points. If the two profiles agree, the decomposition adds nothing, and we stop at the measurement paper.

The second stage is detection. We build a sequential detector that watches only the top-$k$ entry blocks. These are chosen once, on a calibration set of shift types disjoint from the test shifts. The detector combines the blocks' sliced KS statistics with a Bonferroni-corrected threshold, so the false positive rate stays at the same nominal level as the C2ST baseline.

The third stage is adaptation. Inside CoTTA we replace uniform 1% restoration with a block-wise restoration rate that falls as the block's current entry score rises. Blocks where drift is entering are allowed to move; blocks that look unshifted are pulled back toward source weights. Coupled channel groups are restored together. The total restoration budget is held at CoTTA's 1% so that only its allocation changes. The same rule gives a cheap variant that updates normalization parameters only in high-entry blocks.

The fourth stage addresses concept drift, which by definition cannot be seen without labels. We use the delayed-label setting from IKS: labels are requested only after an alarm. On those labels we compute PED-style energy dependence between each block's output and $Y$. We predict that pure covariate shift moves the label-free entry profile while leaving dependence on $Y$ largely intact. Concept drift, by contrast, leaves the entry profile flat and moves dependence only near the head. To test this, we build streams with matched covariate and concept components. The concept-drift version keeps CIFAR images fixed and permutes a subset of labels partway through the stream. The covariate version switches corruption type with labels fixed.

Baselines

The naive reference is the frozen source model with no detection and no adaptation, together with a detector that runs a two-sample test on raw inputs. These set the floor for the whole comparison.

The strongest detection competitor is sequential C2ST on penultimate features. It reports needing 190 shifted samples to reach an 80% detection rate in an ImageNet multiple-shift scenario, while keeping the false positive rate below 1% (Sequential Covariate Shift Detection Using Classifier Two-Sample Tests). We run it on the same backbone, the same streams and the same nominal false positive rate. The entry-block detector beats it if it reaches 80% detection with clearly fewer shifted samples on shift types held out from block selection, without exceeding the false positive rate. We also run IKS on inputs, for which the IKS paper reports topline accuracy using 42% to 47% of labels on its streams. Those streams are tabular, so this comparison is a sanity check only.

The strongest adaptation competitor is CoTTA. It reports 16.2% average error on CIFAR10-C, against 20.4% for batch-normalization adaptation and 20.7% for TENT-continual, and 32.5% error on CIFAR100-C (Continual Test-Time Domain Adaptation). We rerun CoTTA from its protocol with the same backbones, corruption order, batch size and augmentation count, and give both methods equal tuning budgets for the restoration rate. TEA, which reports a +4.7% accuracy gain with WRN-28-10 on CIFAR-10/100-C, serves as the strongest normalization-only competitor. Beating CoTTA means lower average error on CIFAR10-C and CIFAR100-C across at least three seeds and orderings, with no larger degradation over repeated cycles of the stream.

Three ablations isolate the key ingredient. The first computes the profile on the summed stream instead of on branch outputs. The second allocates the same restoration budget to randomly chosen blocks. The third uses a depth-monotone prior that adapts shallow blocks most. If the stream-profile ablation does as well as the branch profile, the non-monotonic decomposition is not what matters.

Why not just…?

Why not just run C2ST on the penultimate layer? This is the most serious threat to the detection claim. The penultimate layer already sums everything the skip paths carry. If a shift reaches it at full strength, watching earlier blocks adds nothing. Our argument is that later blocks and normalization layers can partly cancel a shift that entered early, so its signal is weaker at the head than at its entry point. The mutual-information study's finding that sensitivity to noise differs sharply across depth makes this plausible, but it does not prove it. The head-to-head test on held-out corruptions settles the question. If penultimate C2ST matches us, we report that and keep only the adaptation claim.

Why not monitor every layer and take the maximum? Doing so tests the stream rather than the branches, and correcting for testing all layers costs statistical power. The matched-false-positive comparison between all-layer monitoring and top-$k$ entry monitoring measures that cost directly. The summed-stream ablation shows whether the branch decomposition, rather than simply watching more layers, accounts for any gain.

Why not tune CoTTA's uniform restoration rate, or adapt only normalization layers? If where you restore does not matter, only how much, then a tuned uniform rate will match us. The gap between batch-normalization adaptation and CoTTA reported in the CoTTA paper shows that adaptation capacity matters. It does not show that allocation matters. The random-block ablation at an equal budget, with equal tuning effort, is the decisive test. A null result here would be a real negative finding about topology-aware adaptation.

Why not choose blocks by gradient norm instead of drift? Gradient-based selection depends on the pseudo-label loss. Under continual shift that loss is exactly what drifts into error spirals, so selection driven by it inherits the errors. The entry score is computed from features alone. We include gradient-norm selection at an equal budget as an additional arm. If it matches us at lower cost, it should be preferred.

Decisive Checks

The idea stands or falls on four observations. On CIFAR-10-C and ImageNet-C the branch profile must be non-monotonic and differ by corruption family where the stream profile does not. Entry-block detection must beat penultimate C2ST in samples needed to reach 80% detection on held-out shifts, at a false positive rate of 1% or less. Entry-guided restoration must beat CoTTA's 16.2% CIFAR10-C error, and must also beat the random-block ablation at an equal budget. On the label-permutation streams, dependence on $Y$ must separate concept drift from covariate shift while the label-free profile does not. If the first observation fails, the program reduces to a negative measurement result. If only the adaptation check fails, the contribution narrows to detection and to localizing where drift enters.