Test-Time Prompt Tuning for Zero-Shot Generalization in Vision-Language Models
Manli Shu, Weili Nie, De-An Huang, Zhiding Yu, Tom Goldstein, Anima Anandkumar, Chaowei Xiao
TL;DR
This paper tackles zero-shot generalization in vision–language models by introducing Test-Time Prompt Tuning (TPT), which adapts prompts on a per-test-sample basis without requiring task-specific training data. TPT learns prompts through an entropy-based objective over multiple augmented views and employs a confidence filter to discard noisy views, enabling robust zero-shot performance on image classification and context-dependent reasoning tasks like Bongard-HOI. Empirical results show TPT improves zero-shot CLIP performance on natural distribution shifts (average ~3.6% gain; up to 6.9% on ImageNet-A) and matches or exceeds state-of-the-art few-shot prompt tuning on cross-dataset generalization, while also achieving strong results in context-dependent visual reasoning. Overall, TPT demonstrates that prompting strategies at test time can substantially enhance the generalization capabilities of vision-language foundation models without access to additional training data, with a clear path for broader application and efficiency considerations.
Abstract
Pre-trained vision-language models (e.g., CLIP) have shown promising zero-shot generalization in many downstream tasks with properly designed text prompts. Instead of relying on hand-engineered prompts, recent works learn prompts using the training data from downstream tasks. While effective, training on domain-specific data reduces a model's generalization capability to unseen new domains. In this work, we propose test-time prompt tuning (TPT), a method that can learn adaptive prompts on the fly with a single test sample. For image classification, TPT optimizes the prompt by minimizing the entropy with confidence selection so that the model has consistent predictions across different augmented views of each test sample. In evaluating generalization to natural distribution shifts, TPT improves the zero-shot top-1 accuracy of CLIP by 3.6% on average, surpassing previous prompt tuning approaches that require additional task-specific training data. In evaluating cross-dataset generalization with unseen categories, TPT performs on par with the state-of-the-art approaches that use additional training data. Project page: https://azshue.github.io/TPT.
