Abstract
Prompt learning is a popular fine-tuning method for vision-language models due to its efficiency. It requires a small number of additional learnable parameters while significantly enhancing performance on target tasks. However, most existing methods suffer from overfitting to fine-tuning data, yielding poor generalizability. To address this, we propose a new training objective function based on a Bayesian learning principle to balance adaptability and generalizability. We derive a prior over the logits, where the mean function is parameterized by the pre-trained model, while the posterior corresponds to the fine-tuned model. This objective establishes a balance by allowing the fine-tuned model to adapt to downstream tasks while remaining close to the pre-trained model. To avoid the overfitting issues of the standard softmax function, we adopt the one-vs-each softmax approximation along with its P'olya-Gamma augmentation (OVE-PG). We evaluate our method on several benchmark datasets and demonstrate that using the Bayesian principle for prompt learning is indeed a sensible choice.
Introduction
Vision-Language Models (VLMs) like CLIP are celebrated for their "zero-shot" abilities—the capacity to recognize objects and concepts they weren't explicitly trained on. To specialize these models for specific downstream tasks, researchers often use prompt learning, where only a small set of "soft prompt" vectors are fine-tuned. While efficient, this approach frequently leads to overfitting: the model becomes a specialist that "forgets" its general knowledge, performing well on training data but failing on unseen classes or domain shifts.
Methods: The OVE-PG Objective
To address this, the researchers propose a new training objective based on Bayesian principles. Instead of simply minimizing training error, they treat the pre-trained model as a prior (representing existing knowledge) and the fine-tuned model as the posterior (representing new learning). This creates a natural mathematical tether that prevents the model from drifting too far from its robust, pre-trained foundations.
To make this Bayesian inference computationally efficient in deep learning, the method employs two key techniques:
- One-vs-Each (OVE) Softmax: Standard softmax is mathematically difficult for Bayesian updates. OVE decomposes multi-class classification into a series of binary comparisons, making the math tractable.
- Pólya-Gamma (PG) Augmentation: This technique introduces an auxiliary variable to transform logistic likelihoods into a Gaussian-like form, allowing for "closed-form-like" updates and introducing beneficial noise that prevents the model from latching too hard onto specific training examples.
Key Results
The OVE-PG objective was evaluated across 10 diverse recognition datasets (including Caltech101, Oxford Pets, and EuroSAT) and integrated into popular prompt learning frameworks like CoOp, MaPLe, and APEX.
As shown in Table 1, the Bayesian approach consistently outperforms the standard softmax baseline on unseen data. For the CoOp baseline, OVE-PG improved accuracy on unseen classes by an average of +3.99%. It also demonstrated superior performance in cross-dataset challenges, such as training on ImageNet and testing on specialized datasets, where it improved average accuracy from 58.40% to 60.34%.
Conclusion
By replacing the standard softmax with a principled Bayesian objective, OVE-PG provides a robust solution to the overfitting problem in prompt learning. It acts as a "plug-and-play" loss function that can be easily integrated into existing architectures to boost generalizability. While there is a slight trade-off in performance on seen classes, the significant gains in robustness and unseen class accuracy make it a superior choice for deploying VLMs in real-world, dynamic environments.
Summary updated