Papers › Conditional Prompt Learning for Vision-Language Models

Conditional Prompt Learning for Vision-Language Models

10 Mar 2022CVPR 2022 1arXiv:2203.05557archive 2025-07-28

Kaiyang Zhou, Jingkang Yang, Chen Change Loy, Ziwei Liu

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.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2203.05557")

Code

Syntology Ran 4 of 6 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 3 ran · our draft was wrong; 1 ran with no contract checked.

By repository: community (archive-listed): 6 samples from 1 repository, 4 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

kaiyangzhou/coop officialmentioned in papermentioned on GitHubpytorchMIT report
Gahyeonkim09/AAPL mentioned on GitHubpytorchMIT report
ThomasWangY/2024-AAAI-HPT mentioned on GitHubpytorch report
Vill-Lab/2024-TIP-MetaPrompt mentioned on GitHubpytorch report
azshue/TPT mentioned on GitHubpytorch report
healthx-lab/biomedcoop mentioned on GitHubpytorchMIT report
hhenryd/tap mentioned on GitHubpytorch report
kaiyangzhou/on-device-dg mentioned on GitHubpytorchNOASSERTION report
muzairkhattak/multimodal-prompt-learning mentioned on GitHubpytorchMIT report
muzairkhattak/protext mentioned on GitHubpytorchMIT report
saic-fi/bayesian-prompt-learning mentioned on GitHubpytorchMIT report
vill-lab/2024-aaai-hpt mentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

6 samples harvested; 4 ran; 0 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · our draft was wrong
1ran
2unverified

Licence: 0 of the 6 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from Gahyeonkim09/AAPL. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

basic_clean Gahyeonkim09/AAPL/clip/simple_tokenizer.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 98f385d847636a3e · report
compute_ci95 Gahyeonkim09/AAPL/parse_test_res.py community (archive-listed) ran fingerprinted MIT (permissive) · ba26afd892405335 · report
get_pairs Gahyeonkim09/AAPL/clip/simple_tokenizer.py community (archive-listed) ran · our draft was wrong MIT (permissive) · d919ae32e5e4e616 · report
whitespace_clean Gahyeonkim09/AAPL/clip/simple_tokenizer.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 9542161e9640b858 · report
build_model Gahyeonkim09/AAPL/clip/model.py community (archive-listed) unverified MIT (permissive) · c47aa9e5b049a11d · report
load Gahyeonkim09/AAPL/clip/clip.py community (archive-listed) unverified MIT (permissive) · fbf8c0143d9c48e3 · report

Tasks

Domain GeneralizationPrompt EngineeringPrompt Learning

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Prompt Engineering Caltech-101 CoCoOp Harmonic mean 95.84 #13 of 14 Archive leaderboard report
Prompt Engineering DTD CoCoOp Harmonic mean 64.85 #13 of 14 Archive leaderboard report
Prompt Engineering EuroSAT CoCoOp Harmonic mean 71.21 #13 of 14 Archive leaderboard report
Prompt Engineering FGVC-Aircraft CoCoOp Harmonic mean 27.74 #14 of 14 Archive leaderboard report
Prompt Engineering Food-101 CoCoOp Harmonic mean 90.99 #12 of 13 Archive leaderboard report
Prompt Engineering ImageNet CoCoOp Harmonic mean 73.10 #14 of 15 Archive leaderboard report
Prompt Engineering ImageNet V2 CoCoOp Top-1 accuracy % 64.07 #6 of 8 Archive leaderboard report
Prompt Engineering ImageNet-A CoCoOp Top-1 accuracy % 50.63 #7 of 9 Archive leaderboard report
Prompt Engineering ImageNet-R CoCoOP Top-1 accuracy % 76.18 #8 of 9 Archive leaderboard report
Prompt Engineering ImageNet-S CoCoOp Top-1 accuracy % 48.75 #8 of 9 Archive leaderboard report
Prompt Engineering Oxford 102 Flower CoCoOp Harmonic mean 81.71 #13 of 14 Archive leaderboard report
Prompt Engineering Oxford-IIIT Pet Dataset CoCoOp Harmonic mean 96.43 #9 of 14 Archive leaderboard report
Prompt Engineering SUN397 CoCoOp Harmonic mean 78.27 #13 of 14 Archive leaderboard report
Prompt Engineering Stanford Cars CoCoOp Harmonic mean 72.01 #13 of 14 Archive leaderboard report
Prompt Engineering UCF101 CoCoOp Harmonic mean 77.64 #13 of 14 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

BASECLIPCoOp

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections