Vision-Language Models (VLMs) like CLIP have revolutionized zero-shot image classification by learning a shared embedding space for images and text. However, these models remain surprisingly brittle when encountering "domain shifts"—such as Gaussian noise, motion blur, or artistic stylization—that were not present during their initial training.
In the paper WATT: Weight Average Test-Time Adaptation of CLIP, researchers from LIVIA and ILLS introduce a novel method to enhance CLIP's robustness. Instead of traditional retraining, WATT adapts the model on the fly using the specific test images it is tasked to classify, leveraging weight averaging across multiple text prompt templates.
The Challenge of Domain Shift and Prompt Sensitivity
While CLIP is powerful, its performance degrades significantly under corruption or style changes. Existing Test-Time Adaptation (TTA) methods often require large batches of images or complex auxiliary tasks to mitigate this. Furthermore, CLIP's performance is highly sensitive to the specific text prompt used (e.g., "a photo of a dog" vs. "a sketch of a dog"). The authors observed that different prompts lead the model toward different solutions during adaptation, with some generalizing far better than others.
The WATT Framework: Multi-Template Weight Averaging
The core innovation of WATT is Multi-Template Weight Averaging (MTWA). Rather than attempting to identify a single optimal prompt, WATT utilizes the diversity of multiple text templates to find a more stable, generalized model state.
- Adaptation Phase: The model processes a test image alongside a set of diverse text templates (e.g., "a photo of a...", "itap of a..."). During this phase, WATT updates only the Layer Normalization (LN) weights of the vision encoder. This is achieved using a transductive loss that calculates similarity across samples in a batch.
- Weight Averaging: WATT explores two primary strategies for combining knowledge:
- Parallel (WATT-P): The model is adapted separately for each template from the same starting point, and the resulting weights are averaged.
- Sequential (WATT-S): The model is updated iteratively using one template after another in a sequence.
- Evaluation Phase: For the final prediction, WATT utilizes the weight-averaged vision encoder and ensembles the text side by averaging the embeddings of all prompt templates.
Experimental Evaluation
WATT was evaluated across 155 scenarios spanning several major benchmarks, including natural shifts (CIFAR-10/100), corrupted data (CIFAR-10-C/100-C), sim-to-real transitions (VisDA-C), and domain generalization tasks (PACS, VLCS, OfficeHome).
Insights: Why Weight Averaging Works?
A key finding of the research is that adaptation performance can fluctuate by up to 3% based on the chosen text template. By averaging weights across these templates, WATT does more than just reduce variance; it guides the model toward a flatter minimum in the loss landscape. In machine learning, flatter minima are a strong indicator of superior generalization and robustness to noise.
Key Results and Performance
WATT consistently outperformed baseline CLIP and state-of-the-art TTA methods like TENT and TPT:
- Robustness to Corruption: On CIFAR-100-C with Gaussian Noise, WATT-S improved accuracy by over 17% compared to the CLIP baseline.
- Consistency: Across all 15 corruption types in CIFAR-100-C, WATT-S achieved a mean accuracy of 45.57%, significantly higher than CLIP's 29.43%.
- Efficiency and Scalability: By focusing updates on LayerNorm weights, the method remains lightweight. Notably, WATT provides performance gains even with a batch size of 1, making it viable for real-time, single-image adaptation.
Limitations and Future Directions
While WATT represents a significant advancement in VLM robustness, the authors identify several areas for future work. These include extending the method to complex tasks like object detection, integrating automated prompt engineering to replace predefined templates, and further optimizing the computational cost of running multiple adaptation iterations at test time.
Summary updated