TL;DR
This paper introduces TextRefiner, a novel method that enhances prompt tuning for Vision-Language Models (VLMs) by leveraging internal visual features. Instead of relying on external LLMs for class descriptions, TextRefiner uses a local cache to capture fine-grained visual concepts from image patches, significantly improving performance without increasing inference cost.
What Problem Does This Paper Address?
Vision-Language Models (VLMs) like CLIP have shown remarkable generalization capabilities, but adapting them to new tasks efficiently remains a challenge. Prompt tuning, which involves learning small sets of parameters (prompts) to guide the model, is a popular approach. However, existing prompt tuning methods often learn "coarse-grained" prompts that are shared across all classes. This can lead to poor performance on classes with similar or complex visual attributes because the prompts fail to capture class-specific nuances. While some methods use external Large Language Models (LLMs) to generate detailed class descriptions, this adds significant computational overhead during inference. The paper aims to bridge this gap by enabling fine-grained prompt refinement using only the VLM's internal knowledge, thereby reducing inference costs and improving generalization.
Methods
TextRefiner is a plug-and-play module designed to refine text prompts in VLMs. Its core innovations are:
- Local Cache: This module captures fine-grained visual concepts from local image tokens (patches) processed by the VLM's image encoder. Instead of storing all tokens, it clusters similar tokens into a fixed number of entries, creating an "attribute prior" that summarizes visual characteristics.
- Feature Aggregation: This component integrates the information from the local cache (visual attributes) with the original text embedding from the VLM. It uses a residual connection to fuse global and local features, enhancing the text branch's representation capability.
- Feature Alignment: To address the potential modality gap between local image features and text embeddings, a 2-layer MLP is used to transform local image features into the text embedding space.
Additionally, TextRefiner introduces two training losses: a semantic loss to align the aggregated features with text embeddings and a regularization loss to prevent overfitting.
Datasets
The paper evaluates TextRefiner on a variety of standard benchmarks for two main settings:
- Base-to-Novel Generalization: ImageNet, Caltech101, OxfordPets, StanfordCars, Flowers102, Food101, FGVCAircraft, SUN397, DTD, EuroSAT, and UCF101.
- Cross-Domain Generalization: ImageNet-V2, ImageNet-Sketch, ImageNet-A, and ImageNet-R.
Key Insights and Ideas
- Internal Knowledge is Sufficient: The paper demonstrates that VLMs already contain rich, fine-grained visual information within their intermediate image features. This internal knowledge can be effectively leveraged for prompt refinement, eliminating the need for external LLMs and their associated inference costs.
- Local Features Matter for Fine-Grained Discrimination: Coarse-grained prompts struggle with visually similar classes. By focusing on local image patches and their unique attributes, TextRefiner can create more discriminative prompts.
- Plug-and-Play Efficiency: TextRefiner is designed to be easily integrated with existing prompt tuning methods (like CoOp, MaPLe, and PromptKD) without requiring significant architectural changes or incurring substantial computational overhead during inference.
- Balancing Seen and Unseen Performance: The proposed method, along with its auxiliary losses, effectively balances performance on seen (base) classes and unseen (novel) classes, leading to improved generalization.
Key Results
- Performance Improvement: TextRefiner significantly enhances existing prompt tuning methods. For example, it improves CoOp's accuracy from 63.22% to 74.32% on novel classes. When combined with PromptKD, it achieves state-of-the-art performance, outperforming LLaMP (which uses LLMs) by 1.06% in harmonic mean.
- Inference Efficiency: TextRefiner is highly efficient. While LLaMP significantly reduces inference speed (e.g., 1473.46 FPS vs. 12793.26 FPS for PromptKD w/ TextRefiner), TextRefiner only slightly impacts the FPS of the base model.
- Cross-Domain Robustness: The method shows strong performance on cross-domain generalization tasks, verifying its robustness to domain shifts.
Limitations and Future Work
- Hyperparameter Sensitivity: The paper notes that the performance can be sensitive to hyperparameters like the fusion coefficient ($\alpha$) and the loss factors ($\lambda_1, \lambda_2$). Over-reliance on fine-grained information from seen samples (high $\alpha$) can lead to overfitting.
- Future Directions: The authors suggest that their work offers new insights into improving fine-grained representation and efficient transfer learning for VLMs, hoping to inspire further advancements in multimodal learning. The plug-and-play nature of TextRefiner suggests it could be a valuable component for various VLM applications.
Summary updated