arXiv:2610.24220cs.LGOct 2026

Manuscript Offprint

arXiv:2610.24220

Hidden Trajectories Don't Lie: Correcting Corruption Drift for Test-Time Adaptation

Amirhossein Sabour, Amir Khasahmadi, Mengliu Zhao

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Test-time adaptation (TTA) adapts pretrained models to distribution shifts encountered during deployment. However, most existing methods rely primarily on the weight representations of the final layer or signals derived from the model's output probability distribution. In this work, we study hidden trajectories: the ordered sequence of intermediate representations produced across a deep neural network. We observe that clean and corrupted trajectories become more separable as corruption severity increases. Based on this observation, we introduce Drift-TTA, which adds zero-initialized low-rank adapters to a frozen backbone and trains them to align corrupted hidden trajectories with those from cleaner inputs. The proposed approach supports two variants: a source-dependent version trained with clean targets, and a source-free setting that learns from corrupted images at different severities. Building on these two variants, we further develop an online TTA approach that freezes the backbone and adapters while updating a scalar gate to control adaptation strength. We further cast trajectory alignment as MAP inference under a Gaussian observation model and derive a KL-based transfer bound characterizing test-time trajectory misalignment in terms of offline residual error, residual dimensionality, and distribution shift between offline and test corruptions. We evaluate Drift-TTA on CIFAR-10-C, CIFAR-100-C, and ImageNet-C using supervised ViTs and CLIP models. On CIFAR-100-C at severity 5, our source-free online approach improves accuracy over no TTA by 13.3 percentage points with ViT-B/16 and 11.6 percentage points with CLIP ViT-B/16, reaching 74.9% and 47.4%, respectively. Under the same setting, prior TTA baselines yield ECEs of 18.00% for ViT and 14.70% for CLIP, while our approach reduces them to 9.53% and 5.77%, respectively. These results demonstrate that hidden trajectory alignment provides an effective signal for both offline correction and lightweight online test-time adaptation.

1 Introduction

Test time adaptation (TTA) adapts a pretrained model to unlabeled test data during deployment, when corruptions such as sensor noise, weather, blur, and compression artifacts shift inputs away from the clean source distribution (Hendrycks and Dietterich, 2019). Many recent methods guide adaptation using prediction-derived objectives, learned update mechanisms, or auxiliary self-supervised signals (Liang et al., 2025; Xiao and Snoek, 2024). Some minimize entropy or use related confidence and energy objectives to update a small set of model parameters, including the affine parameters of batch normalization layers (Wang et al., 2021; Choi et al., 2025), while others adapt representations or features directly (Murphy et al., 2026; Cho et al., 2025).

∗^{*}This study was conducted during the author’s internship at Autodesk Research.

†^{\dagger}Corresponding author: mengliu.zhao@autodesk.com

Figure

(b)

Figure 1: Corruption progressively shifts hidden trajectories, while Drift-TTA moves them back toward clean. (a) Schematic of severity-dependent trajectory drift and the correction learned by Drift-TTA. (b) Distributions of the trajectory magnitude and angle features for clean and corrupted inputs at severities 1–5, before and after applying Drift-TTA. Each column compares clean inputs with one corruption severity. Without adaptation, the corrupted distributions move farther from clean as severity increases. With Drift-TTA, they shift back toward the clean distribution.

These studies demonstrate the potential of TTA to recover much of the accuracy lost on standard corruption benchmarks, often with modest computation and without source labels during test time. Entropy minimization is the primary approach in TTA, with several methods extending it through related confidence- and energy-based objectives (Deng et al., 2025; Lei et al., 2025). However, these objectives encourage the model to produce more confident predictions, but do not directly optimize whether those predictions are correct. As a result, an incorrect prediction can become more confident without necessarily being corrected.

Furthermore, intermediate features remain comparatively underexplored in TTA, both in how they change as corruption severity increases and in whether they can provide a complementary signal for adaptation. To examine this, we look beyond the final output or a single representation and follow how features evolve through the network. Chain-of-Embedding (Wang et al., 2025a) provides a framework for this by representing a forward pass as a trajectory of hidden states whose geometry can differ across outcomes. We extend this view to vision under corruption and examine whether clean and corrupted inputs trace distinguishable trajectories through a ViT or CLIP image tower. Across all models we test, features derived from the hidden trajectory separate clean and corrupted inputs more clearly as corruption severity increases. This observation motivates Drift-TTA, which adds zero-initialized low-rank adapters (Hu et al., 2022) to a frozen backbone and trains them so that corrupted inputs produce hidden trajectories closer to those of their clean counterparts. Figure 1 summarizes this intuition. Corruption progressively displaces the hidden trajectory as severity increases, while Drift-TTA learns a correction in the opposite direction and shifts the resulting trajectory features back toward the clean distribution.

Our contributions are summarized as follows:

• We introduce hidden trajectories as a vision-domain extension of the chain-of-embeddings framework previously studied in large language models: A hidden trajectory captures the ordered sequence of mean-pooled representations across backbone layers, and we show that trajectory-derived features increasingly separate clean from corrupted inputs as corruption severity grows across all tested vision models.

• We introduce hidden-trajectory alignment as a deployment-efficient mechanism for corruption correction: Drift-TTA instantiates this idea by attaching zero-initialized low-rank adapters to a frozen ViT or CLIP image encoder and training them offline to align corrupted hidden trajectories with those of cleaner inputs. The formulation supports both source-dependent adaptation using clean targets and source-free adaptation using corrupted/further-corrupted image pairs, with the latter requiring no clean source data. Once trained, the adapters remain fixed at inference, eliminating test-time gradients and per-sample optimization. The same formulation extends directly to CLIP zero-shot classification.

• We introduce an online variant of Drift-TTA that adapts the strength of this learned trajectory correction at test time: Drift-TTA-online keeps the backbone and trained adapters frozen and updates only one scalar per adapter branch to control its correction strength. Each scalar scales the correction vector produced by its adapter and is optimized using prediction entropy on each unlabeled target batch. The same procedure applies to both source-dependent and source-free adapters.

• We provide a probabilistic interpretation and theoretical bounds for hidden-trajectory alignment: We interpret the trajectory-alignment objective as regularized MAP estimation under a Gaussian observation model. We then derive a KL-based transfer bound and an explicit Gaussian form relating test-time residual error to offline residual error, residual dimensionality, and offline-to-test distribution shift.

• We establish that hidden-trajectory alignment consistently improves corruption robustness and calibration across models: On CIFAR-100-C at severity 5, source-dependent Drift-TTA-online improves mean accuracy by 16.6% and 13.0% over the unadapted ViT-B/16 and CLIP ViT-B/16, respectively, while exceeding the strongest compared TTA baselines by 2.5% and 6.2%. It also improves calibration, reducing mean ECE relative to these baselines by 9.94% for ViT and 9.69% for CLIP.

References (62)