TL;DR
Fine-tuning Vision-Language Models (VLMs) like CLIP improves their accuracy on specific tasks but wrecks their confidence calibration, making them dangerously overconfident on unseen "open-vocabulary" classes. This paper introduces Distance-Aware Calibration (DAC), a simple, training-free method that dynamically adjusts prediction confidence based on how far a novel class's text embedding is from the training classes, cutting calibration error in half without slowing down inference.
The Calibration Paradox in Fine-Tuned VLMs
Vision-Language Models (VLMs) like CLIP are celebrated for their ability to classify images into open-vocabulary categories—classes they weren't explicitly trained on—using zero-shot inference. To boost performance on specific downstream tasks, researchers often fine-tune these models using parameter-efficient methods like "prompt learning."
However, while fine-tuning increases accuracy, it breaks the model's confidence calibration. A well-calibrated model's predicted probability should match its actual likelihood of being correct (e.g., if it says it is 90% confident, it should be right 90% of the time). The authors discovered a counter-intuitive paradox: fine-tuned VLMs become underconfident on the base classes they were trained on, but overconfident on novel, unseen classes.
Standard post-hoc calibration fixes, like Temperature Scaling (TS), fail in this open-vocabulary setting. Because TS learns a single scalar to fix the underconfidence on base classes (by sharpening the predictions), applying that same scalar to novel classes actually makes their overconfidence much worse.
Distance-Aware Calibration (DAC)
To solve this, the authors propose Distance-Aware Calibration (DAC), a post-hoc (after training) scaling method. Instead of applying a single temperature scalar to all predictions, DAC scales the temperature dynamically based on the predicted class's text label.
- Textual Deviation (TD) Score: DAC calculates the distance (proximity) between the normalized text embedding of the predicted novel class and the text embeddings of the base (seen) classes.
- Dynamic Scaling: If a novel class is far away from the base classes in the embedding space (a low TD score), the model is likely to be artificially overconfident. DAC increases the temperature for these specific predictions, softening the logits and lowering the confidence to a realistic level.
- Base Class Preservation: For base classes, the scaling factor is set to 1, meaning DAC preserves the original (or standard TS-calibrated) confidence for seen data.
DAC is algorithm-agnostic, requires no hyperparameter tuning, and relies entirely on text features, meaning it doesn't need access to visual data from the novel classes to calibrate the model.
Key Insights and Ideas
- The Textual Distribution Gap: Prompt tuning shifts the text embeddings of the model. The authors found that if a novel class's text embedding falls far outside the learned distribution of the base classes, the model's confidence spikes artificially. Lower textual proximity directly correlates with higher overconfidence.
- Text Trumps Vision for Calibration: Adjusting calibration based on textual proximity is highly effective and computationally cheap. Previous methods tried to calibrate based on visual proximity (finding nearest neighbor images), which is incredibly slow and assumes access to novel class images.
- Normalization is Crucial: When calculating the distance between text embeddings to generate the TD score, normalizing the text features first is critical. Without normalization, Euclidean distance metrics misestimate the true proximity, leading to poorer calibration.
Experimental Validation and Results
The authors evaluated their method using a standard base-to-new class split across 11 diverse image recognition datasets, ranging from general objects (ImageNet) to fine-grained categories (OxfordPets, Food101) and specialized domains (EuroSAT, SUN397).
- Massive ECE Reduction: DAC was tested on 7 different prompt/multi-modal tuning methods (CoOp, CoCoOp, ProDA, KgCoOp, MaPLe, ProGrad, PromptSRC). It consistently slashed the Expected Calibration Error (ECE) on novel classes. For example, using CoOp, DAC reduced the average ECE across all 11 datasets from 13.84% to 7.00%.
- Tames High Confidence: DAC specifically fixes the most dangerous type of miscalibration: highly confident but wrong predictions. In the 0.9 confidence bin on the DTD dataset, DAC reduced the gap between confidence and accuracy by ~30%.
- Zero Inference Overhead: Because DAC only relies on text embeddings (which can be pre-computed for the candidate labels), it adds virtually zero computational cost. Inference time on ImageNet-1K was 0.13 seconds with DAC, compared to 0.12 seconds for the baseline, whereas visual density-based calibration took nearly 16 seconds.
Limitations and Future Work
While highly effective, DAC assumes that the candidate set of open-vocabulary text labels is known at inference time so their text embeddings can be compared to the base classes. Furthermore, the evaluation focuses heavily on CLIP-based architectures and prompt-tuning methods.
The authors hope this work highlights the overlooked issue of reliability in fine-tuned VLMs and spurs future research into safety-related evaluations, moving the field beyond simply chasing higher zero-shot accuracy metrics.
Summary updated