Bayesian Test-Time Adaptation for Vision-Language Models

Lihua Zhou, Mao Ye, Shuaifeng Li, Nianxin Li, Xiatian Zhu, Lei Deng, Hongbin Liu, Zhen Lei

Introduction

Pre-trained vision-language models (VLMs) like CLIP have demonstrated remarkable "zero-shot" capabilities, classifying images into categories without explicit training. However, their performance often degrades when encountering "out-of-distribution" (OOD) data—such as specialized medical or satellite imagery. Existing Test-Time Adaptation (TTA) methods typically focus on "Likelihood Adaptation," updating text-based class embeddings to match incoming visual features. This paper argues that such approaches ignore a critical component of Bayesian inference: the class prior.

The Importance of the Prior

In a changing environment, the likelihood of a specific class appearing shifts. For example, a model trained to associate "fever" with a "cold" will fail during a pandemic where "fever" more likely indicates "COVID-19." Bayesian Class Adaptation (BCA) addresses this by dynamically updating class expectations alongside feature prototypes.

Conceptual comparison between fixed and adaptive priors in changing environments.

Methodology: Bayesian Class Adaptation (BCA)

BCA introduces a dual-updating mechanism that is entirely backpropagation-free, making it significantly more efficient than gradient-based methods. The framework consists of three main stages:

  1. Embedding: Generating initial visual and text features using pre-trained encoders.
  2. Likelihood Adaptation: Updating class prototypes (embeddings) using a running statistical mean of high-confidence incoming visual features.
  3. Prior Adaptation: Maintaining a dynamic prior for each class based on the model's posterior predictions. This allows the model to learn which classes are more prevalent in the current test stream.
The BCA framework illustrating the parallel updates of likelihood (class prototypes) and priors.

By avoiding expensive gradient descent and using simple moving averages, BCA achieves real-time adaptation with minimal computational overhead.

Key Results and Performance

The researchers evaluated BCA across major OOD benchmarks (ImageNet-A, R, S, V2) and ten cross-domain datasets (e.g., Aircraft, EuroSAT).

  • Accuracy: BCA achieved 61.81% accuracy on ImageNet OOD benchmarks, outperforming the previous state-of-the-art (TDA) and the baseline CLIP model.
  • Efficiency: BCA is approximately 5x faster than TDA and over 200x faster than backpropagation-based methods like TPT. On ImageNet, adaptation was completed in just 2.42 minutes.
  • Resource Management: The method is highly memory-efficient, requiring only 757MB of GPU memory, compared to the 21GB+ required by TPT, making it ideal for edge devices.

Conclusion

Bayesian Class Adaptation demonstrates that the class prior is a vital, yet often overlooked, factor in test-time adaptation. By synergizing likelihood and prior updates in a backpropagation-free framework, BCA provides a high-performance, resource-efficient solution for deploying vision-language models in dynamic, real-world environments. Future work may involve extending this Bayesian framework to more complex tasks like object detection and segmentation.

Summary updated

BibTeX
@inproceedings{zhou2025bayesian,
  author = {Lihua Zhou and Mao Ye and Shuaifeng Li and Nianxin Li and Xiatian Zhu and Lei Deng and Hongbin Liu and Zhen Lei},
  title = {{Bayesian Test-Time Adaptation for Vision-Language Models}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02792},
}
Figure