SANTA: Source Anchoring Network and Target Alignment for Continual Test Time Adaptation

Goirik Chakrabarty, Manogna Sreenivas, Soma BiswasTMLR 2023

Abstract

Adapting a trained model to perform satisfactorily on continually changing test environments is an important and challenging task. In this work, we propose a novel framework, SANTA, which aims to satisfy the following characteristics required for online adaptation: 1) can work effectively for different (even small) batch sizes; 2) should continue to work well on the source domain; 3) should have minimal tunable hyperparameters and storage requirements. Given a pre-trained network trained on source domain data, the proposed framework modifies the affine parameters of the batch normalization layers using source anchoring based self-distillation. This ensures that the model incorporates knowledge from the newly encountered domains, without catastrophically forgetting the previously seen domains. We also propose a source-prototype driven contrastive alignment to ensure natural grouping of the target samples, while maintaining the already learnt semantic information. Extensive evaluation on three benchmark datasets under challenging settings justify the effectiveness of SANTA for real-world applications.

Introduction

Deep learning models often struggle when deployed in real-world environments that differ from their training data, a phenomenon known as domain shift. While Test-Time Adaptation (TTA) helps models adjust to a single new environment, Continual Test-Time Adaptation (CTTA) addresses the more complex scenario where environments shift dynamically (e.g., changing weather conditions for an autonomous vehicle).

Existing CTTA methods frequently encounter two major hurdles: catastrophic forgetting, where the model loses its original capabilities while adapting to new noise, and computational inefficiency, often requiring multiple forward passes or large storage overhead. SANTA (Source Anchoring Network and Target Alignment) is designed to overcome these challenges by providing a lightweight, stable, and fast adaptation mechanism.

The SANTA Framework

SANTA focuses on a "surgical" adaptation approach by updating only the Batch Normalization (BN) parameters of a network. This strategy preserves the core weights of the model while allowing it to adjust to new data distributions. The framework is built upon two primary components:

  1. Source Anchoring (SA): To prevent the model from drifting too far from its original source knowledge, SANTA utilizes a "Target Corrected Source" (TCS) model as an anchor. The TCS model is the original source model with its BN statistics updated to the current test batch. The adapting model is then trained via self-distillation to match the TCS predictions, ensuring it learns from new domains without losing foundational logic.
  2. Target Alignment (TA): To maintain semantic consistency, SANTA employs contrastive learning. For every image, it considers three views: the original, an augmented version, and the nearest source prototype (the mean feature vector for a class from the original training data). By aligning target features with these prototypes, the model maintains organized feature clusters even under heavy corruption.
The SANTA framework architecture, highlighting Source Anchoring (1) and Source Guided Target Alignment (2).

Experimental Evaluation

The researchers evaluated SANTA on several rigorous benchmarks, including CIFAR-10C, CIFAR-100C, and ImageNet-C, which contain various digital corruptions like blur, noise, and weather effects.

Key Results

  • Superior Accuracy: On ImageNet-C, SANTA achieved a 60.3% error rate, significantly outperforming previous state-of-the-art methods like RMT (69.9%) and CoTTA (69.7%).
  • Efficiency and Speed: SANTA is approximately 10x faster than CoTTA during inference because it avoids the need for dozens of forward passes per image. Additionally, it only requires storing roughly 2.5% of the total parameters as trainable.
  • Robustness to Batch Size: A critical advantage of SANTA is its stability across varying batch sizes. While many TTA methods fail with small batches, SANTA remains effective even with as few as 10 samples, making it ideal for edge computing scenarios.
Error rates on CIFAR-10C across different batch sizes. SANTA (purple) demonstrates superior stability and lower error compared to other methods, especially at small batch sizes.

Discussion and Conclusion

SANTA successfully balances the stability-plasticity dilemma by anchoring the adaptation process to source knowledge. By using source prototypes as a compass for feature alignment, it injects supervised knowledge into an unsupervised process.

While highly effective for architectures using Batch Normalization (like ResNets), future work involves extending this anchoring logic to modern architectures like Vision Transformers (ViTs) that utilize Layer Normalization. Overall, SANTA represents a significant step toward deploying robust AI models in unpredictable, real-world environments.

Summary updated

BibTeX
@article{chakrabarty2023santa,
  author = {Goirik Chakrabarty and Manogna Sreenivas and Soma Biswas},
  title = {{SANTA: Source Anchoring Network and Target Alignment for Continual Test Time Adaptation}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=V7guVYzvE4},
}
Figure