Variational Continual Test-Time Adaptation

Fan Lyu, Kaile Du, Yuyang Li, Hanyu Zhao, Fuyuan Hu, Zhang Zhang, Guangcan Liu, Liang Wang

TL;DR

VCoTTA (Variational Continual Test-Time Adaptation) introduces a Bayesian framework to solve the "error accumulation" problem in models that must adapt to a never-ending stream of new environments. By treating model weights as distributions and adaptively mixing reliable source knowledge with noisy new observations, it achieves state-of-the-art accuracy and significantly better uncertainty calibration than deterministic methods.

What Problem Does This Paper Address?

When we deploy a machine learning model in the real world, the data it sees often changes over time—a phenomenon called domain shift (e.g., a self-driving car moving from sunny weather to rain, then to snow). Continual Test-Time Adaptation (CTTA) aims to update a pre-trained model on-the-fly using only unlabeled data from these shifting environments.

The Achilles' heel of CTTA is error accumulation. Because the model relies on its own (potentially wrong) predictions to update itself (pseudo-labeling), a few mistakes can snowball. Over time, the model "forgets" its original robust features and becomes overconfidently wrong. Existing methods try to fix this with heuristics, but they often lack a principled way to handle the inherent uncertainty of unlabeled, non-stationary data.

The challenge of error accumulation in CTTA

Methods

The authors propose VCoTTA, which shifts the paradigm from deterministic models to Bayesian Neural Networks (BNNs). Instead of single values, model weights are represented as probability distributions.

1. Variational Warm-up (VWU)

Training a BNN from scratch is hard. VCoTTA uses a "warm-up" strategy to transform a standard, pre-trained deterministic model into a BNN. It injects stochasticity into the weights while preserving the original knowledge, allowing for efficient adaptation without full retraining.

2. Adaptive Prior Mixture

In standard Bayesian learning, you use your last "best guess" (posterior) as the starting point (prior) for the next task. In CTTA, that last guess might be corrupted by noise. VCoTTA solves this by mixing two priors:

  • The Source Prior: The reliable knowledge from the original training data.
  • The Teacher Prior: The current knowledge adapted to the new domain.

The model uses an entropy-based modulating factor to decide how much to trust each. If the model is highly uncertain about a new sample, it leans back on the reliable source prior to prevent drifting into error.

Fig. 2. BI in continual learning versus CTTA. We find the traditional prior transmission is infeasible in CTTA because of the unreliable prior from unlabeled data. In our method, we place CTTA in a mean-teacher structure, and design BI in CTTA using a mixture of teacher prior and source prior. The next teacher prior is updated by the exponential moving average.

3. Mean-Teacher VI

The system uses a student-teacher setup. The student model is updated via Variational Inference (VI), while the teacher model is a stable, moving average of the student. The optimization goal (the Evidence Lower Bound, or ELBO) is redesigned to minimize both prediction error and the divergence from the adaptive prior mixture.

Datasets

The authors evaluated VCoTTA on three standard benchmarks for robustness, each featuring 15 types of corruptions (like blur, noise, and weather changes) applied at maximum severity:

  • CIFAR10-to-CIFAR10C
  • CIFAR100-to-CIFAR100C
  • ImageNet-to-ImageNetC (a large-scale challenge with 1,000 classes)

Key Insights and Ideas

  • Uncertainty as a Safety Valve: By explicitly modeling weight uncertainty, VCoTTA can identify when it is likely to make a mistake. This uncertainty directly controls the adaptation process, acting as a filter against noisy updates.
  • The "Anchor" Effect: Always keeping a foot in the "source prior" prevents the catastrophic forgetting and radical model drift common in long-term adaptation scenarios.
  • Bayesian-izing is Practical: The Variational Warm-up shows that you don't need a BNN from the start; you can successfully "Bayesian-ize" off-the-shelf models for deployment.

Key Results

VCoTTA consistently outperformed state-of-the-art (SOTA) methods across all datasets:

  • Accuracy: On CIFAR10C, VCoTTA achieved an average error rate of 13.1%, significantly lower than the 15.3% achieved by the previous SOTA (SWA).
  • Calibration: The method showed much better Negative Log-Likelihood (NLL) and Brier Scores, meaning its confidence levels actually match its likelihood of being correct.
  • Long-term Stability: In experiments where corruptions were looped 10 times, VCoTTA remained stable while other methods saw their performance degrade as errors accumulated.

Limitations and Future Work

  • Computational Cost: BNNs require doubling the number of parameters (storing both means and variances) and involve multiple forward passes for stochastic estimation, which increases memory and time overhead.
  • Source Data Access: The "warm-up" phase requires access to the original source data. While this happens before deployment, it might be a hurdle in privacy-sensitive applications where source data is strictly unavailable.
  • Future Directions: The authors suggest exploring more efficient ways to implement Gaussian mixtures and further reducing the computational footprint to make VCoTTA more suitable for edge devices.

Summary updated

BibTeX
@misc{lyu2024variational,
  author = {Fan Lyu and Kaile Du and Yuyang Li and Hanyu Zhao and Fuyuan Hu and Zhang Zhang and Guangcan Liu and Liang Wang},
  title = {{Variational Continual Test-Time Adaptation}},
  year = {2024},
  eprint = {2402.08182},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.08182},
}
Figure