Papers › Bayesian Prompt Learning for Image-Language Model Generalization

Bayesian Prompt Learning for Image-Language Model Generalization

5 Oct 2022ICCV 2023 1arXiv:2210.02390archive 2025-07-28

Mohammad Mahdi Derakhshani, Enrique Sanchez, Adrian Bulat, Victor Guilherme Turrisi da Costa, Cees G. M. Snoek, Georgios Tzimiropoulos, Brais Martinez

Foundational image-language models have generated considerable interest due to their efficient adaptation to downstream tasks by prompt learning. Prompt learning treats part of the language model input as trainable while freezing the rest, and optimizes an Empirical Risk Minimization objective. However, Empirical Risk Minimization is known to suffer from distributional shifts which hurt generalizability to prompts unseen during training. By leveraging the regularization ability of Bayesian methods, we frame prompt learning from the Bayesian perspective and formulate it as a variational inference problem. Our approach regularizes the prompt space, reduces overfitting to the seen prompts and improves the prompt generalization on unseen prompts. Our framework is implemented by modeling the input prompt space in a probabilistic manner, as an a priori distribution which makes our proposal compatible with prompt learning approaches that are unconditional or conditional on the image. We demonstrate empirically on 15 benchmarks that Bayesian prompt learning provides an appropriate coverage of the prompt space, prevents learning spurious features, and exploits transferable invariant features. This results in better generalization of unseen prompts, even across different datasets and domains. Code available at: https://github.com/saic-fi/Bayesian-Prompt-Learning

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="2210.02390")

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: official repository: 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.

saic-fi/bayesian-prompt-learning officialmentioned in papermentioned 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 saic-fi/bayesian-prompt-learning. “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 saic-fi/bayesian-prompt-learning/clip/simple_tokenizer.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 98f385d847636a3e · report
compute_ci95 saic-fi/bayesian-prompt-learning/parse_test_res.py official repository ran fingerprinted MIT (permissive) · ba26afd892405335 · report
get_pairs saic-fi/bayesian-prompt-learning/clip/simple_tokenizer.py official repository ran · our draft was wrong MIT (permissive) · d919ae32e5e4e616 · report
whitespace_clean saic-fi/bayesian-prompt-learning/clip/simple_tokenizer.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 9542161e9640b858 · report
build_model saic-fi/bayesian-prompt-learning/clip/model.py official repository unverified MIT (permissive) · c47aa9e5b049a11d · report
load saic-fi/bayesian-prompt-learning/clip/clip.py official repository unverified MIT (permissive) · fbf8c0143d9c48e3 · report

Tasks

Few-Shot LearningLanguage ModelingLanguage ModellingMultimodal Deep LearningPrompt EngineeringPrompt LearningVariational Inferencemodel

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Few-Shot Learning Caltech101 Variational Prompt Tuning Harmonic mean 96.44 #1 of 1 Archive leaderboard report
Few-Shot Learning DTD Variational Prompt Tuning Harmonic mean 67.27 #4 of 4 Archive leaderboard report
Few-Shot Learning EuroSAT Variational Prompt Tuning Harmonic mean 77.71 #1 of 1 Archive leaderboard report
Few-Shot Learning FGVC Aircraft Variational Prompt Tuning Harmonic mean 34.69 #3 of 4 Archive leaderboard report
Few-Shot Learning Flowers-102 Variational Prompt Tuning Harmonic mean 81.12 #1 of 1 Archive leaderboard report
Few-Shot Learning OxfordPets Variational Prompt Tuning Harmonic mean 96.82 #1 of 1 Archive leaderboard report
Few-Shot Learning SUN397 Variational Prompt Tuning Harmonic mean 78.51 #1 of 1 Archive leaderboard report
Few-Shot Learning StanforCars Variational Prompt Tuning Harmonic mean 73.07 #1 of 1 Archive leaderboard report
Few-Shot Learning UCF101 Variational Prompt Tuning Harmonic mean 79 #1 of 1 Archive leaderboard report
Few-Shot Learning food101 Variational Prompt Tuning Harmonic mean 91.57 #1 of 1 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

CLIPVariational Inference

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