NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Patch-Prompt Aligned Bayesian Prompt Tuning for Vision-Language Models

Xinyang Liu, Dongsheng Wang, Bowei Fang, Miaoge Li, Zhibin Duan, Yishi Xu, Bo Chen, Mingyuan Zhou

TL;DR

PBPrompt introduces a Bayesian approach to prompt tuning for vision-language models, replacing deterministic "point-estimate" prompts with stochastic distributions. By aligning these learned textual prompts with local image patches using conditional transport, the model captures diverse visual concepts and significantly improves generalization across few-shot learning, domain shifts, and new categories.

What Problem Does This Paper Address?

Large-scale vision-language models (VLPs) like CLIP are powerful, but adapting them to specific tasks via "prompt tuning" remains tricky. Current methods typically learn a single, fixed set of prefix tokens (a "point estimation") for each class.

The authors identify two major flaws in this approach:

  1. Lack of Diversity: A single prompt often fails to capture the diverse ways a category can appear. For example, a "dog" might be a puppy, a hound, or a dog chewing a bone. A single deterministic vector can't represent all these facets simultaneously.
  2. Overfitting: Models often "memorize" the specific training images rather than learning generalizable visual concepts, leading to poor performance on new datasets or unseen categories.

Methods

The authors propose Patch-Prompt Aligned Bayesian Prompt Tuning (PBPrompt), which combines two novel ideas:

  • Stochastic Prompt Generation (SPG): Instead of learning a static prompt, PBPrompt models each category as a variational distribution (a Gaussian) in a latent space. For every training step, it samples a "meta-vector" from this distribution and passes it through a lightweight Self-Attention generator to produce a sequence of prefix tokens. This allows the model to explore multiple "versions" of a prompt for the same class, as shown in the motivation figure below.
Figure 1: The motivation of the proposed model. Multiple prompts are generated from the label-specific distributions.
  • Patch-Prompt Alignment via Conditional Transport (CT): To ensure these stochastic prompts stay grounded in reality, the authors introduce a regularization term based on Conditional Transport. This mathematically aligns the distribution of textual prompts with the distribution of visual patches (local features) within an image. Unlike standard Optimal Transport, CT is more computationally efficient and helps the model focus on meaningful visual attributes (like ears, tails, or textures) rather than just the global label.

The entire system is trained end-to-end by minimizing a combined loss function based on the Evidence Lower Bound (ELBO), which balances classification accuracy, Bayesian uncertainty, and patch-level alignment.

Figure 2: Overview of the proposed PBPrompt. PBPrompt generates the stochastic prompts by first sampling a label-specific vector rc and then employing a single-layer self-attention generator. CT distance is performed between the textual prompts and image patches to regularize the prompts with the visual knowledge.

Datasets

The model was rigorously evaluated on 15 different datasets across four major tasks:

  • Generic & Fine-grained Classification: ImageNet, Caltech101, OxfordPets, StanfordCars, Flowers102, Food101, FGVCAircraft.
  • Specialized Tasks: EuroSAT (satellite), UCF101 (action), DTD (texture), SUN397 (scene).
  • Domain Generalization: ImageNetV2, ImageNet-Sketch, ImageNet-A, and ImageNet-R.

Key Insights and Ideas

  • Distributions > Points: Modeling a class as a distribution naturally handles "intra-class variance." It allows the model to maintain "meta-information" about a category, making it more robust to different visual contexts.
  • Local Alignment is Key: By forcing prompts to align with patches rather than just the whole image, the model learns to associate specific words with specific visual parts. This prevents the "mode collapse" where a model learns a generic, uninformative prompt.
  • Synergy of Uncertainty and Regularization: The authors found that Bayesian sampling alone can sometimes lead to overfitting. The CT regularization acts as a crucial anchor, guiding the stochastic prompts to focus on diverse but relevant visual concepts.

Key Results

PBPrompt consistently outperformed state-of-the-art baselines like CoOp and CoCoOp:

  • Few-Shot Learning: On average across 11 datasets, PBPrompt showed accuracy gains of 3.14% (1-shot) and 6.33% (4-shot) over the standard CoOp baseline.
  • Generalization: In "base-to-new" tasks (training on some classes, testing on entirely new ones), PBPrompt achieved the highest H-score (harmonic mean of base and new class accuracy) across all tested datasets, demonstrating superior transferability.
  • Robustness: It achieved the highest accuracy on all four ImageNet domain-shift datasets (V2, Sketch, A, and R), proving that learnable stochastic prompts are less sensitive to distribution shifts.
Figure 3: The few-shot learning results on 11 datasets. We compare our PBPrompt with CoOp, CoCoOp and PLOT. Overall, our proposed model outperforms the baselines in most cases. More numerical results can be found at Table C. 5 and Table C. 6.

Limitations and Future Work

  • Hyperparameter Sensitivity: The model's performance is somewhat dependent on the number of Monte Carlo samples used during training and the weight of the CT regularization ($\eta$). Finding the "sweet spot" is essential for stability.
  • Computational Overhead: While inference speed remains comparable to baselines, the introduction of a generative module and Bayesian sampling adds complexity to the training phase.
  • Future Directions: The authors suggest that this Bayesian framework could be extended to other vision-language tasks beyond classification, such as open-vocabulary object detection or image captioning.

Summary updated

BibTeX
@misc{liu2023patch,
  author = {Xinyang Liu and Dongsheng Wang and Bowei Fang and Miaoge Li and Zhibin Duan and Yishi Xu and Bo Chen and Mingyuan Zhou},
  title = {{Patch-Prompt Aligned Bayesian Prompt Tuning for Vision-Language Models}},
  year = {2023},
  eprint = {2303.09100},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.09100},
}
Figure