Efficient Test-Time Prompt Tuning for Vision-Language Models

Yuhan Zhu, Guozhen Zhang, Chen Xu, Haocheng Shen, Xiaoxin Chen +2 more
8/11/2024
cs.CV

No official code found. Best implementation: mzhaoshuai/RLCF (102 stars, Apache-2.0, last commit 2025-10-20).

Abstract

Vision-language models have showcased impressive zero-shot classification capabilities when equipped with suitable text prompts. Previous studies have shown the effectiveness of test-time prompt tuning; however, these methods typically require per-image prompt adaptation during inference, which incurs high computational budgets and limits scalability and practical deployment. To overcome this issue, we introduce Self-TPT, a novel framework leveraging Self-supervised learning for efficient Test-time Prompt Tuning. The key aspect of Self-TPT is that it turns to efficient predefined class adaptation via self-supervised learning, thus avoiding computation-heavy per-image adaptation at inference. Self-TPT begins by co-training the self-supervised and the classification task using source data, then applies the self-supervised task exclusively for test-time new class adaptation. Specifically, we propose Contrastive Prompt Learning (CPT) as the key task for self-supervision. CPT is designed to minimize the intra-class distances while enhancing inter-class distinguishability via contrastive learning. Furthermore, empirical evidence suggests that CPT could closely mimic back-propagated gradients of the classification task, offering a plausible explanation for its effectiveness. Motivated by this finding, we further introduce a gradient matching loss to explicitly enhance the gradient similarity. We evaluated Self-TPT across three challenging zero-shot benchmarks. The results consistently demonstrate that Self-TPT not only significantly reduces inference costs but also achieves state-of-the-art performance, effectively balancing the efficiency-efficacy trade-off.

View on arXivView PDF

Code Implementations(1)

mzhaoshuai/RLCFCommunity72%
Apache-2.0

[ICLR 2024] Test-Time RL with CLIP Feedback for Vision-Language Models.

1022Shell, PythonMay 28, 20231 years agoApache-2.0

Similar Papers

Cite this paper

@article{zhu2024efficient,
  title  = {Efficient Test-Time Prompt Tuning for Vision-Language Models},
  author = {Yuhan Zhu and Guozhen Zhang and Chen Xu and Haocheng Shen and Xiaoxin Chen and Gangshan Wu and Limin Wang},
  year   = {2024},
  eprint = {2408.05775},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.05775v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2408.05775.svg)](https://codeofpaper.com/paper/2408.05775)

Discussion