Test-Time Adaptation (TTA) adapts pre-trained models using only unlabeled test streams, requiring real-time inference and update without access to source data. We propose StructuralTest-time Alignment of Gradients (STAG), a lightweight plug-in enhancer that exploits an always-available structural signal: the classifier's intrinsic geometry. STAG derives class-wise structural anchors from classifier weights via self-structural entropy, and during adaptation analytically computes the predicted-class entropy gradient from forward-pass quantities, aligning it to the corresponding anchor with a cosine-similarity loss. This closed-form design incurs near-zero memory and latency overhead and requires no additional backpropagation beyond the underlying baseline. Across corrupted image classification and continual semantic segmentation, STAG provides broadly applicable performance gains for strong TTA baselines on both CNN and Transformer architectures regardless of the underlying normalization scheme, with particularly large gains under challenging online regimes such as imbalanced label shifts, single-sample adaptation, mixed corruption streams and long-horizon continual TTA.
翻译:测试时自适应(TTA)仅利用未标注的测试数据流对预训练模型进行适配,要求在无法访问源数据的情况下实现实时推理与更新。本文提出梯度结构对齐(STAG),一种轻量级即插即用的增强模块,它利用一个始终可用的结构信号:分类器固有的几何特性。STAG通过自结构熵从分类器权重中推导出类别级结构锚点,并在自适应过程中基于前向传播量解析计算预测类别的熵梯度,通过余弦相似度损失使其与对应锚点对齐。这种闭式设计几乎不产生额外的内存与延迟开销,且无需在基线方法之外进行额外的反向传播。在损坏图像分类与持续语义分割任务上的实验表明,无论采用CNN还是Transformer架构,也不依赖于底层归一化方案,STAG均能为强TTA基线模型带来广泛适用的性能提升,且在标签分布不平衡、单样本自适应、混合损坏流以及长时持续TTA等具有挑战性的在线场景中提升尤为显著。