Abstract
Deep learning models often struggle with distribution shifts encountered during real-world deployment, such as environmental corruptions or stylistic variations. While Test-Time Adaptation (TTA) offers a solution by updating models on-the-fly, traditional methods that modify model weights suffer from high storage overhead and potential instability. This paper introduces Visual Prompt Adaptation (VPA), a framework that adapts frozen models to new domains by learning a small set of visual tokens at test time. VPA is highly storage-efficient and demonstrates superior performance across diverse benchmarks, including ImageNet-C and DomainNet.
Introduction
Standard computer vision models are notoriously brittle when faced with "real-world surprises"—distribution shifts that deviate from the training data. Whether it is a change in weather (snow, rain), sensor noise (motion blur), or a shift in artistic style (sketches, paintings), these shifts can significantly degrade accuracy.
To address this, researchers have turned to Test-Time Adaptation (TTA). However, conventional TTA methods like TENT typically require updating the internal weights of the model. This approach presents three major hurdles:
- Storage Overhead: Deploying models in multiple environments requires saving separate weight checkpoints for each.
- Stability: Modifying weights can lead to "catastrophic forgetting" or break the model's foundational knowledge.
- Source Dependency: Many methods rely on access to original training data, which is often restricted due to privacy or scale.
VPA proposes a paradigm shift: instead of changing the model to fit the data, we adapt the input space using learnable "visual prompts" while keeping the backbone model entirely frozen.
Methodology
Visual Prompting Mechanism
Inspired by prompt tuning in Large Language Models (LLMs), VPA introduces a small number of learnable parameters that interact with the model's architecture. These prompts come in two primary forms:
- Additive Prompts: These parameters are added directly to the input patches or intermediate feature maps.
- Prependitive Prompts: These function as additional "tokens" (similar to prefix-tuning) inserted into the sequence of a Vision Transformer (ViT).
Zero-Attention Initialization
A critical component of VPA is Zero-Attention Initialization. By initializing prompts as zeros, the framework ensures that the model's initial performance at test time is identical to its original state. This prevents "initialization shock," where random prompt values might initially degrade performance before adaptation begins.
Adaptation Strategies
VPA supports three distinct modes of adaptation depending on the data availability:
- Batched-Image Adaptation (BIA): The model adapts using a group of images by minimizing Shannon entropy, effectively increasing the model's confidence in its predictions.
- Single-Image Adaptation (SIA): When only one image is available, VPA generates multiple augmented versions of that image to simulate a batch, allowing for stable gradient updates.
- Pseudo-Label Adaptation (PLA): This mode utilizes a memory queue and a $k$-nearest neighbor approach to generate reliable pseudo-labels, enabling a supervised-style learning signal during the test phase.
Experimental Results
The authors evaluated VPA against a rigorous suite of benchmarks designed to test robustness and generalization:
- Out-of-Distribution (OOD) Generalization: On datasets like ImageNet-A (adversarial), ImageNet-R (renditions), and ObjectNet, VPA improved average accuracy by 3.3% over standard models, outperforming weight-tuning baselines like TENT.
- Corruption Robustness: On ImageNet-C, which features 15 types of digital and environmental corruptions, VPA boosted performance by 6.5%.
- Domain Adaptation: On the DomainNet-126 benchmark, VPA achieved a relative improvement of 5.2% when adapting between styles such as Clipart, Sketch, and Painting.
Key Insights
Efficiency and Speed
Because VPA only updates a few hundred tokens (e.g., 300 tokens for a ViT-B) rather than millions of parameters, it is exceptionally storage-efficient. This makes it ideal for edge devices. Furthermore, ablation studies indicate that the most significant performance gains occur in the very first step of adaptation, suggesting that VPA is highly efficient at rapidly orienting to new domains.
Architectural Synergy
The research highlights that prependitive prompts are particularly effective for single-image adaptation in Transformer architectures. Unlike additive prompts, which can sometimes interfere with the semantic content of pixels when data is scarce, prependitive tokens allow the model to process the image through the lens of the learned prompt without distorting the underlying signal.
Vision-Language Integration
VPA is not limited to standard classifiers. It also enhances Vision-Language models like CLIP. When combined with existing text-prompting techniques, VPA provides an additional layer of visual robustness, showing that visual and textual prompts can work synergistically.
Conclusion and Future Work
VPA demonstrates that test-time adaptation does not require expensive or risky weight updates. By tuning a small set of visual prompts, models can achieve state-of-the-art robustness with minimal storage requirements.
While highly effective, VPA currently faces challenges regarding hyperparameter sensitivity, particularly the "temperature" ($ au$) used in entropy loss. Future research may focus on automated hyperparameter tuning and exploring more complex prompt designs, such as image-to-image translation modules or embedding-space prompting, to further bridge the gap between deployment-time performance and supervised training.
Summary updated