Task-Aware Clustering for Prompting Vision-Language Models

Fusheng Hao, Fengxiang He, Fuxiang Wu, Tichao Wang, Chengqun Song +1 more
2/10/2026

No official code found. Best implementation: FushengHao/TAC (14 stars, MIT, last commit 2025-06-12).

Abstract

Prompt learning has attracted widespread attention in adapting vision-language models to downstream tasks. Existing methods largely rely on optimization strategies to ensure the task-awareness of learnable prompts. Due to the scarcity of task-specific data, overfitting is prone to occur. The resulting prompts often do not generalize well or exhibit limited task-awareness. To address this issue, we propose a novel Task-Aware Clustering (TAC) framework for prompting vision-language models, which increases the task-awareness of learnable prompts by introducing task-aware pre-context. The key ingredients are as follows: (a) generating task-aware pre-context based on task-aware clustering that can preserve the backbone structure of a downstream task with only a few clustering centers, (b) enhancing the task-awareness of learnable prompts by enabling them to interact with task-aware pre-context via the well-pretrained encoders, and (c) preventing the visual task-aware pre-context from interfering the interaction between patch embeddings by masked attention mechanism. Extensive experiments are conducted on benchmark datasets, covering the base-to-novel, domain generalization, and cross-dataset transfer settings. Ablation studies validate the effectiveness of key ingredients. Comparative results show the superiority of our TAC over competitive counterparts. The code is available at https://github.com/FushengHao/TAC.

DOISemantic Scholar

Code Implementations(1)

FushengHao/TACCommunity71%
MIT

Code for "Task-Aware Clustering for Prompting Vision-Language Models" in CVPR 2025.

141Shell, PythonMar 22, 20251 years agoMIT

Similar Papers

Cite this paper

@article{hao2026taskaware,
  title  = {Task-Aware Clustering for Prompting Vision-Language Models},
  author = {Fusheng Hao and Fengxiang He and Fuxiang Wu and Tichao Wang and Chengqun Song and Jun Cheng},
  year   = {2026},
  doi    = {10.1109/CVPR52734.2025.01374},
  url    = {https://doi.org/10.1109/CVPR52734.2025.01374},
  journal = {CVPR 2025 2025}
}

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/625df0931426602c8e619fb6fe6714a47c3f69a5.svg)](https://codeofpaper.com/paper/625df0931426602c8e619fb6fe6714a47c3f69a5)

Discussion