Skip to main content
QUICK REVIEW

[Paper Review] Conditional Prompt Learning for Vision-Language Models

Kaiyang Zhou, Jingkang Yang|arXiv (Cornell University)|Mar 10, 2022
Multimodal Machine Learning ApplicationsComputer Science73 citations
TL;DR

This paper extends CoOp with an instance-conditioned prompting approach (CoCoOp) that generates input-conditional prompt vectors to improve generalization to unseen classes, cross-dataset transfer, and domain generalization for CLIP-like vision-language models.

ABSTRACT

With the rise of powerful pre-trained vision-language models like CLIP, it becomes essential to investigate ways to adapt these models to downstream datasets. A recently proposed method named Context Optimization (CoOp) introduces the concept of prompt learning -- a recent trend in NLP -- to the vision domain for adapting pre-trained vision-language models. Specifically, CoOp turns context words in a prompt into a set of learnable vectors and, with only a few labeled images for learning, can achieve huge improvements over intensively-tuned manual prompts. In our study we identify a critical problem of CoOp: the learned context is not generalizable to wider unseen classes within the same dataset, suggesting that CoOp overfits base classes observed during training. To address the problem, we propose Conditional Context Optimization (CoCoOp), which extends CoOp by further learning a lightweight neural network to generate for each image an input-conditional token (vector). Compared to CoOp's static prompts, our dynamic prompts adapt to each instance and are thus less sensitive to class shift. Extensive experiments show that CoCoOp generalizes much better than CoOp to unseen classes, even showing promising transferability beyond a single dataset; and yields stronger domain generalization performance as well. Code is available at https://github.com/KaiyangZhou/CoOp.

Motivation & Objective

  • Address overfitting of static prompts (CoOp) to base classes.
  • Develop a lightweight, input-conditioned prompting mechanism to improve generalization.
  • Demonstrate enhanced base-to-new, cross-dataset transfer, and domain generalization across diverse datasets.

Proposed method

  • Build on CLIP/CoOp foundations with learnable, shared context vectors for prompts.
  • Introduce a Meta-Net (lightweight neural network) to produce an input-conditioned token.
  • Combine the input-conditioned token with the shared context vectors to form per-image prompts.
  • Train only the prompt components (context vectors and Meta-Net) while keeping the vision-language backbone fixed.
  • Evaluate in base-to-new generalization, cross-dataset transfer, and domain generalization settings.

Experimental results

Research questions

  • RQ1Can instance-conditioned prompts reduce overfitting to base classes compared to static CoOp prompts?
  • RQ2Do input-conditioned prompts improve generalization to unseen classes within a dataset?
  • RQ3Are instance-conditioned prompts more transferable across datasets and robust to domain shifts?

Key findings

  • CoCoOp improves unseen-class accuracy from 63.22% (CoOp) to 71.69% on average across 11 datasets.
  • In base-to-new generalization, CoCoOp yields higher harmonic mean (H) than CoOp and CLIP (e.g., Table 1 shows H=75.83 for CoCoOp vs 71.66 for CoOp and 71.70 for CLIP).
  • CoCoOp achieves better cross-dataset transfer than CoOp across multiple source-target pairs (e.g., average gains shown in Table 2).
  • CoCoOp consistently beats CLIP and CoOp on domain generalization benchmarks and improves robustness to domain shifts (Table 3).
  • The gains in unseen/class-generalization typically come with small base-class losses, leading to a net positive impact on overall performance (Figure 3 and Table 1).
  • Ablation studies indicate that longer context and proper initialization further benefit unseen classes, and Meta-Net contributes meaningfully beyond simply increasing parameter count (Table 5).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.