Abstract: Vision-language models (VLMs), such as CLIP and SigLIP, have found remarkable success in classification, retrieval, and generative tasks. For this, VLMs deterministically map images and text descriptions to a joint latent space in which their similarity is assessed using the cosine similarity. However, a deterministic mapping of inputs fails to capture uncertainties over concepts arising from domain shifts when used in downstream tasks. In this work, we propose post-hoc uncertainty estimation in VLMs that does not require additional training. Our method leverages a Bayesian posterior approximation over the last layers in VLMs and analytically quantifies uncertainties over cosine similarities. We demonstrate its effectiveness for uncertainty quantification and support set selection in active learning. Compared to baselines, we obtain improved and well-calibrated predictive uncertainties, interpretable uncertainty estimates, and sample-efficient active learning. Our results show promise for safety-critical applications of large-scale models.
Introduction
Large-scale vision-language models (VLMs) have revolutionized zero-shot classification and retrieval. However, standard models are inherently deterministic: they map images and text to a single point in a latent space and use cosine similarity to make predictions.
This approach has a major flaw: it lacks a sense of "self-doubt." When faced with domain shifts, ambiguous inputs, or out-of-distribution data, deterministic VLMs tend to be overconfident, providing high-similarity scores even when they are incorrect. Existing solutions to this overconfidence often require expensive retraining, architectural changes, or slow test-time augmentations. To address this, researchers seek a "training-free" way to make these models probabilistic so they can reliably quantify their own uncertainty.
The BayesVLM Approach
To solve the overconfidence problem, the authors propose BayesVLM, a post-hoc Bayesian framework that transforms a deterministic VLM into a probabilistic one without requiring any additional training. The method relies on three key steps:
- Laplace Approximation (LA): Instead of treating the weights of the final projection layers as fixed values, BayesVLM treats them as a Gaussian distribution. The authors use the Kronecker-factored Approximate Curvature (KFAC) to estimate the Hessian of the loss function, making the calculation of this distribution computationally feasible even for massive models.
- Modality Independence: To keep the mathematics tractable, the framework assumes the image and text encoders are independent. While this might seem like a strong assumption for a multimodal model, the authors argue that because the approximation is centered at the pre-trained (jointly learned) weights, cross-modal interactions are already implicitly captured.
- ProbCosine: This is the paper's core technical contribution. Typically, propagating uncertainty through a cosine similarity function requires slow Monte Carlo sampling. The authors derive a closed-form Gaussian approximation for the distribution over cosine similarities, allowing for nearly instantaneous "probabilistic" predictions.
Key Insights and Contributions
- The "Aha!" of ProbCosine: The derivation of an analytical expression for the mean and variance of cosine similarities between two Gaussian random vectors is a game-changer. It removes the "Bayesian tax"—the high computational cost usually associated with probabilistic inference.
- Practical Post-hoc Application: You do not need to be the original creator of a billion-parameter model to make it Bayesian. BayesVLM can be applied directly to existing "black-box" weights.
- Calibration vs. Accuracy: While BayesVLM maintains the high accuracy of the original models, it significantly improves calibration. This means if the model reports 80% confidence, it is actually correct about 80% of the time, rather than being 99% confident and wrong.
- Uncertainty-Aware Active Learning: By knowing which samples the model is most "confused" about, researchers can select much more informative data for fine-tuning, reaching higher accuracy with fewer labeled examples.
Experimental Results
The researchers evaluated BayesVLM across a wide array of benchmarks, including zero-shot classification (Flowers-102, Food-101, CIFAR-10/100, ImageNet-R, UCF101, SUN397) and active learning (OfficeHome, ImageNet variants).
- Better Calibration: In zero-shot settings, BayesVLM consistently outperformed vanilla CLIP and temperature scaling in Expected Calibration Error (ECE). For example, on the Flowers-102 dataset, ECE dropped significantly from 6.59 to 4.22.
- Efficiency: The runtime overhead is minimal. For a CLIP-Base model, the increase is under 5%; for "Huge" models, it’s less than 1%. This is orders of magnitude faster than Test-Time Augmentation (TTA) methods.
- Active Learning Gains: In cross-domain adaptation tasks, using BayesVLM's uncertainty to select samples led to significantly faster improvements in accuracy compared to random or entropy-based selection.
- Robustness: The method proved robust to "closed-source" settings. Estimating the Hessian on a proxy dataset (like CC12M) only slightly degraded performance compared to using the original training data.
Limitations and Future Directions
While highly effective, the authors acknowledge a few constraints:
- Data Access: Although "training-free," the method still requires a one-time pass over a representative dataset (or proxy) to estimate the Hessian matrices.
- Layer Limitation: The current approach only makes the last projection layers probabilistic, leaving the rest of the transformer backbone deterministic.
- Gaussian Assumption: The framework assumes that embeddings follow a Gaussian distribution, which may not perfectly capture the complex geometry of the latent space.
For future work, the authors suggest applying BayesVLM to Out-of-Distribution (OOD) detection and uncertainty-aware retrieval systems, where knowing when a query falls outside the model's "knowledge zone" is critical for safety and reliability.
Summary updated