[Paper Review] Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
This paper proposes Domain Prompt Learning (DPL), a method that efficiently adapts CLIP to unseen domains by training a lightweight MLP prompt generator to produce domain-specific continuous prompts at test time. DPL improves zero-shot CLIP accuracy from 73.7% to 79.3% on standard DG benchmarks like PACS, VLCS, OfficeHome, and TerraIncognita without fine-tuning the vision encoder, achieving state-of-the-art performance with minimal computational cost.
Domain generalization (DG) is a difficult transfer learning problem aiming to learn a generalizable model for unseen domains. Recent foundation models (FMs) are robust to many distribution shifts and, therefore, should substantially improve the performance of DG. In this work, we study generic ways to adopt CLIP, a Visual-Language Foundation Model, for DG problems in image classification. While ERM greatly improves the accuracy with bigger backbones and training datasets using standard DG benchmarks, fine-tuning FMs is not practical in many real-world situations. We propose Domain Prompt Learning (DPL) as a novel approach for domain inference in the form of conditional prompt generation. DPL achieved a significant accuracy improvement with only training a lightweight prompt generator (a three-layer MLP), whose parameter is of equivalent scale to the classification projector in the previous DG literature. Combining \dplshort~with CLIP provides surprising performance, raising the accuracy of zero-shot CLIP from 73.7% to 79.3% on several standard datasets, namely PACS, VLCS, OfficeHome, and TerraIncognita. We hope the simplicity and success of our approach lead to broader adoption and analysis of foundation models in the domain generalization field. Our code is available at https://github.com/shogi880/DPLCLIP.
Motivation & Objective
- To address domain generalization (DG) in image classification by leveraging CLIP’s robustness to distribution shifts without fine-tuning the vision encoder.
- To overcome the limitations of standard fine-tuning, which can degrade performance on certain domains and is computationally expensive.
- To develop a lightweight, efficient adaptation method that preserves pre-trained features while improving zero-shot generalization to unseen domains.
- To explore prompt learning as a viable alternative to fine-tuning for foundation models in DG, focusing on test-time adaptation with minimal parameter updates.
- To demonstrate that prompt-based adaptation can outperform both standard fine-tuning and zero-shot CLIP on standard DG benchmarks.
Proposed method
- Proposes Domain Prompt Learning (DPL), a test-time prompt generation method that uses a lightweight three-layer MLP prompt generator trained on source domains.
- The prompt generator takes input images and outputs continuous domain-specific prompts conditioned on the input distribution, which are then concatenated with class-specific text prompts.
- All CLIP components, including the image encoder and text encoder, are frozen during inference, preserving the pre-trained features and ensuring stability.
- The prompt generator is trained end-to-end using contrastive learning on source domains to align image features with the generated domain prompts.
- Uses a continuous prompt representation that allows gradient-based optimization, enabling the model to learn domain-invariant yet domain-specific prompt patterns.
- Employs a conditional prompt generation strategy where the prompt is dynamically generated per input image, enabling adaptation to unseen domains without retraining.
Experimental results
Research questions
- RQ1Can prompt learning effectively adapt CLIP to unseen domains in domain generalization without fine-tuning the vision encoder?
- RQ2How does the performance of DPL compare to standard fine-tuning and zero-shot CLIP across multiple standard DG benchmarks?
- RQ3Does a lightweight prompt generator trained on source domains generalize well to unseen target domains at test time?
- RQ4Can prompt-based adaptation stabilize performance and mitigate the negative effects of fine-tuning observed in some DG settings?
- RQ5To what extent does DPL improve zero-shot CLIP accuracy on benchmarks like PACS, VLCS, OfficeHome, and TerraIncognita?
Key findings
- DPL improves zero-shot CLIP accuracy from 73.7% to 79.3% on the PACS, VLCS, OfficeHome, and TerraIncognita benchmarks, demonstrating a significant performance gain.
- On the VLCS dataset, DPL achieves 84.3% accuracy with CLIP ViT-B16, outperforming standard ERM with fine-tuned backbones and showing that fine-tuning can degrade performance on certain datasets.
- Frozen ERM (empirical risk minimization with frozen backbone) outperforms standard ERM with fine-tuned backbones on OfficeHome and VLCS, indicating that fine-tuning may not always improve generalization.
- DPL consistently improves performance across all evaluated datasets, showing robustness and stability in adapting CLIP to unseen domains.
- The performance gain from DPL is substantial—+6.1% on TerraIncognita and +3.7% on VLCS compared to zero-shot CLIP—despite only training a small MLP (3-layer, ~10K parameters).
- The ablation study confirms that DPL is effective even with large backbones like ViT-B16, and that the method generalizes well across diverse domain shifts.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.