Resilient Practical Test-Time Adaptation: Soft Batch Normalization Alignment and Entropy-driven Memory Bank

Xingzhi Zhou, Zhiliang Tian, Ka Chun Cheung, Simon See, Nevin L. ZhangarXiv 2024 · DOI

Abstract

Practical Test-Time Adaptation (PTTA) aims to adapt pre-trained models to evolving target domains during inference without access to source data. However, existing methods often struggle with catastrophic forgetting during continuous shifts and performance degradation under non-i.i.d. data streams. We introduce ResiTTA, a framework designed for resilient adaptation. ResiTTA employs Resilient Batch Normalization (ResiBN), which utilizes Wasserstein distance for soft alignment with source statistics, and an Entropy-driven Memory Bank (EntroBank) to maintain a diverse and informative sample buffer. Our approach achieves state-of-the-art performance across major benchmarks, including ImageNet-C and CIFAR-C.

Introduction

Machine learning models typically operate under the assumption that deployment data follows the training distribution. In real-world scenarios, models frequently encounter domain shifts—such as a vision system trained in clear weather navigating a storm. Test-Time Adaptation (TTA) addresses this by updating models on-the-fly using unlabeled inference data.

"Practical" TTA (PTTA) introduces two significant challenges:

  1. Continuous Shifts: Environments evolve dynamically (e.g., changing weather intensities). Models often overfit to the immediate environment, leading to the loss of previously acquired knowledge.
  2. Non-i.i.d. Data: Real-world data streams are often temporally correlated, where specific classes appear in long clusters. Standard TTA methods, which assume independent and identically distributed (i.i.d.) data, often fail when a single class dominates the input stream.

Methodology

ResiTTA addresses these hurdles through a Teacher-Student framework combined with two novel components: ResiBN and EntroBank.

Overview of the ResiTTA framework, illustrating the interaction between the online data stream, the entropy-driven memory bank, and the teacher-student model update process.

Resilient Batch Normalization (ResiBN)

Standard batch normalization relies on statistics from the current batch, which can be highly unstable in shifting environments. ResiBN introduces a "soft alignment" strategy. Instead of forcing the model to adopt target statistics entirely, it uses the Wasserstein distance to regularize the moving target statistics toward the original source statistics. This acts as a tether, preventing model parameters from drifting into unstable regions. The use of Wasserstein distance is numerically superior to KL Divergence in this context, as it provides more stable gradients and avoids the "exploding gradient" issues associated with high-confidence predictions.

Visualization of the soft alignment between source and target distributions facilitated by ResiBN.

Entropy-driven Memory Bank (EntroBank)

To mitigate the effects of non-i.i.d. data, ResiTTA maintains a small buffer of past samples for replay. EntroBank improves upon standard buffers by prioritizing three criteria:

  • Timeliness: It removes stale samples that no longer represent the current environment.
  • Anti-Overconfidence: It identifies and removes "easy" samples that have persisted with very low entropy. These over-confident samples can cause the model to stall or overfit.
  • Uncertainty: It uses entropy to ensure the bank retains high-quality, informative data that challenges the model.

Experimental Results

ResiTTA was evaluated on CIFAR10-C, CIFAR100-C, and ImageNet-C benchmarks under Dirichlet-sampled non-i.i.d. conditions. The framework consistently outperformed previous state-of-the-art (SOTA) methods:

  • ImageNet-C: ResiTTA reduced the average error rate from 71.6% (previous SOTA) to 66.7%. Notable improvements were seen in severe distortion categories like impulse noise (approx. 9% absolute reduction).
  • CIFAR10-C & CIFAR100-C: Error rates were reduced to 22.4% and 33.5%, respectively, demonstrating robust performance across scales.

Discussion and Conclusion

ResiTTA demonstrates that "soft" statistical alignment and active management of memory bank diversity are critical for stable test-time adaptation. While the framework introduces additional hyperparameters—such as alignment strength and age thresholds—it provides a significant leap in reliability for models deployed in volatile environments. Future work will explore the application of these resilient strategies to complex tasks like object detection and semantic segmentation.

Summary updated

BibTeX
@misc{zhou2024resilient,
  author = {Xingzhi Zhou and Zhiliang Tian and Ka Chun Cheung and Simon See and Nevin L. Zhang},
  title = {{Resilient Practical Test-Time Adaptation: Soft Batch Normalization Alignment and Entropy-driven Memory Bank}},
  year = {2024},
  eprint = {2401.14619},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.14619},
}
Figure