Understanding and Mitigating Miscalibration in Prompt Tuning for Vision-Language Models

## Abstract

Abstract Confidence calibration is critical for the safe deployment of machine learning models in the real world.
However, such issue in vision-language models like CLIP, particularly after fine-tuning, has not been fully addressed.
In this work, we demonstrate that existing prompt tuning methods usually lead to a trade-off of calibration between base and new classes:
the cross-entropy loss in CoOp causes overconfidence in new classes by increasing textual label divergence, whereas the regularization of KgCoOp maintains the confidence level but results in underconfidence in base classes due to the improved accuracy.
Inspired by the observations, we introduce Dynamic Outlier Regularization (DOR) to ensure the confidence calibration on both base and new classes after fine-tuning.
In particular, we propose to minimize the feature deviation of novel textual labels (instead of base classes) sampled from a large vocabulary.
In effect, DOR prevents the increase in textual divergence for new labels while easing restrictions on base classes.
Extensive experiments demonstrate that DOR can enhance the calibration performance of current fine-tuning methods on base and new classes.

## 1 Introduction

Large pre-trained vision-language models (VLMs) like CLIP (Radford et al., ) have become the de facto standard in today’s zero-shot tasks including image recognition (Wortsman et al., ), open-vocabulary segmentation (Liang et al., ) and knowledge-augmented retrieval (Ming & Li, ).
To transfer pre-trained CLIP knowledge to domain-specific downstream tasks efficiently, various parameter-efficient fine-tuning (PEFT) techniques including prompt tuning (Zhou et al., ) and adapter (Gao et al., ) have been proposed.
Despite the promising improvement in accuracy, the reliability issue such as confidence calibration in fine-tuned VLMs has been largely overlooked.
Without fully understanding the miscalibration in fine-tuned VLMs, it can exacerbate safety concerns in high-stakes applications like medical diagnosis and autonomous driving.

In confidence calibration, we generally expect the model’s confidence level to be consistent with its empirical accuracy.
In the literature, zero-shot CLIP is often recognized for its excellent performance in confidence calibration (Minderer et al., ).
Prior work (Wang et al., ) finds that CLIP fined-tuned on base classes generally suffers from miscalibration on novel classes within the same task, where the model is expected to generalize  (Zhou et al., ; Yao et al., ).
However, they concentrate on novel classes that are not present in the fine-tuning, without adequately explaining the miscalibration issue on base classes. The community still lacks a comprehensive understanding of the fundamental cause and mitigation strategies of the miscalibration issue during fine-tuning.

In this work, we first investigate how current prompt tuning methods (e.g., CoOp (Zhou et al., ), KgCoOp (Yao et al., )) interfere with the calibration of CLIP.
We empirically find that existing prompt tuning methods fail to maintain the calibration performance on both base and new classes simultaneously, compromising one of them:
CoOp exhibits overconfidence on new classes and KgCoOp provides underconfident predictions on base classes.
We provide a thorough explanation from the perspective of textual label divergence.
In particular, CoOp increases the divergence of textual label distribution through cross-entropy loss, resulting in excessively high confidence misaligned with actual accuracy on new classes.
Instead, KgCoOp hinders the increase of textual distribution divergence, maintaining the confidence level on base and new classes. However, this leads to the underconfidence issue due to the improved accuracy on base classes.
There arises a question: Is it possible to ensure the calibration on both base and new classes after fine-tuning?

To tackle the above challenges, we introduce Dynamic Outlier Regularization (DOR).
The high-level idea behind DOR is to control the divergence of unseen textual distribution under the supervision of zero-shot CLIP without affecting the vanilla fine-tuning objectives.
First, we construct a set of textual outliers from a large lexical database – WordNet (Miller, ), and ensure that the selected classes are relevant but non-overlapped with the base classes in the fine-tuning task.
In fine-tuning, we reduce the feature discrepancy of novel textual labels between the fine-tuned model and the zero-shot CLIP.
In each epoch, the novel textual labels are dynamically sampled from the constructed set of textual outliers.
Leveraging dynamic textual outliers, DOR prevents the increase in textual divergence for new labels while easing restrictions on base classes.

We verify the effectiveness of DOR over 11 image classification datasets and four types of ImageNets with covariant shifts, under the evaluation protocol of base-to-new generalization and domain generalization, respectively.
Empirical results show that DOR can enhance the overall calibration of existing prompt-tuning methods (see Table 1), on both base and new classes. Moreover, our method can maintain and even improve the generalization performance of those tuning methods (See Table 1 & 2 ).
DOR also achieves significant improvements in the presence of covariate shifts.
In addition to prompt-based tuning methods, we demonstrate that such a regularization criterion can be extended to visual fine-tuning methods with image outliers.

We summarize our main contributions as follows:

- 1.
We provide an in-depth analysis of textual distribution divergence to understand the miscalibration in fine-tuned CLIP. We also show that current prompt-tuning methods typically lead to a trade-off between base and new classes, compromising one of them.
- 2.
We propose DOR, a simple yet effective regularization that ensures the calibration performance on both base and new classes. Our method is compatible with existing prompt-tuning methods and can be extended to visual fine-tuning methods with image outliers.
- 3.
We conduct extensive experiments and show that DOR achieves superior performance on a wide range of real-world tasks.
For instance, DOR achieves an average of 8.09% reduction in Expected Calibration Error (ECE) for CoOp over the 11 downstream datasets.

## 2 Preliminaries

#### Contrastive Language-Image Pretraining (CLIP)

CLIP is a visual-language model that enables to measure the alignment between images and texts (Radford et al., ).
Recently, CLIP has shown great potential in zero-shot inference for arbitrary classes. Let $\phi:\bm{x}\rightarrow\mathbb{R}^{d}$ and $\psi:\bm{t}\rightarrow\mathbb{R}^{d}$ denote CLIP’s image and text encoders, respectively. Given an image instance $\bm{x}$ and a text label $c$, the logit function of CLIP can be formulated as:

$$ $L_{c}^{clip}\left(\bm{x}_{i}\right)=\tau\cdot\operatorname{sim}\left(\phi(\bm{ x}),\psi(\bm{t}_{c})\right).$ (1) $$

Here $\bm{t}_{c}$ is derived from a hand-crafted prompt like “a photo of a {class}”, where the “{class}” is filled with the text label $c$. $\tau$ is generally set as a pre-trained constant of 100.

For multi-class classification, we predict by selecting the label with the highest probabilities among the label candidate set $\mathcal{C}=\{c_{i}\}^{C}_{i=1}$, as shown below:

$$ $c^{*}=\underset{c\in\mathcal{C}}{\arg\max}\ p(c|\bm{x})=\underset{c\in\mathcal {C}}{\arg\max}\ \frac{e^{L_{c}^{clip}\left(\bm{x}\right)}}{\sum_{i=1}^{C}e^{L_ {i}^{clip}\left(\bm{x}\right)}}$ (2) $$

where $p(c|\bm{x})$ is the predicted probability of class $c$ for the instance $\bm{x}$.

#### Prompt tuning

To strengthen the performance of CLIP in downstream applications, prompt tuning methods have been proposed to efficiently fine-tune CLIP on datasets of interest (Zhou et al., ; ; Yao et al., ).
In particular, prompt tuning optimizes the context prompt only, without retraining the model and updating its weights. For example, CoOp (Zhou et al., ) replaces the hand-crafted textual tokens with a set of learnable textual token $\mathcal{T}=\left\{\bm{v}_{1},\bm{v}_{2},\ldots,\bm{v}_{M}\right\}$, where $M$ is the length of tokens. Thus, the output of fine-tuned CLIP is:
$L_{c}^{coop}\left(\bm{x}\right)=\tau\cdot\operatorname{sim}\left(\phi(\bm{x}),
\psi(\bm{t}^{\prime}_{c})\right),$
where $\bm{t}_{c}^{\prime}=\left[\bm{v}_{1},\bm{v}_{2},\bm{v}_{3},...\bm{v}_{M},\bm{c
}\right]$ and $\bm{c}$ denotes the textual embedding of class $c$.
Using a few labeled samples $\mathcal{D}_{\text{ft}}=\{(\bm{x}_{i},c_{i})\}^{N}_{i=1}$, the learnable textual tokens $\mathcal{T}$ are optimized to minimize the cross-entropy (CE) loss $\ell_{ce}$. We refer to the classes used in fine-tuning as base classes, and the remaining labels within the same task as new or novel classes.

In addition to base classes, we generally expect the fine-tuned CLIP to generalize to those new classes within the task. To enhance the generalization ability of the learnable prompt for unseen classes, KgCoOp (Yao et al., ) introduces a regularization term to align the learned prompt to the hand-crafted prompt. The optimization of KgCoOp is:

$$ $\mathcal{T}^{\star}=\underset{\mathcal{T}}{\arg\min}\left\{\frac{1}{N}\sum_{i= 1}^{N}\ell_{ce}\left(p\left(c_{i}\mid\bm{x}_{i}\right)\right)+\lambda\cdot \frac{1}{C}\sum_{c=1}^{C}\operatorname{sim}\left(\psi\left(\bm{t}_{c}^{\prime} \right),\psi\left(\bm{t}_{c}\right)\right)\right\}.$ (3) $$

Here, the first term is the cross-entropy loss used in CoOp and the hyperparameter $\lambda$ is used to control the weight of regularization.
With $\lambda$ = 0, KgCoOp is degraded to the original CoOp.

#### Confidence calibration

In addition to predictive performance, it is generally expected for deep models to be well calibrated, i.e., the predicted class probabilities can faithfully estimate the true probabilities of correctness (Guo et al., ).
To quantify miscalibration, the Expected Calibration Error (ECE) (Guo et al., ) is defined as the difference between accuracy and confidence.
With $N$ samples grouped into $G$ bins $\{b_{1},b_{2},\ldots,b_{G}\}$, the ECE is formulated as:

$$ $\mathrm{ECE}=\sum_{g=1}^{G}\frac{\left|b_{g}\right|}{N}\left|\operatorname{acc }\left(b_{g}\right)-\operatorname{conf}\left(b_{g}\right)\right|,$ (4) $$

where $\operatorname{acc}\left(\cdot\right)$ and $\operatorname{conf}\left(\cdot\right)$ denotes the average accuracy and confidence in bin $b_{m}$. In the literature, it has been shown that pre-trained CLIP archives excellent performance of confidence calibration in zero-shot inference (Minderer et al., ). However, prior work (Wang et al., ) finds that fined-tuned CLIP generally suffers from miscalibration on novel classes within the same task, where the model is expected to generalize  (Zhou et al., ; Yao et al., ). Yet to date, the community still has a limited understanding of the fundamental cause and mitigation strategies of miscalibration during fine-tuning. We proceed by analyzing how the fine-tuning of CLIP affects the calibration.

## 3 Motivation

### 3.1 Empirical study on CLIP calibration

Figure: (a) Base
Refer to caption: x1.png

#### Setup.

To analyze the effects of fine-tuning on CLIP calibration, we first empirically study the calibration performance of fine-tuned VLMs.
We use ViT-B-16 pre-trained by OpenAI (Radford et al., ) as the zero-shot classification model.
In particular, we compare the zero-shot CLIP with two prompt-based tuning methods including CoOp (Zhou et al., ) and KgCoOp (Yao et al., ) on StanfordCars dataset (Krause et al., ).
We evaluate the fine-tuned CLIP under base-to-new protocol: the dataset is split into base and new classes.
The model is trained only on a few examples from the base classes and evaluated on examples from both base and new classes.

#### Prompt tuning leads to a tradeoff between base and new classes

Figure 1 illustrates the calibration performance of zero-shot CLIP, CoOp and KgCoOp on base and new classes. The results show that zero-shot CLIP achieves almost perfect calibration on all classes, while the fine-tuned models cannot maintain the calibration on base and new classes simultaneously, compromising one of them.
In particular, CoOp maintains the excellent calibration on base classes but exhibits overconfidence on new classes. Instead, KgCoOp provides underconfident predictions on base classes while preserving the calibration on new classes.
This motivates us to further investigate the fundamental cause of miscalibration occurring after fine-tuning.

Figure: (a) Confidence
Refer to caption: x3.png

### 3.2 Understanding the miscalibration in Fine-tuned CLIP

Given the above observation, we investigate how prompt tuning leads to the miscalibration issue.
Since the visual features remain unchanged in the prompt tuning, the textual features thus play a key role in confidence calibration.
We first introduce a feature divergence score to quantify the textual feature variation, inspired by the KNN-based metrics commonly used for distribution estimation in calibration (Xiong et al., ; Yuksekgonul et al., ).

###### Definition 1 (Feature Divergence) .

Consider a feature set $\mathcal{Z}=\left\{\mathbf{z}_{i}\right\}_{i=1}^{N}$, each feature $\mathbf{z}_{i}\in\mathbb{R}^{d}$ is embedded by the modality encoder in CLIP. Feature divergence (FD) score of $\mathbf{z}_{i}$ measures the average distances from each feature to its $M$ nearest neighbors in the set.

$$ $s_{i}=\frac{1}{M}\sum_{\mathbf{z}_{j}\in\mathcal{N}_{M}(\mathbf{z})} \operatorname{dist}(\mathbf{z}_{i},\mathbf{z}_{j}),$ (5) $$

where $\mathcal{N}_{M}(\mathbf{z}_{i})$ denotes the set of $M$ nearest neighbors of $\mathbf{z}_{i}$ and $\operatorname{dist}\left(\cdot,\cdot\right)$ is a distance metric like cosine similarity.
By averaging these similarity scores across all features, we obtain the overall FD score of a given feature set $\mathrm{FD}(\mathcal{Z})=\frac{1}{N}\sum_{i=1}^{N}s_{i}$, which can represent the divergence of the textual distribution.
To investigate the miscalibration caused by CoOp and KgCoOp, we vary the hyperparameter $\lambda$ in Eq. (3). In KgCoOp, $\lambda$ is set to 8.0, and it degenerates to CoOp when $\lambda=0$.
We conduct the experiments on UCF101 (Soomro et al., ). We present the results in Figure 3.

CoOp leads to overconfidence on new classes by increasing the textual divergence.
In the analysis of Subsection 3.1 and Figure 2(a), we show that CLIP tuned by CoOp exhibits overconfidence on new classes, but keeps excellent calibration on base classes.
This is caused by the CE loss, which maximizes the posterior $p(y\mid\bm{x})$ for the ground-truth label $y$ and minimizes the probability for other labels.
In other words, CE loss tends to enlarge the distance between the image feature and all textual features except the ground truth.
As the image feature remains unchanged during fine-tuning, it can be translated to large distances among all textual labels, including base and new classes.
This is supported by the results presented in Figure 2(b), which shows that CoOp significantly increases the FD score of textual features compared to the zero-shot CLIP.
Consequently, as is shown in Figure 3, the gap between the maximum logit and the others widens for both base and new classes.
Therefore, the tuned CLIP with CE loss will make softmax predictions with high confidence on both base and new classes. It aligns with the improved accuracy on base classes, but is not consistent with the nearly unchanged accuracy on new classes.
This explains why CLIP tuned by CoOp tends to be overconfident on new classes.

KgCoOp anchors the confidence level by hindering the increase of textual divergence.
In the previous analysis, KgCoOp leads to underconfident predictions on base classes while preserving the calibration on new classes.
In Figure 2(b), we illustrate the FD scores of textual labels from the zero-shot CLIP and the tuned CLIP by KgCoOp with various $\lambda$. The results show that a large value of $\lambda$ reduces the FD score of both base and new classes, approaching that of zero-shot CLIP. This phenomenon indicates that the regularization in KgCoOp can prevent the model from increasing the textual divergence caused by CE loss. Correspondingly, the fine-tuned CLIP by KgCoOp preserves the same confidence level as the zero-shot CLIP. However, the fine-tuning substantially improves the accuracy of CLIP on base classes, resulting in the underconfidence issue due to the anchored confidence level. In this way, we explain why KgCoOp leads to underconfidence on base classes.

Through the perspective of textual divergence, we provide a thorough explanation for the calibration tradeoff caused by different prompt-tuning methods. In addition, we present in Appendix A a theoretical justification for the relationship between textual divergence and model confidence. Ideally, we expect to maintain the excellent calibration of zero-shot CLIP after fine-tuning. In the following, we proceed by introducing our method, targeting this problem.

###### Definition 1 (Feature Divergence) .

## 4 Method: Dynamic Outlier Regularization

In the previous analysis, we show that the textual divergence is the key to the calibration performance of fine-tuned CLIP. To preserve the calibration of zero-shot CLIP, our key idea is to regularize the textual divergence of new classes without restricting those of base classes.
To this end, we propose to utilize textual outliers to improve the reliability of fine-tuned CLIP.
Such a regularization can mitigate the overconfidence in the new classes, which are not explicitly inclusive in the fine-tuning.

#### Selecting textual outliers

With this in mind, we construct a set of text outliers using nouns from WordNet (Miller, ), a large English lexical database containing over 150,000 words.
We select nouns from WordNet that do not overlap but share higher-level concept relations with the base classes used in the fine-tuning, and then incorporate them into our regularization term for prompt tuning.
We demonstrate the effectiveness of using relevant text outliers in Table 5.

Let $\mathcal{C}_{\text{ft}}=\left\{c_{1},c_{2},\ldots,c_{n}\right\}$ be the $n$ base classes used in the fine-tuning. First, we obtain a candidate set $\mathcal{C}_{\text{word}}=\left\{o_{1},o_{2},\ldots,o_{m}\right\}$, by filtering out the base classes from WordNet.
Then, we rank the nouns according to the average semantic similarity among the candidate $\mathcal{C}_{\text{word}}$ and each base class $c_{j}\in\mathcal{C}_{\text{ft}}$. For candidate word $o_{i}$, we use zero-shot CLIP to quantify the semantic similarity $s_{i}$:

$$ $s_{i}=\frac{1}{n}\sum_{j=1}^{n}\operatorname{sim}\left(\psi\left(\bm{t}_{o_{i} }\right),\psi\left(\bm{t}_{c_{j}}\right)\right),\text{ where }i\in\{1,2,\ldots ,m\},$ (6) $$

where $\bm{t}_{o_{i}}$ represents the textual tokens of a noun $o_{i}$ using a fixed prompt like “a photo of a [class-name]”, and $\psi$ is the text encoder of zero-shot CLIP.
Then we get the set of textual outliers using the score ranking.

$$ $\mathcal{O}_{\text{out }}=\left\{o_{i}\mid i\in\operatorname{TopK}\left(s_{1}, s_{2},\ldots,s_{m}\right)\right\},$ (7) $$

where $\operatorname{TopK}(\cdot)$ represents selecting the indices with the top $K$ largest scores for nouns in the candidate set $\mathcal{C}_{\text{word}}$.

#### Dynamic Outlier Regularization

Given a fine-tuning dataset $\mathcal{D}_{\text{ft}}$ with base classes $\mathcal{C}_{\text{ft}}$, we construct a large set of textual outliers $\mathcal{O}_{\text{out }}$ as described above. To prevent the increase of textual divergence on new classes, we propose Dynamic Outlier Regularization (DOR), which minimizes the feature discrepancy of textual outliers between the zero-shot CLIP and the fine-tuned CLIP.

In each iteration, we randomly sample a batch of textual outliers from the constructed set $\mathcal{O}_{\text{out }}$. We denote the batch of textual outliers as $\mathcal{B}=\left\{o_{i}\right\}_{b=1}^{B}$, where $B$ is the number of textual outliers in the batch. By default, we set $B$ as the same as the batch size of fine-tuning data. Then, we build the regularization by aligning the textual features to those of zero-shot CLIP. Formally, the regularization is defined as:

$$ $\mathcal{L}_{\text{dor}}=1-\frac{1}{B}\sum_{b=1}^{B}\operatorname{sim}\left( \psi\left(\bm{t}_{o_{b}}^{\prime}\right),\psi\left(\bm{t}_{o_{b}}\right)\right).$ (8) $$

where $\operatorname{sim(\cdot)}$ denotes the cosine similarity function and $\bm{t}_{o_{b}}$ denotes the token of the textual outlier $o_{b}$.
Using the regularization, the textual divergence of the fine-tuned CLIP will be regularized to be consistent with the zero-shot CLIP. Different from KgCoOp Yao et al. (), the outlier regularization does not restrict the textual feature deviation of base classes, which is explicitly shown in Figure 5.

Equipped with dynamic outlier regularization, the final training objective for fine-tuning CLIP is:

$$ $\mathcal{L}_{total}=\mathcal{L}_{\text{ce}}+\lambda\cdot\mathcal{L}_{\text{dor }}.$ (9) $$

where $\mathcal{L}_{\text{ce}}$ and $\mathcal{L}_{\text{dor}}$ are the cross-entropy loss of fine-tuning data and the proposed regularization, respectively. $\lambda$ denotes the hyperparameter that controls the weight of the proposed regularization. Our method will degrade to CoOp (Zhou et al., ) when $\lambda=0$. As $\lambda$ increases, the optimization will encourage the model to maintain the confidence level on new classes, alleviating the overconfidence issue. We illustrate the effect of $\lambda$ in Figure 4.

#### Extension to other fine-tuning algorithms

It is worth noting that our regularization is a general method and can be easily incorporated into existing prompt tuning algorithms for CLIP, including knowledge-guided fine-tuning (Yao et al., ; ), multimodal consistency (Khattak et al., ), Decoupled prompt tuning (Zhang et al., ) etc. Given the vanilla fine-tuning objective $\mathcal{L}_{\text{base}}$ of the other methods and the hyperparameter $\lambda$, we formalize the fine-tuning objective as:

$$ $\mathcal{L}_{\text{total }}=\mathcal{L}_{\text{base}}+\lambda\cdot\mathcal{L}_ {\text{dor}}.$ (10) $$

Noticeably, DOR derived from textual outliers offers several compelling advantages:

- •
Algorithm-agnostic: DOR can be easily incorporated into existing prompt tuning methods and consistently mitigate the calibration error under various evaluations (See Table 1 and 2). Furthermore, our method can be extended to visual fine-tuning methods with image outliers (See Section 4).
- •
Easy-to-use: DOR leverages text outlier as the data for regularization, which is readily available and easy to collect. In Section 4 we will verify that DOR outperforms other selection strategies. We provide the detailed selection result of text outliers in Appendix C.

## 5 Experiments

### 5.1 Experimental Setup

#### Benchmark setting.

Following recent works (Zhou et al., ; Wang et al., ), we perform two evaluations in two standard benchmark settings:
1) Generalization from Base-to-New Classes:
A downstream dataset will be equally split into base and new classes.
The model is trained only on the base classes in a few-shot setting and evaluated on base and new categories.
2) Domain Generalization: The modal is trained on ImageNet-1K in a few-shot manner and evaluated on four other ImageNet datasets that contain various types of domain shifts.

#### Datasets.

For the base-to-new evaluation, we use 11 image recognition datasets that cover diverse classification tasks including ImageNet (Deng et al., ), Caltech101 (Fei-Fei et al., ), OxfordPets (Parkhi et al., ), StanfordCars (Krause et al., ), Flowers102 (Nilsback & Zisserman, ), Food101 (Bossard et al., ), FGVCAircraft (Maji et al., ), SUN397 (Xiao et al., ), UCF101 (Soomro et al., ), DTD (Cimpoi et al., ) and EuroSAT (Helber et al., ).
For domain generalization, we use ImageNet-1K as the source dataset and its four variants as target datasets including ImageNetV2 (Recht et al., ), ImageNet-Sketch (Wang et al., ), ImageNet-A (Hendrycks et al., ), ImageNet-R (Hendrycks et al., ).

#### Baselines.

We compare and incorporate our method with existing fine-tuning algorithms including CoOp (Zhou et al., ), CoCoOp (Zhou et al., ), KgCoOp (Yao et al., ), MaPLe (Khattak et al., ), DEPT (Zhang et al., ), and TCP (Yao et al., ).

#### Implementation details.

We use CLIP ( ViT-B/16) (Radford et al., ) as the pre-trained VLM throughout our experiments and report results averaged over 3 runs.
We fine-tune the model with 16 samples per class in a few-shot setting (Zhou et al., ).
For the compared tuning methods, we adopt them from the corresponding official implementation.
For hyperparameter $\lambda$ in DOR, we set $\lambda$ = 8.0 for CoOp and 2.0 for other fine-tuning methods.
We set the number of selected dynamic outlier repository to 5000.
The number of outliers in each batch is the same as the base classes.
We list the details of the compared methods in Appendix B.

#### Evaluation metrics.

Four standard metrics of confidence calibration are used in our evaluation, including Expected Calibration Error (ECE) (Guo et al., ), Maximum Calibration Error (MCE) (Guo et al., ), Adaptive Calibration Error (ACE) (Nixon et al., ) and Proximity-Informed Expected Calibration Error (PIECE) (Xiong et al., ).

**Table 1: Average calibration performance across 11 datasets. “+DOR(Ours)” to our method applied to existing tuning methods. ↓ indicates smaller values are better. Calibration error is given by $\times 10^{-2}$. “HM” denotes the harmonic mean. Bold numbers are significantly superior results.**
|  | ECE(↓) | ACE(↓) | MCE(↓) | PIECE(↓) |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method | Base | New | HM | Base | New | HM | Base | New | HM | Base | New | HM |
| ZSCLIP | 3.58 | 4.61 | 4.10 | 3.62 | 4.58 | 4.10 | 0.97 | 1.21 | 1.09 | 6.35 | 6.55 | 6.45 |
| CoOp | 3.07 | 14.58 | 8.82 | 2.97 | 14.50 | 8.73 | 1.07 | 3.72 | 2.40 | 4.68 | 15.27 | 9.98 |
| +DOR(Ours) | 2.67 | 6.49 | 4.58 | 2.64 | 6.47 | 4.55 | 0.83 | 1.65 | 1.24 | 4.45 | 8.33 | 6.39 |
| CoCoOp | 3.60 | 6.14 | 4.87 | 3.53 | 6.08 | 4.81 | 0.96 | 1.72 | 1.34 | 5.53 | 7.86 | 6.70 |
| +DOR(Ours) | 4.22 | 4.02 | 4.12 | 4.30 | 3.94 | 4.12 | 1.07 | 1.11 | 1.09 | 6.00 | 6.41 | 6.20 |
| MaPLe | 2.75 | 5.46 | 4.11 | 2.65 | 5.42 | 4.04 | 0.82 | 1.52 | 1.17 | 4.71 | 7.37 | 6.04 |
| +DOR(Ours) | 2.83 | 4.44 | 3.63 | 2.86 | 4.33 | 3.60 | 0.81 | 1.29 | 1.05 | 4.86 | 6.39 | 5.62 |
| KgCoOp | 5.82 | 4.48 | 5.15 | 5.78 | 4.52 | 5.15 | 1.43 | 1.19 | 1.31 | 6.88 | 6.73 | 6.81 |
| +DOR(Ours) | 6.07 | 3.99 | 5.03 | 6.03 | 4.02 | 5.02 | 1.52 | 1.02 | 1.27 | 7.09 | 6.33 | 6.71 |
| DEPT | 6.04 | 14.58 | 10.31 | 6.00 | 14.52 | 10.26 | 1.44 | 4.58 | 3.01 | 7.31 | 15.42 | 11.37 |
| +DOR(Ours) | 7.67 | 7.50 | 7.58 | 7.66 | 7.44 | 7.55 | 1.73 | 1.87 | 1.80 | 8.68 | 8.86 | 8.77 |
| TCP | 4.71 | 4.07 | 4.39 | 4.73 | 4.03 | 4.38 | 1.28 | 1.21 | 1.24 | 6.06 | 6.29 | 6.18 |
| +DOR(Ours) | 4.79 | 3.80 | 4.29 | 4.76 | 3.71 | 4.24 | 1.28 | 1.11 | 1.20 | 6.00 | 6.22 | 6.11 |

### 5.2 Results

Generally, we investigate the effectiveness of DOR from three metrics: calibration, generalization accuracy, and confidence level.
Due to space constraints, we provide detailed calibration results of all datasets in Appendix D.

**Table 2: Average base-to-new accuracy (%) of six methods with DOR on 11 datasets. “Vanilla” denotes the baseline of fine-tuning methods. Bold numbers are significantly superior results.**
|  | ZSCLIP | CoOp | CoCoOp | MaPLe | KgCoOp | DEPT | TCP |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Class | Vanilla | Vanilla | + DOR | Vanilla | + DOR | Vanilla | + DOR | Vanilla | + DOR | Vanilla | + DOR | Vanilla | + DOR |
| Base | 69.49 | 82.97 | 83.20 | 80.57 | 79.89 | 82.11 | 82.08 | 82.29 | 82.13 | 83.70 | 83.81 | 83.95 | 83.89 |
| New | 74.32 | 61.74 | 72.01 | 72.47 | 74.59 | 73.89 | 75.89 | 72.21 | 73.14 | 65.04 | 71.39 | 75.21 | 75.31 |
| HM | 71.90 | 72.36 | 77.61 | 76.52 | 77.24 | 78.00 | 78.98 | 77.25 | 77.64 | 74.37 | 77.60 | 79.58 | 79.60 |

#### DOR enhances the overall calibration of existing prompt-tuning methods.

Table 1 shows the calibration performance of the six baselines w/ or w/o our DOR framework under the base-to-new evaluation protocol.
From the average results in the table, we observe a trade-off between the base and new class for all of the baseline methods, e.g., CoOp outperforms TCP on base classes but significantly underperforms TCP on new classes.
Notably, DOR consistently reduces miscalibration on new classes across various metrics without calibration trade-offs on base and new classes.
For instance, DOR significantly reduces the ECE from 14.58% to 6.49% on new classes and maintains the ECE from 3.07% to 2.67% on base classes, which makes CoOp more reliable in terms of predicted confidence.
To showcase the versatility of DOR, we also present that DOR is also applicable to multi-modal tuning (e.g., MaPLe).
MaPLe adjusts both vision and language branches and DOR consistently improves the calibration performance on new classes of it.
In summary, our proposed DOR can consistently boost calibration performance on new classes upon existing state-of-the-art prompt tuning methods without compromising the vanilla fine-tuning objectives.

DOR benefits base-to-new generalization.
To further verify that our DOR is effective on new classes and non-toxic for performance on base classes, we summarize the comparison of average test accuracy in Table 2.
Similar to the evaluation of calibration, a salient observation is that our proposed DOR drastically improves base-to-new generalization, with its accuracy consistently outperforming all existing baselines in the harmonic mean of base and new classes.
Moreover, DOR almost entirely preserves model capability in the classification performance on base classes without degeneration.
For instance, applying DOR in DEPT can increase accuracy on new classes from 65.04% to 71.39%, while keeping the accuracy of base classes similar to the baseline.
Given that most prompt tuning methods lag behind zero-shot CLIP on the accuracy of new classes, an intuitive explanation is that DOR aligns the features of unseen classes with the zero-shot features, which can preserve the zero-shot generalization on new clasess.
In addition, we observe that some methods (e.g., CoOp and MaPLe) with DOR, resulting in improvements of 2.12% and 2.00% respectively, outperforming zero-shot accuracy on new classes.
This demonstrates that DOR can significantly enhance the base-to-new generalization capacity of fine-tuned CLIP.

Figure: Figure 4: Comparison between KgCoOp (KG) and DOR (W/ CoOp). Left: Accuracy. Right: ECE.
Refer to caption: x7.png

DOR modifies the logit distribution and confidence level.
To further illustrate the influence of DOR on confidence calibration, we visualize and compare the distribution of output logit and softmax confidence score for base and new classes in Figure 5.
We compare zero-shot CLIP and CoOp w/ or w/o DOR on FGVCAircraft dataset.
We can observe that if the model tuning With CoOp+DOR, the logit distribution of base class approximate CoOp, and the new class is similar to zero-shot CLIP, respectively.
A similar phenomenon is observed in the softmax probability distribution.
The results meet our vision mentioned in Section 3.1, DOR can leverage the advantages of both models, which ensure the confidence calibration on both base and new classes after fine-tuning.

**Table 3: Comparison of prompt learning in the domain generalization of ImageNet. DOR boosts the performance of existing methods on calibration and generalization.**
|  | Accuracy (↑) |  | ECE (↓) |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | Source | Target |  | Source | Target |  |  |  |  |  |  |  |  |
|  | ImageNet | -V2 | -S | -A | -R | AVG |  | ImageNet | -V2 | -S | -A | -R | AVG |
| CLIP | 66.73 | 60.87 | 46.09 | 47.81 | 73.98 | 57.19 |  | 1.86 | 2.44 | 4.88 | 8.34 | 3.51 | 4.79 |
| CoOp | 71.44 | 63.55 | 45.76 | 47.81 | 73.74 | 57.72 |  | 1.10 | 4.19 | 8.40 | 15.34 | 0.80 | 7.18 |
| +DOR(ours) | 71.47 | 64.47 | 48.28 | 50.12 | 76.05 | 59.73 |  | 1.64 | 1.95 | 4.97 | 11.07 | 1.58 | 4.89 |
| MaPLe | 72.05 | 64.57 | 48.78 | 47.66 | 76.61 | 59.41 |  | 1.13 | 2.56 | 4.88 | 12.42 | 1.06 | 5.23 |
| +DOR(ours) | 71.89 | 64.94 | 48.77 | 48.29 | 76.20 | 59.55 |  | 1.46 | 1.89 | 3.96 | 11.08 | 1.37 | 4.58 |

Figure: Figure 5: Distribution visualization of logit and maximum softmax probability on FGVCAircraft dataset. Our method generates logit and probability distributions that closely resemble those of CoOp for the base class and are similar to zero-shot CLIP for the new class.
Refer to caption: x8.png

#### DOR is insensitive to hyperparameters.

To further illustrate the influence of hyperparameter $\lambda$, we present a sensitivity analysis.
We report the average performance on 11 datasets under base-to-new evaluation protocol.
As is shown in in Figure 4, we can observe that DOR demonstrates robustness in model calibration as $\lambda$ in Eq.(10) varies.
Although KgCoOp has better calibration on new classes as $\lambda$ increases, it sacrifices accuracy and calibration on base classes while our method does not.
The results verify that DOR is an effective approach to boosting calibration performance on new classes while maintaining performance on base classes.

#### DOR is robust to covariate shifts.

To comprehensively verify the robustness of DOR, we further evaluate its performance in the domain generalization setting, i.e., there is a covariate shift between training and testing datasets.
Specifically, we first fine-tune the model with all classes of ImageNet on the 16-shot setting and then evaluate it on 4 types of datasets with covariate shifts.
As is shown in Table 3, the calibration performance indicates DOR maintains stability in the presence of covariate shifts.
Although DOR is not specially designed for the covariate shift, it outperforms the calibration baseline of CoOp and MaPLe, reducing ECE by 2.29% and 0.65% under distribution shifts respectively.
Meanwhile, DOR demonstrates superior accuracy in domain generalization and successfully maintains in-distribution performance.

## 6 Discussion

**Table 4: Calibration results of ECE (%) on fine-tuning of visual representation. DOR-V(ision) is effective for better calibration via visual representation regularization.**
|  | Flowers | Cars | DTD | UCF101 | AVG |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method | Base | New | Base | New | Base | New | Base | New | Base | New | Avg. |
| VPT | 7.98 | 8.20 | 5.32 | 1.93 | 2.54 | 13.04 | 4.04 | 4.79 | 4.97 | 6.99 | 5.98 |
| +DOR-V(ours) | 8.19 | 7.54 | 4.90 | 1.78 | 2.68 | 8.40 | 3.73 | 4.58 | 4.88 | 5.58 | 5.23 |
| CLIP-adapter | 3.70 | 6.55 | 6.09 | 5.73 | 3.00 | 7.45 | 4.04 | 7.09 | 4.21 | 6.71 | 5.46 |
| +DOR-V(ours) | 4.02 | 4.86 | 7.13 | 4.85 | 3.25 | 5.63 | 1.90 | 5.23 | 4.08 | 5.14 | 4.61 |

**Table 5: Calibration results of ECE (%) with different outliers . Oracle* denotes new classes used in the test-time.**
| Method | Source | Base | New | HM |
| --- | --- | --- | --- | --- |
| CoOp | near-OOD | 2.68 | 7.09 | 4.89 |
| far-OOD | 2.95 | 7.72 | 5.34 |  |
| oracle* | 3.13 | 4.34 | 3.74 |  |
| MaPLe | near-OOD | 3.00 | 4.52 | 3.76 |
| far-OOD | 2.65 | 4.95 | 3.80 |  |
| oracle* | 3.15 | 4.22 | 3.69 |  |

#### What makes a good regularization for CLIP fine-tuning?

Based on the above observation, we have demonstrated that using the text outlier as the regularization source could be better than the base classes used in prompt tuning.
In particular, we use the relevant but non-overlapped outlier with the fine-tuning task (referred to as near-OOD) as the regularization data.
Such selection raises a question: why we prefer to choose near-OOD?
To address this, we conducted an ablation on different types of outliers.
We considered three types of outliers: near-OOD(ours), far-OOD and new classes used at test time.
The far-OOD is selected by applying the opposite operation of Eq. 7.
Since target new classes are unknown during fine-tuning, we view them as an oracle, which serves as a performance upper bound for base-to-new tasks.
We report the average performance on the base-to-new datasets.

We present the results in Table 5.
Since we primarily fine-tune the model for a specific downstream task, selecting far-OOD data completely unrelated to the original task may not be optimal for confidence calibration.
Moreover, while the oracle can achieve impressive performance on the calibration of new classes, the fixed number of outliers may cause the model to overfit them, resulting in a decline in generalization.
Additionally, we do not know which categories will be used at test time during the fine-tuning phase.
Therefore, we dynamically use near-OOD as regularization data, which reduces calibration errors on new classes while preserving performance on base classes.

#### Can the criterion of DOR be extended to visual tuning?

In this paper, we primarily focus on prompt tuning and analyze how textual divergence impacts confidence calibration.
Such analysis may limit the potential scope of CLIP fine-tuning methods.
To address this, we further consider a similar regularization approach based on image outliers for fine-tuning on visual representation.
Specifically, we use ImageNet-1K (Deng et al., ) as an outlier repository and conduct experiments on four downstream datasets.
For visual representation fine-tuning methods, we utilize CLIP-adapter (Gao et al., ) and visual prompt tuning (VPT) (Jia et al., ).

As is shown in Table 4, we observe that visual-based DOR can successfully reduce the calibration error on new classes.
For example, DOR outperforms VPT and CLIP-adapter baseline by reducing ECE by 4.64% and 1.82% on the DTD dataset, respectively.
In general, visual-based DOR achieves better average calibration across various downstream datasets and leaves space for further improvement.
Given that expected image outliers are not always accessible easily as text, a potential method is to generate them by diffusion (Du et al., ) for high-quality image outliers.

## 7 Related work

#### Vision-language models.

Large pre-trained large vision-language models (Jia et al., ; Radford et al., ) have been verified that effectively comprehend visual concepts using language supervision and apply them in downstream tasks (Radford et al., ; Zhou et al., ; Lu et al., ; Naeem et al., ; Ming & Li, ; Parelli et al., ).
To further boost the downstream adaptation of pre-trained VLMs, many parameter-efficient tuning methods like vanilla prompt tuning (Zhou et al., ; ; Khattak et al., ) and adapter tuning (Gao et al., ; Zhang et al., ) have been proposed for high efficiency.
Despite the great success of CLIP fine-tuning, their effectiveness on confidence calibration has largely been overlooked, which is essential for real-world deployment.

#### Confidence calibration.

Confidence calibration has been widely studied to ensure that the confidence levels output by models accurately reflect their empirical accuracy.
To achieve this, the state-of-the-art calibration methods can be categorized into regularization methods (Guo et al., ; Pereyra et al., ; Mukhoti et al., ) and post-hoc methods (Guo et al., ; Zadrozny & Elkan, ; ; Tomani et al., ; Xiong et al., ).
In this work, we introduce a regularization method of fine-tuning CLIP to improve the confidence calibration, on both base and new classes.

#### Outlier regularization in trustworthy machine learning.

The outlier plays an important role in trustworthy machine learning research including out-of-distribution (OOD) detection (Hendrycks et al., ; Liu et al., ; Ming et al., ; Jiang et al., ; Du et al., ), noisy label learning (Wei et al., ), adversarial attack (Lee et al., ), long-tailed datasets re-balancing (Wei et al., ), etc.
In this paper, we utilize text outliers to control the divergence of unseen textual distribution, and further improve the calibration of fine-tuned CLIP.

## 8 Conclusion & Limitation

In this paper, we introduce Dynamic Outlier Regularization (DOR), a simple yet effective technique that enhances the confidence calibration on both base and new classes. We show that current prompt tuning methods typically lead to a tradeoff between the base and new classes. Through the textual divergence, we provide a thorough explanation for the limitations of those tuning methods.
By utilizing relevant but non-overlapped outlier outliers, DOR regularizes the textual distribution to preserve calibration capacity in zero-shot CLIP.
Our method is compatible with existing prompt-tuning methods and can be extended to improve visual fine-tuning methods, like adapters.
We hope future research can extend the insight in this work to other VLMs.

#### Limitations

Similar to previous regularization methods of CLIP, our method involves a hyperparameter $\lambda$ to control the weight of regularization, which will require extra computational costs for tuning.
Moreover, our analysis is limited in the scope of CLIP, leaving other kinds of VLMs to be explored in the future.

## Appendix A Theoretical justification

To help readers understand the insights, we formalize our observations of CLIP fine-tuning that the textual divergence is a significant factor for confidence estimation in this part. As the image feature remains unchanged in the fine-tuning, the textual divergence can be translated to the variance of logits, which is computed by the similarity between the image feature and different text features. In the following, we formally show the relationship between the logit variance and the confidence.

For simplicity, we consider a binary classification problem.
Let $\left\{\bm{z_{i}}\right\}_{i=1}^{n}$ be a set of logit vectors (i.e., model outputs), where each vector $\bm{z}_{i}=[z_{1},z_{2}]^{\mathrm{T}}$ consists of two logits.
We assume that the logit $z$ is an independent random variable drawn from a normal distribution $\mathcal{N}(\mu,\sigma^{2})$.
The confidence (i.e., maximum softmax probability) $p_{i}$ is given by the softmax (or sigmoid) function defined as in Eq.(2). We have the following proposition.

###### Proposition 1 .

Let $\mathbb{E}[p_{\sigma}]$ denote the expected value of the maximum probability $p_{i}$ when the logits are distributed as $\mathcal{N}(\mu,\sigma^{2})$. Then, for any $\sigma_{1},\sigma_{2}>0$ and $\mu$, we have $\mathbb{E}[p_{\sigma_{2}}]>\mathbb{E}[p_{\sigma_{1}}]$, if $\sigma_{2}>\sigma_{1}$.

This suggests that the high divergence in the logit distribution tends to generate larger predicted confidence, which is induced by the textual divergence using CE loss.
In Section 5, we empirically verify that our proposed method can preserve the textual divergence on the new classes, thereby improving the calibration performance.

###### Proof.

We first remove the influence of $\mu$. For any constant $c$, we have:

$$ $p_{i}=\frac{e^{z_{i}+c}}{\sum_{j=1}^{N}e^{z_{j}+c}}=\frac{e^{z_{i}}}{\sum_{j=1 }^{N}e^{z_{j}}}.$ $$

Thus, the mean value $\mu$ of the logits does not affect the softmax output. Therefore, without loss of generality, we can assume that $\mu=0$ in our proof. For binary classification, we have:

$$ $p_{1}=\frac{e^{z_{1}}}{e^{z_{1}}+e^{z_{2}}}=\frac{1}{1+e^{-\left(z_{1}-z_{2} \right)}}=\operatorname{sigmoid}\left(z_{1}-z_{2}\right),p_{2}=\operatorname{ sigmoid}\left(z_{2}-z_{1}\right).$ $$

Hence, the maximum softmax probability is:

$$ $p_{\text{max}}=\max(p_{1},p_{2})=\text{sigmoid}(|z_{1}-z_{2}|).$ $$

Since $z_{1}-z_{2}\sim\mathcal{N}(0,2\sigma^{2})$, the absolute difference $Z=|z_{1}-z_{2}|$ follows a folded normal distribution with the probability density function:

$$ $f_{Z}(z)=\frac{1}{\sqrt{\pi\sigma^{2}}}e^{-\frac{z^{2}}{4\sigma^{2}}},\quad z \geq 0.$ $$

Thus, the expected value of the maximum softmax probability is:

$$ $E[p_{\text{max}}]=E[\text{sigmoid}(Z)]=\int_{0}^{\infty}\operatorname{sigmoid} (z)\cdot f_{Z}(z)dz=\int_{0}^{\infty}\frac{1}{1+e^{-z}}\cdot\frac{1}{\sqrt{\pi \sigma^{2}}}e^{-\frac{z^{2}}{4\sigma^{2}}}dz.$ $$

For simplicity, we perform the substitution $u=\frac{z}{\sigma\sqrt{2}}$.
The integral can be simplified to:

$$ $E[p_{\text{max}}]=\int_{0}^{\infty}\frac{1}{1+e^{-\sigma\sqrt{2}u}}\cdot\frac{ \sqrt{2}}{\sqrt{\pi}}e^{-\frac{u^{2}}{2}}du.$ $$

Using Leibniz’s rule, we can differentiate with respect to $\sigma$ under the integral sign:

$$ $\frac{dE[p_{\text{max}}]}{d\sigma}=\int_{0}^{\infty}\frac{\partial}{\partial \sigma}\left(\frac{1}{1+e^{-\sigma\sqrt{2}u}}\right)\cdot\frac{\sqrt{2}}{\sqrt {\pi}}e^{-\frac{u^{2}}{2}}du=\int_{0}^{\infty}\frac{e^{-\sigma\sqrt{2}u}\cdot 2 u}{\left(1+e^{-\sigma\sqrt{2}u}\right)^{2}}\cdot\frac{1}{\sqrt{\pi}}e^{-\frac{ u^{2}}{2}}du\geq 0.$ $$

Hence, the expected maximum probability $E[p_{\text{max}}]$ increase alone with $\sigma$.
Then, We have $\mathbb{E}[p_{\sigma_{2}}]>\mathbb{E}[p_{\sigma_{1}}]$, if $\sigma_{2}>\sigma_{1}$. The proposition is proven.
∎

###### Proposition 1 .

###### Proof.

## Appendix B Implementation Details

**Table 6: Hyperparameters for VLM tuning methods. “BS” denotes the batch size. “LR” denotes the learning rate. “CTX” is the context length of the learnable prompt.**
| Methods | Epochs | BS | LR | CTX |
| --- | --- | --- | --- | --- |
| CoOp | 200 | 32 | 0.002 | 16 |
| CoCoOp | 10 | 1 | 0.002 | 4 |
| DEPT | 200 | 32 | 0.002 | 16 |
| KgCoOp | 200 | 32 | 0.002 | 16 |
| MaPLe | 5 | 4 | 0.0026 | 2 |
| TCP | 50 | 32 | 0.002 | 4 |
| CLIP-Adapter | 200 | 32 | 0.002 | - |
| VPT | 5 | 4 | 0.0025 | 8 |

Our implementations are based on the open-source repository of DAC (Wang et al., ).
Generally, We use CLIP ( ViT-B/16) (Radford et al., ) as the pre-trained VLM throughout our experiments and report results averaged over 3 runs. We fine-tune the model with 16 samples per class in a few-shot setting (Zhou et al., ).
Following the corresponding official implementation, We list the general hyperparameters in Table 6.
Here, we briefly introduce the corresponding exclusive hyperparameters of each VLM tuning method.
All the methods are adopted from their official implementation. For CoOp and CoCoOp, they do not contain other hyperparameters.
For KgCoOp, we set $\lambda=8.0$.
For MaPLe, we set prompt depth $J$ to 0 and the language and vision prompt lengths to 2.
For DePT, the learning rate for updating the parameters in the devised CAT head is set to $6.5\times\delta$.
where $\delta$ is the adopted learning rate of CoOp.
Moreover, the weight in the linear probe is set to 0.7.
For TCP, the weight for prompt fusion is 1.0, and the loss weight is the same as KgCoOp.
For CLIP-adapter, we set $\alpha$ to 0.6, which is a trade-off hyperparameter between fine-tuned and zero-shot visual representation.
Finally, following MaPLe, we set the context length to 8.0 and prompt depth to 12 for VPT.

## Appendix C Outiler Selection

In this section, we present the detailed results for the dynamic outlier selection.
Specifically, we select nouns from WordNet that do not overlap but share higher-level concept relations with the base classes seen in the fine-tuning task.
We use the textual encoder of zero-shot CLIP as the modality encoder.

As is shown in Table 7, we can conclude that the selected outlier meets our requirement.
For example, if our base class contains certain aircraft models such as ’A340-600’, ’A380’, and ’ATR-72’, the outliers we selected include words like ’air_transport’, ’air_transportation’, and ’military_plane’. These nouns are highly relevant to the downstream task but do not overlap with the base class.
For further influence, we show that using outliers that are relevant but do not overlap with our fine-tuning task are helpful in reducing calibration error while preserving performance in the base classes.
To verify it, we empirically demonstrate that using base classes as the regularization may sacrifice its accuracy and calibration in Figure 4.
Moreover, as is shown in Table  5, dynamic text is better than fixed text since the fixed number of text may cause the model to overfit them.

**Table 7: Outlier selection from WordNet based on zero-shot CLIP.**
| Dataset | Base class | Selected outlier |
| --- | --- | --- |
| Flowers102 | [’pink primrose’, ’hard-leaved pocket orchid’, ’sweet pea’,<br>’english marigold’, ’tiger lily’, ’moon orchid’, ’bird of paradise’,<br>’monkshood’, ’globe thistle’, ’snapdragon’, "colt’s foot", ’king<br>protea’, ’spear thistle’, ’yellow iris’, ’globe-flower’,<br>’purple coneflower’, ’peruvian lily’, ’balloon flower’] | [’May_lily’, ’flowering_plant’, ’dayflower’, ’coast_lily’,<br>’flower’, ’lily’, ’orchid’, ’African_lily’,<br>’non-flowering_plant’, ’plant’, ’sego_lily’, ’plant_material’,<br>’flower-of-an-hour’, ’flora’, ’liliaceous_plant’, ’Liliaceae’,<br>’apetalous_flower’, ’tongueflower’, ’herbaceous_plant’, ’daisybush’] |
| OxfordPets | [’abyssinian’, ’american_bulldog’, ’american_pit_bull_terrier’,<br>’basset_hound’, ’beagle’, ’bengal’, ’birman’, ’bombay’, ’boxer’,<br>’british_shorthair’, ’chihuahua’, ’egyptian_mau’,<br>’english_cocker_spaniel’, ’english_setter’, ’german_shorthaired’] | [’spaniel’, ’bulldog’, ’dog’,<br>’dog_do’, ’doggie’, ’doggy’, ’domestic_dog’,<br>’canine’, ’pug-dog’, ’pooch’, ’Japanese_spaniel’,<br>’Labrador_retriever’, ’sausage_dog’, ’Labrador’, ’Little_Dog’,<br>’housedog’, ’CAT’, ’retriever’, ’French_bulldog’, ’bird_dog’] |
| StanfordCars | [ ’2012 Acura RL Sedan’, ’2012 Acura TL Sedan’,<br>’2008 Acura TL Type-S’, ’2012 Acura TSX Sedan’,<br>’2001 Acura Integra Type R’, ’2012 Acura ZDX Hatchback’] | [’estate_car’, ’automotive_vehicle’, ’sedan’, ’used-car’,<br>’tesla’, ’Tesla’, ’pickup_truck’, ’car’, ’SUV’,<br>’hatchback’, ’subcompact_car’, ’patrol_car’, ’station_wagon’,<br>’sports_car’, ’sport_utility_vehicle’, ’passenger_vehicle’,<br>’secondhand_car’, ’vehicle’, ’sport_car’, ’touring_car’] |
| FGVCAircraft | [’707-320’, ’727-200’, ’737-200’, ’737-300’, ’737-400’, ’737-500’,<br>’747-200’, ’747-300’, ’747-400’, ’757-200’, A340-600’, ’A380’,<br>’ATR-72’, ’BAE 146-200’, ’BAE 146-300’, ’BAE-125’, ’Beechcraft<br>’Boeing 717’, ’C-130’, ’C-47’, ’CRJ-200’, ’CRJ-700’, ’CRJ-900’,<br>’Cessna 172’, ’Cessna 208’, ’Cessna 525’] | [’airliner’, ’widebody_aircraft’, ’aircraft’, ’airbus’, ’jetliner’,<br>’wide-body_aircraft’, ’jumbojet’, ’air_transport’,<br>’narrow-body_aircraft’, ’multiengine_airplane’, ’airline’,<br>’attack_aircraft’, ’reconnaissance_plane’, ’air_transportation’,<br>’military_plane’, ’aeroplane’, ’plane’, ’multiengine_plane’, ] |
| Food101 | [’apple_pie’, ’baby_back_ribs’, ’baklava’,<br>’beef_carpaccio’, ’beef_tartare’, ’beet_salad’, ’beignets’,<br>’bibimbap’, ’bread_pudding’, ’breakfast_burrito’, ’bruschetta’,<br>’caesar_salad’, ’cannoli’, ’caprese_salad’, ’carrot_cake’, ’ceviche’,<br>’cheese_plate’, ’cheesecake’, ’chicken_curry’, ’chicken_quesadilla’, | [’entree’, ’pastry’, ’bread’, ’breakfast_food’, ’food’,<br>’salad’, ’burger’, ’Burger’, ’dessert’, ’soup’,<br>’French_pastry’, ’sandwich’, ’steak’, ’meat’, ’pizza’,<br>’cuisine’, ’pie’, ’PIE’, ’French_bread’, ’dish’] |
| UCF101 | [’Apply_Eye_Makeup’, ’Apply_Lipstick’, ’Archery’, ’Baby_Crawling’,<br>’Balance_Beam’, ’Band_Marching’, ’Baseball_Pitch’,<br>’Basketball’, ’Basketball_Dunk’, ’Bench_Press’, ’Biking’] | [’weightlifting’, ’athletics’, ’sports_implement’, ’hitting’,<br>’physical_exercise’, ’near_thing’, ’athletic_competition’, ’phot’,<br>’depicting’, ’fitness’, ’athletic_game’, ’physical_fitness’,<br>’batting’, ’goal’, ’musical_style’, ’photography’, ’going’] |

## Appendix D Detailed Experimental Results of fine-tuned VLMs

In this section, We present the detailed results of accuracy and Expected Calibration Error (ECE) to verify the effectiveness of our proposed DOR in Table 8(b)-9(b).

### D.1 ECE

**Table 8: ECE (%) comparison of existing prompt tuning in the base-to-new generalization.**
| Methods | Caltech101 | Pets | Cars | Flowers | Food101 | FGVC | SUN397 | DTD | EuroSAT | UCF101 | ImageNet | AVG |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ZeroshotCLIP | 6.49 | 2.25 | 3.74 | 3.11 | 1.57 | 3.03 | 1.59 | 4.53 | 8.35 | 3.24 | 1.51 | 3.58 |
| CoCoOp | 1.45 | 2.32 | 6.61 | 7.67 | 1.10 | 3.41 | 1.66 | 2.61 | 8.06 | 2.08 | 2.66 | 3.60 |
| CoCoOp+DOR | 2.20 | 2.97 | 6.85 | 8.49 | 0.97 | 3.33 | 3.19 | 2.86 | 10.12 | 2.96 | 2.52 | 4.22 |
| CoOp | 0.95 | 0.96 | 2.59 | 2.38 | 2.79 | 5.84 | 4.57 | 6.73 | 1.50 | 4.04 | 1.38 | 3.07 |
| CoOp+DOR | 1.59 | 1.78 | 4.20 | 4.90 | 0.63 | 3.35 | 0.87 | 5.81 | 2.66 | 1.61 | 1.96 | 2.67 |
| DEPT | 2.22 | 6.83 | 12.08 | 7.75 | 5.41 | 5.23 | 2.90 | 3.29 | 8.26 | 3.32 | 9.15 | 6.04 |
| DEPT+DOR | 2.95 | 8.32 | 13.37 | 10.26 | 7.04 | 6.51 | 5.55 | 4.78 | 9.50 | 5.08 | 10.96 | 7.67 |
| KgCoOp | 2.30 | 2.95 | 11.42 | 10.05 | 1.35 | 5.40 | 4.69 | 8.02 | 10.97 | 4.18 | 2.65 | 5.82 |
| KgCoOp+DOR | 2.48 | 2.96 | 11.02 | 10.19 | 1.39 | 7.64 | 4.84 | 8.34 | 11.03 | 4.32 | 2.57 | 6.07 |
| MaPLe | 1.21 | 2.09 | 5.81 | 4.23 | 0.82 | 3.46 | 1.04 | 4.34 | 3.53 | 1.77 | 1.95 | 2.75 |
| MaPLe+DOR | 1.84 | 2.05 | 6.49 | 4.47 | 0.86 | 2.40 | 2.28 | 2.32 | 4.44 | 3.08 | 2.02 | 2.93 |
| TCP | 1.99 | 2.44 | 8.93 | 6.83 | 1.56 | 5.28 | 2.64 | 6.83 | 9.58 | 3.58 | 2.12 | 4.71 |
| TCP+DOR | 2.03 | 2.46 | 9.34 | 7.10 | 1.63 | 5.28 | 2.90 | 6.52 | 9.84 | 3.48 | 2.09 | 4.79 |

### D.2 Accuracy

**Table 9: Accuracy (%) comparison of existing prompt tuning in the base-to-new generalization.**
| Methods | Caltech101 | Pets | Cars | Flowers | Food101 | FGVC | SUN397 | DTD | EuroSAT | UCF101 | ImageNet | AVG |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ZeroshotCLIP | 97.16 | 91.33 | 63.57 | 71.79 | 90.06 | 27.73 | 69.36 | 53.01 | 57.00 | 70.99 | 72.39 | 69.49 |
| CoCoOp | 97.79 | 94.84 | 70.46 | 95.22 | 90.55 | 35.71 | 79.45 | 77.20 | 87.48 | 81.64 | 75.93 | 80.57 |
| CoCoOp+DOR | 97.87 | 95.18 | 69.72 | 93.41 | 90.42 | 34.61 | 79.02 | 75.43 | 86.16 | 81.28 | 75.70 | 79.89 |
| CoOp | 98.21 | 93.85 | 79.70 | 98.01 | 87.72 | 42.08 | 80.29 | 80.71 | 92.01 | 84.18 | 75.89 | 82.97 |
| CoOp+DOR | 98.13 | 94.63 | 78.11 | 97.44 | 89.78 | 42.26 | 81.30 | 79.98 | 91.39 | 85.54 | 76.61 | 83.20 |
| DEPT | 98.15 | 93.43 | 80.01 | 98.48 | 89.76 | 44.10 | 81.33 | 82.18 | 91.45 | 85.47 | 76.31 | 83.70 |
| DEPT+DOR | 98.32 | 94.05 | 79.88 | 98.45 | 90.08 | 44.44 | 81.88 | 82.37 | 90.09 | 85.75 | 76.64 | 83.81 |
| KgCoOp | 97.76 | 94.97 | 75.50 | 96.55 | 90.66 | 37.74 | 80.90 | 81.13 | 89.51 | 84.37 | 76.05 | 82.29 |
| KgCoOp+DOR | 97.78 | 94.97 | 74.68 | 96.04 | 90.63 | 39.56 | 80.14 | 80.83 | 88.95 | 84.02 | 75.81 | 82.13 |
| MaPLe | 97.93 | 95.60 | 72.54 | 96.65 | 90.61 | 36.67 | 80.91 | 79.98 | 91.61 | 83.75 | 76.91 | 82.11 |
| MaPLe+DOR | 98.00 | 95.04 | 71.60 | 95.44 | 90.64 | 35.59 | 80.92 | 80.17 | 92.31 | 84.16 | 76.74 | 81.87 |
| TCP | 98.17 | 94.59 | 79.91 | 97.91 | 90.68 | 42.20 | 82.65 | 82.72 | 89.98 | 87.19 | 77.49 | 83.95 |
| TCP+DOR | 98.10 | 94.59 | 80.23 | 97.98 | 90.62 | 41.50 | 82.62 | 82.48 | 90.65 | 86.69 | 77.37 | 83.89 |

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: Please refer to the weakness part.
soundness: 2
strengths: 1. A new blind point was identified (CoOp and KgCoOp becomes over/under confident)
2. Experimental results show performance improvement when the proposed regularizer is added.
summary: This paper, through CoOp and KgCoOp, observe that when a model undergoes adaptation via prompt tuning, CoOp tends to be overconfident in novel classes, while KgCoOp, on the contrary, becomes underconfident. To address this tendency towards overconfidence/underconfidence, this paper propose a Dynamic Outlier Regularizer (DOR) term, which demonstrates performance improvements when the proposed regularizer is added to the algrorithms for prompt learning of VLMs.
weaknesses: 1. The motivation was inferred from CoOp and KgCoOp, but in fact, these two algorithms lack adequate consideration for novel classes. For an effective analysis of this phenomenon, algorithms that directly account for novel classes should be utilized, such as CoCoOp, MaPLe, PromptSRC, DEPT, and TCP. If similar tendencies are observed in these algorithms, it would strongly support the authors' claim.

2. It appears that further explanation is needed regarding the concept of "Texture divergence." From my understanding, this divergence is due to the diversity of textual representation arising from CoOp's prompt learning method. However, finding concrete evidence to confirm this explanation is challenging. Additionally, a more detailed explanation of the notation, particularly the keywords emphasized in the paper, would enhance reader's understanding if the study.

3. More comparisons with other algorithms are necessary. Given the large number of prompt learning algorithms, further experimental comparisons are needed to confirm whether the effect of this regularizer is generalizable. (Similar with the first weakness statement)

---

confidence: 5
contribution: 1
initial_rating: 3
presentation: 2
questions: See the weakness section.
soundness: 2
strengths: - The paper identifies a relevant issue in the domain of prompt tuning and confidence calibration in VLMs, an area of growing importance.
- The authors introduce a novel idea of using dynamically sampled textual outliers to address calibration inconsistencies, and the approach shows effectiveness across various datasets.
- DOR’s flexibility in working with multiple prompt-tuning methods is a potential advantage.
summary: This paper proposes Dynamic Outlier Regularization (DOR) to improve confidence calibration in prompt-tuned vision-language models (VLMs), particularly in CLIP. The authors argue that current prompt-tuning methods lead to miscalibration by creating a trade-off between base and new classes, with CoOp overconfident on new classes and KgCoOp underconfident on base classes. DOR aims to resolve this trade-off by introducing textual outliers to regularize model predictions, promoting consistent calibration across both base and new classes.
weaknesses: - The paper does not include comparisons with several recent and closely related methods, such as CoPrompt and PromptSRC, which also address calibration issues and trade-offs between base and new classes. Without these comparisons, it is unclear whether DOR provides any substantial advantage over the state of the art, especially since these methods were specifically designed to tackle the same calibration challenges.

- The primary claim—that prompt-tuning methods like CoOp and KgCoOp introduce calibration trade-offs between base and new classes—has already been extensively studied in prior works. For instance, CoPrompt effectively handles these issues and includes mechanisms specifically designed to manage calibration across both class types. As such, the problem statement lacks novelty, and the paper provides insufficient rationale for why DOR would be preferable to these existing methods.


- While the paper offers some empirical evidence for DOR’s effectiveness, it lacks analysis that explains why the use of textual outliers should systematically address calibration trade-offs. 

- The proposed solution, while conceptually interesting, lacks practical guidelines on how to effectively select and implement outliers in a real-world setting. Given that the efficacy of DOR relies on appropriate textual outlier selection, more detailed criteria or algorithms for selecting these outliers would be necessary for practitioners to adopt this method.

- Interestingly, some of the latest methods show less improvement with the proposed solution compared to some of the earlier methods like CoOp. This indicates that the latest methods are already capable of handling the problem and don't require such a solution proposed in this paper. Again, the paper lacks a comparison to the latest method, making it difficult to understand if it has any usage.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. When you calculate the semantic similarity between textual labels in WordNet and the base classes, do you use cosine similarity? Please Clarify. Would using a different metric (e.g. Euclidean distance) impact results?
2. The outliers​ are selected based on the top-K, but there’s no mention of a specific similarity threshold. Would setting a threshold affect performance?
3. How frequently are the outliers updated during training? Does the frequency affect DOR’s calibration performance?
4. In page 8, line 407-408, is it a typo (should be "CoCoOp" ranther than "CoOp") or a wrong statement (the number is wrong if you campred to the zero-shot CLIP)? Please correct it.
5. What criteria were used to select visual outliers from ImageNet-1K? How to ensure these outliers are sufficiently distinct from base classes without introducing irrelevant noise?
6.  How does DOR influence the feature space of base classes when incorporating visual outliers?
soundness: 2
strengths: 1. DOR integrates smoothly with popular prompt-tuning methods (e.g., CoOp, KgCoOp) without requiring major architectural changes, making it easy to adopt in existing pipelines. 
2. The authors provided insightful analysis of how current prompt-tuning methods impact confidence calibration, with clear explanations for why overconfidence or underconfidence arises in certain settings. The motivation is clear.
3. The manuscript is well-written and in a good logic.
summary: This paper introduces Dynamic Outlier Regularization (DOR), a method to improve confidence calibration in fine-tuned VLMs by controlling textual feature divergence (also can be extended to visual tuning) through the use of selected outliers, thereby enhancing model reliability on both base and novel classes.
weaknesses: 1. The ablation study is insufficient, e.g. how sensitive DOR is to the choice of outliers and whether different selection strategies could yield better results?
2.  The experiments are largely limited to standard benchmarks without applying the method to domain-specific tasks (e.g., medical imaging or autonomous systems as the authors mentioned in the Introduction), where calibration is especially critical.

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 3
questions: See above.
soundness: 3
strengths: 1. The author conducted robust experiments that demonstrate how prompt fine-tuning prior to happiness can lead to a decline in the model's calibration performance.

2. The paper introduces an efficient normalization method designed to enhance the calibration performance of both base and novel classes.

3. The paper provides performance results across multiple calibration evaluation metrics and a range of experimental settings.

4. The writing is clear and well-structured, making it easy to read.
summary: This paper investigates the calibration performance of CLIP following fine-tuning. The author observes a trade-off in calibration between base and new classes and proposes a method called Dynamic Outlier Regularization (DOR). DOR samples categories unrelated to the base class from a large vocabulary to minimize the feature deviation of novel textual labels. Empirical results demonstrate that this approach outperforms the standard fine-tuning method across various settings.
weaknesses: 1. Previous works [1,2] have examined the calibration performance of pre-trained CLIP after fine-tuning. However, your paper lacks experimental results comparing your method with these studies. We recommend that you include such comparisons in your work.
2. Given that your method is based on experimental observations from CoOp and KgCoOp, we have concerns about its generalizability. For example, in Table 1, your method underperforms compared to Vanilla TCP in half of the settings.
3. This article primarily selects outliers from WordNet. We are curious whether using different lexical databases significantly affects the results.

If you can include relevant experiments and address my questions, I will consider increasing the score.

[1] Enabling Calibration In The Zero-Shot Inference of Large Vision-Language Models.

[2] Towards Calibrated Robust Fine-Tuning of Vision-Language Models.

Meta-review: This submission introduces Dynamic Outlier Regularization (DOR) to enhance confidence calibration in prompt-tuned vision-language models (VLMs), with a specific focus on CLIP. DOR primarily leverages textual outliers from WordNet to regularize model predictions, aiming to ensure consistent calibration across both base and novel classes. However, after reviewing the feedback and author rebuttals, the area chair is inclined to reject the paper, as the experimental improvements are marginal and the integration of WordNet-derived outliers may not be practical for real-world applications.

Decision: Reject