Towards Calibrated Robust Fine-Tuning of Vision-Language Models

Improving out-of-distribution (OOD) generalization during in-distribution (ID) adaptation is a primary goal of robust fine-tuning of zero-shot models beyond naive fine-tuning. However, despite decent OOD generalization performance from recent robust fine-tuning methods, confidence calibration for reliable model output has not been fully addressed. This work proposes a robust fine-tuning method that improves both OOD accuracy and confidence calibration simultaneously in vision language models. Firstly, we show that both OOD classification and OOD calibration errors have a shared upper bound consisting of two terms of ID data: 1) ID calibration error and 2) the smallest singular value of the ID input covariance matrix. Based on this insight, we design a novel framework that conducts fine-tuning with a constrained multimodal contrastive loss enforcing a larger smallest singular value, which is further guided by the self-distillation of a moving-averaged model to achieve calibrated prediction as well. Starting from empirical evidence supporting our theoretical statements, we provide extensive experimental results on ImageNet distribution shift benchmarks that demonstrate the effectiveness of our theorem and its practical implementation.

Paper

Similar papers

Peer review

Reviewer yVZD4/10 · confidence 5/52024-07-10

Summary

The paper proposes a novel framework for robust fine-tuning for CLIP. To enhance out-of-distribution accuracy and calibration, the author incorporates a singular-based constraint term, self-distillation, and EMA. Extensive experiments on synthesized data and ImageNet demonstrate that CaRot can achieve better OOD performance and reliable predictions.

Strengths

1. This paper investigates an under-explored but important problem, the calibration of CLIP after fine-tuning. 2. The theoretical analysis between the smallest singular value of image representation and OOD robustness is good.

Weaknesses

1. The overall framework is not well-motivated. Why do we need to incorporate self-distillation and exponential moving average (EMA)? These two techniques are not the main contributions of this paper and are not directly relevant to the primary theoretical analysis of singular value constraints. 2. The connection to Vision-Language Models is weak. The paper does not justify why the proposed soft constraint term is specifically tailored to Vision-Language Models like CLIP. In other words, does this regularization only apply to visual language models? 3. The result analysis is insufficient. The paper does not report the average confidence level, which may lead to the confusion that the calibration improvement may only come from the accuracy improvement.

Questions

1. Can the proposed singular value-based constraint improve other fine-tuning methods, such as FLYP or WISE-FT?

Rating

4

Confidence

5

Soundness

2

Presentation

2

Contribution

3

Limitations

No

Reviewer yVZD2024-08-11

Thanks for the response, and some of my concerns have been addressed. However, I still have the following two concerns: 1. The main issue in this paper is the calibration for CLIP. However, the connection between the proposed method and vision-language model (CLIP) is still weak. I think that the proposed method can be applied to most classification models and is not limited to CLIP. 2. The calibration improvement brought by CaRot seems to come only from accuracy improvement. It does not address the overconfidence issue of CLIP caused by fine-tuning. For example, in Table 2 of the attachment, compared to the baseline, the accuracy of FT increased by 4%, but the ECE only decreased by 3%. Hence, It appears that CaRot is merely a method to improve accuracy rather than a confidence calibration method. I will keep my original rating. Best regards, yVZD

Authorsrebuttal2024-08-12

Dear reviewer yVZD, We are delighted that some of your concerns have been addressed. For the remaining concerns, * [first concern] As you have pointed out from the original review, we have derived our theory in a common classification setting which is not confined to the vision-language model for the generality of the theoretical statement, and we observe that our OOD error bound-based regularization method is also effective on a vision-only model during the rebuttal. * About the connection between VLM and the proposed method, as described in Section 4.1. of the draft, our orthogonality constraint on the visual projection layer is seamlessly combined with a multimodal contrastive loss so that enables it to be interpreted as a constrained singular value decomposition (SVD) on the cross-covariance matrix of image-text representation pairs. * We appreciate you found that our theory and corresponding method have broad potential applications, and respect your worry. we will reflect your comment to refine the presentation of our revised manuscript. Thanks again. * [second concern] We would like to respectfully refute your claim: is CaRot's improved confidence calibration merely due to accuracy improvement? * Allow us to clarify that Table 2 of the attachment is the ablation study of the orthogonality constraint (OC) on FLYP and WiSE-FT, which shows the consistent effect of OOD improvement of OC. **The result of CaRot is not included in that table**. We attached the Table with the results of CaRot below, and demonstrate that **CaRot improves OOD accuracy and ECE as 5.05 (8.7%) and 0.1395 (63.8%). Thus the improvement in terms of ECE is far more significant than the improvement in accuracy.** | Method | WiSE-FT | ID Acc | ID ECE | OOD Acc | OOD ECE | |------------|---------|--------|--------|---------|---------| | FT | X | 81.53 | 0.0884 | 57.50 | 0.2186 | | FT w/ OC | X | 81.45 | 0.0826 | 59.10 | 0.2051 | | FLYP | X | 82.69 | 0.0635 | 59.46 | 0.1831 | | FLYP w/ OC | X | 82.51 | 0.0651 | 59.51 | 0.1803 | | FT | O | 82.16 | 0.0820 | 61.22 | 0.1920 | | FT w/ OC | O | 82.03 | 0.0770 | 61.97 | 0.1829 | | FLYP | O | 82.98 | 0.0798 | 61.27 | 0.1788 | | FLYP w/ OC | O | 82.80 | 0.0627 | 61.41 | 0.1682 | | **CaRot** | X | 83.13 | 0.0470 | 62.55 | 0.0791 | * [second concern] Meanwhile, we partly agree with your statement that improvement in accuracy could contribute to calibration (or vice versa) somewhat. **However, even though the accuracy and calibration are correlated sometimes, they are not a causality.** For example, Figure 2 of Guo et al. 2017 shows that improved accuracy hurts calibration, and Table 1 of Levine et al. presents that CLIP ViT-H-14 and CLIP ViT-B-16 have worse calibration than CLIP ViT-L-14 and CLIP ViT-B-32, respectively, even though they achieve far better classification accuracy. Figure 9 of Dehghani et al. also implies that increased accuracy does not result in improvement in calibration. * We observe the same evidence in Figure 6 of the attached PDF file under our experimental setup. For instance, from the left-most point of FT to the left-most point of FLYP, Accuracy is roughly improved from 81.0 to 82.0 (+1.2%), but the ECE is increased (`worsen`) from 0.06 to 0.08 (+33.3%). Meanwhile, CaRot achieves Accuracy and ECE of 83.0 (+2.4%) and 0.05 (-20%; `become better`). This indicates that **CaRot is not just a method for accuracy improvement, but it is a method for accuracy and calibration simultaneously in a single theory-motivated framework.** ### Reference 1. Guo et al. 2017, On Calibration of Modern Neural Networks 2. Levine et al. 2023, ENABLING CALIBRATION IN THE ZERO-SHOT INFER- ENCE OF LARGE VISION-LANGUAGE MODELS 3. Dehghani et al. 2023, Scaling Vision Transformers to 22 Billion Parameters We thank you again for the reviewer yVZD's intensive commitment to reviewing our paper and we appreciate valuable comments that contribute to improving the quality of our draft. Best regard

Authorsrebuttal2024-08-14

Sincerely looking forward to your feedbacks

Dear Reviewer yVZD, We would like to express our huge gratitude for your invaluable comments so far. Your comment has definitely improved the quality of our manuscript and led us to refine our statement further. For now, we are wondering if our responses address your remaining concerns. Could you check our responses by any chance? * We clarify that our theory is not confined to VLM for its generality and broader impact, but our method—integration of multimodal contrastive learning with orthogonality constraint—enables us to interpret our method as a constrained singular value decomposition on the cross-covariance matrix of image-text representation pairs (Please refer to Section 4.1 of our manuscript) during fine-tuning of VLM. * Regarding your second concern, we provide counter-examples showing that improved accuracy does not translate to better calibration (with some references) and clarify the experiment results to fix misunderstanding, thereby demonstrating that our CaRot is not just an accuracy-improving method but also promotes non-trivial confidence calibration. If these replies address your concerns, could we politely ask you to reconsider your rating on our paper? Sincerely, The Authors

Reviewer a8to6/10 · confidence 3/52024-07-10

Summary

his paper aims to improve the accuracy and reduce the calibration error on OOD data for fine-tuning VLM models. The authors first demonstrate that the OOD calibration error and the OOD classification error can be bounded by the ID calibration error and the smallest singular value of the ID input covariance matrix. To address this, the authors apply orthogonal regularization to increase the smallest singular value and use self-distillation to improve the ID calibration. Several experiments on distribution-shifted datasets validate the effectiveness of the proposed method.

Strengths

The paper is well-organized and clearly presented. The theoretical finding that OOD accuracy and calibration error can be bounded by ID error and the smallest singular value is both novel and insightful. The proposed fine-tuning method is simple and intuitive. Numerical analysis of the error bounds and empirical validation on ImageNet OOD benchmarks make the proposed method convincing.

Weaknesses

(1) Some of the notations are misleading. In line 86, the subscript of $x$ denotes the $n$-th sample in $\mathcal{D} $. However, in line 113, the subscript of $x$ denotes the value of the $i$-th dimension of $x$. (2) Some of the assumptions are not realistic. In line 113, the authors suppose the hypothesis $h_i$ is a one-dimensional function, each applying to one dimension of the input, which does not hold most of the time. Besides, the authors assume each dimension pair is Gaussian. I am unsure whether the conclusion of Theorem 3.1 still holds if these two assumptions are violated. (3) The orthogonal constraint is too strong. The finding of Theorem 3.1 states that lifting the smallest singular value is enough to reduce calibration and classification errors. However, the authors implement an orthogonal constraint in the learning procedure, enforcing the features to be an orthogonal basis, which leads to a smaller largest singular value. In Table 3, we can see that applying such regularization alone reduces ID accuracy. I wonder whether applying a regularization that only increases the smallest singular value could achieve higher performance.

Questions

Please refer to the weaknesses.

Rating

6

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

Limitations have been discussed and no negative societal impact has been identified.

Authorsrebuttal2024-08-12

Dear reviewer a8to, 1. We truly appreciate your suggestion on fixing notation, clarifying assumptions of the theory, and discussing potential alternative design choices of constraint terms. We promise to update our manuscript thoroughly, as you pointed out, and this will significantly refine the presentation quality from now on. 2. We also appreciate your further interest in the behavior of orthogonality constraint (OC) and the consideration of raising the score! Allow us to clarify the experimental setup for Table 3 and Table 4 of our manuscript. The left side of **Table 4 is the results of the ablation study where the self-distillation (SD) regularization term is applied with a 1.5 multiplier**. That is, the first and third rows of Table 4 are equal to the seventh and eighth rows of Table 4. For a clear comparison, we insert a table below that includes results with and without SD under varying OC magnitudes. Meanwhile, As you can see **by comparing the first and second, and the fifth and sixth rows of Table 3, orthogonality constraint (`without SD term`) slightly tradeoffs ID accuracy**. This phenomenon is also observed through additional ablation studies with the WiSE-FT method in Table 3 of the rebuttal attachment PDF. | Objective | OC | ID Acc | ID ECE | OOD Acc | OOD ECE | |-----------|-----|--------|--------|---------|---------| | MCL | 0 | 82.69 | 0.0635 | 59.40 | 0.1836 | | MCL | 0.1 | 82.48 | 0.0652 | 59.41 | 0.1807 | | MCL | 0.2 | 82.51 | 0.0651 | 59.51 | 0.1803 | | MCL w/ SD | 0 | 83.03 | 0.0523 | 62.28 | 0.0772 | | MCL w/ SD | 0.1 | 83.18 | 0.0511 | 62.42 | 0.0779 | | MCL w/ SD | 0.2 | 83.13 | 0.0470 | 62.55 | 0.0791 | **Therefore, we derive non-contradictive conclusions from Tables 3 and 4 of the manuscript, indicating that orthogonality constraint alone somewhat compromises ID adaptation capability for OOD generalization, while this tradeoff is mitigated when the SD is applied together, which is our final learning objective.** We speculate that, 1) When the orthogonality constraint is applied alone, the model is enforced to capture diverse features for OOD generalization yet without any restriction on the type and priority of learned features. While this contributes to enhancing OOD generalization, **diverse features without prioritization might compromise strong ID performance.** 2) However, the SD regularization produces input-dependent soft labels that hold similarity structures between classes. This allows the model to learn diverse features while **putting a higher priority on features shared across similar classes** (judged by the EMA teacher model) so that the features are beneficial not only for OOD generalization but also for ID adaptation. We can understand the joint use of the orthogonality constraint and self-distillation regularization induces a narrower solution set, which potentially induces better generalization (Huh et al. 2024). [Huh et al. 2024] The Platonic Representation Hypothesis Thanks again for your constructive comment so far. Best regard

Reviewer a8to2024-08-13

The authors have addressed my concerns effectively, and I have increased my score accordingly.

Reviewer nZD26/10 · confidence 3/52024-07-12

Summary

VLMs have shown to be effective in a wide-area of applications, though they can fail under certain domain shifts. In this work, the authors first observe that the the upper bound of generalization and calibration under domain shifts is bounded by the ID calibration error and the smallest singular value of the ID covariance matrix. Building upon this intuition, the authors then propose a novel fine-tuning scheme for VLMs in the shape of a contrastive objective and a self-distillation technique. Experimental evaluation on Imagenet and quite a few of its variants are presented to show the effectiveness of the proposed approach.

Strengths

- The motivation for the work is neatly presented with a clear link between the motivation and the proposed method. While the exact method does not depend on Theorem 3, it is still a good way to explain why the proposed method can serve as a proxy to reduce OoD unreliability of the models. Sections 3 and 5.1 are really helpful in this regard. - Throughout the work, the design choices are explained clearly in a technically sound manner with intuitive connections being made between the utilized concepts and the math behind. - The experimental benchmarks chosen for evaluation seems to be adequate as it involves a rather wide range of Imagenet variants, from those that are much more similar to Imagenet like ImagenetV2 to Imagenet-S. From the results of these experiments, it can be seen that the proposed method mostly brings significant improvements for the domain-shift settings.

Weaknesses

- In certain cases, such as Imagenet-R on Table 2 and 3, it appears that the zero-shot CLIP is better than _any_ of the fine-tuning methods including the proposed approach in terms of _both_ the accuracy and calibration. Furthermore, the calibration after fine-tuning with CaRoT is worse than the zero-shot CLIP under harsher domain-shift benchmarks, namely the ObjectNet, Imagenet-{A, S, R}. I wonder how would the Table 2 look like had the model had access to multiple training environments (e.g maybe having a subset of Imagenet-S during fine-tuning, then evaluated on Imagenet-R) as it is often the case for domain generalization benchmarks [A]. - On Tables 2 and 3, the proposed approach seems to be falling behind of the other methods in terms of Imagenet accuracy, which may limit its usefulness for a wider range of applications. - It would have been good to have Imagenet-C [B] here as well, as it is perhaps the most commonly used among these variants for domain shift benchmarking. In particular, having some analyses based different types of corruptions and under different severity levels could have provided more insights into the limitations and strengths of the proposed approach. - One of the minor issues I can see with the work is regarding the usage of the term "OOD", especially since the benchmarks used vary significantly from Imagenet-V2 (which was designed to be distributionally as similar as possible to the original Imagenet) to Imagenet-S. While I acknowledge that the authors clarify what they mean under Section 2, I still encourage them to check out [C] for a nice template on works involving the term. [A] Guljarani et al., "In search of lost domain generalization", ICLR 2021 [B] Hendrycks et al., “ Benchmarking Neural Network Robustness to Common Corruptions and Perturbations”, ICLR 2019 [C] Farquhar et al., "What ‘Out-of-distribution’ Is and Is Not", NeurIPS-W 2022

Questions

I wonder what the authors think about the first weakness I have described above and it would be great to see detailed Imagenet-C results.

Rating

6

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

The limitations are somewhat discussed in the conclusion. I appreciate the fact that they have stated that they could not include larger models due to computational constraints which prompted me to avoid asking for how the proposed method would perform with larger models trained with much larger data.

Authorsrebuttal2024-08-11

We are so delighted that our rebuttal addresses your concerns and questions! Thank you for your valuable comments and for taking the time to review our paper thoroughly.

Reviewer g5ML5/10 · confidence 2/52024-07-15

Summary

This research paper presents a novel fine-tuning approach for improving out-of-distribution (OOD) generalization and calibration in Vision Language Models (VLMs). By identifying a shared upper bound for OOD accuracy and calibration errors, the authors develop a constrained multimodal contrastive loss framework enhanced by self-distillation. Empirical validation and tests on ImageNet benchmarks demonstrate the method's effectiveness in enhancing both OOD accuracy and calibration error.

Strengths

- The proposed approach is well motivated by theory. The connection of out-of-distribution (OOD) generalization and calibration in terms of the smallest singular value of the input covariance matrix of in-distribution (ID) data is interesting and novel to my knowledge. - The experiments are extensive and the results are good on both fronts.

Weaknesses

- The theory part is a bit obscure. Is there an intuitive interpretation of the smallest singular value of ID input covariance matrix in the studied context? How tight is the upper bounds (Theorem 3.1)? - Were the main experiments repeated multiple times? If so, can the authors provide the error bars for the main experiments? 
- The paper limits the scope to VLM fine-tuning, but does it also apply to fine-tuning other kinds of models?

Questions

Please see the weaknesses.

Rating

5

Confidence

2

Soundness

3

Presentation

3

Contribution

3

Limitations

The authors discussed one limitation of the work. I don't notice any potential negative societal impact.

Authorsrebuttal2024-08-08

Thank you for your active query! ### 1. Rank comparison > Allow us to recap the rank of matrix multiplication, $\\text{rank}(AB) \\le \text{min}(\\text{rank}(A),\\text{rank}(B))$ where the equality only holds whether matrix $A$ or $B$ has full rank. Then, for the neural network representation of our case, **the post-projection feature always has a smaller rank compared to the pre-projection feature if the projection matrix $W$ is not full rank**. There is a solid theoretical background about this so-called **rank diminishing phenomenon** [Feng et. al 2022]. As you said, our constraint can't increase the rank of the pre-projection feature and just preserve it in the ideal case; however, this preservation induces the higher rank of the post-projection feature compared with the baseline, which does not encourage the projection matrix to be full-rank. Therefore, our method induces a higher effective rank of the feature covariance matrix compared to baseline methods, which do not enforce rank preservation, and our method induces learning of diverse features that contribute to better OOD generalization. _We really appreciate this valuable query, and will revise our manuscript to clarify further the connection between singular values, rank, and OOD generalization._ ### 2. Significance of performance gain We would like to emphasize that, in Table 2 of the attached PDF file, our orthogonal constraint, OC for short, **consistently improves the OOD accuracy and ECE in all 8 cases**, as well as a case of the toy experiment in the left side of Figure 3 in the manuscript. While the amount of improvement might be seen as small, we believe **this consistent improvement (9 out of 9) indicates strong evidence of the effectiveness of our theory-motivated rank-preserving constraint for OOD generalization**, which is complementary to the benefits from the FLYP or SD. Moreover, the amount of performance gain is sometimes significant, e.g., +1.6 in terms of accuracy of FT w/ and w/o OC, -0.01 in terms of ECE of FLYP-WiSE w/ and w/o OC. Please do not hesitate to ask us any further questions; we will be delighted to have an extended discussion with the reviewer g5ML. --- ### reference [Feng et al. 2022] Rank Diminishing in Deep Neural Networks

Reviewer g5ML2024-08-08

Thank you for the further clarifications. I get the idea that a higher effective rank of the feature covariance matrix implies higher feature diversity. However, I'm still confused about the role of minimizing $\lVert W_v W_v^T - I\rVert^2_F$ in achieving such a goal. Suppose $W_v = I$, which is the best we can get. This means the projection layer preserves the effective rank $r$ of the feature from the previous layer, so we have $r' = r$ where $r'$ is the effective rank of the projected feature. The question is, does this have any effect on $r$ itself? To me, it seems the answer is no because the effective rank $r$ of the pre-projection feature may be low even if $\lVert W_v W_v^T - I\rVert^2_F = 0$, i.e., they are independent. Empirically, the ablation study (Table 3) suggests that the proposed constraint, i.e., $\lVert W_v W_v^T - I\rVert^2_F = 0$, plays a small role. The main improvement is brought by FLYP and SD but they are not the main contribution of this work (as partly mentioned by Reviewer yVZD). Could the authors please further comment on this?

Reviewer nZD22024-08-10

I appreciate the hard work the authors have put into the rebuttal. They seem to have answered my points fairly well, especially with the detailed DomainBed and Imagenet-C experiments and visuals. I am increasing my score accordingly.

Authorsrebuttal2024-08-11

Further Suggestions for Improvement

Thank you for your detailed feedback and inquiry so far! Your comments were highly valuable to us. We have thoroughly addressed the issues raised by Reviewer g5ML. We believe these revisions will enhance our manuscript significantly. **We respectfully inquire if you could consider raising the score, given that all of your concerns are addressed. If not, we are interested in understanding if there are any additional concerns or suggestions that we could address to improve the submission further.** Again, we would like to express our gratitude for your commitment to reviewing our paper thoroughly and providing constructive feedback, which helps us refine our work.

Reviewer g5ML2024-08-11

My initial concerns are addressed and I really appreciate the authors' detailed, thoughtful responses. They helped me better understand the paper and see clearer its merits and defects. The reason I would like to keep my score is that the improvement brought by the proposed orthogonality constraint appears to be somewhat marginal. The constraint only deals with the loss of feature diversity at the last projection layer, disregarding potential losses at earlier stages, which are probably more consequential. For future improvement, I wonder if a similar constraint can be directly applied to the features themselves (as the theory implies) rather than the layer weights. Finally, the overall method, CaRot, feels like a naive combination of three separate components. In particular, as pointed out by Reviewer yVZD, the connection of the method to vision-language models is weak. Although the authors have presented further results on vision-only models, this does not fix the framing of the paper (fixing it would probably require a major revision). In all, while I am inclined to accept the paper, the impact of the paper in its current form may be limited so I think a borderline accept is adequate.

Authorsrebuttal2024-08-12

Dear Reviewer g5ML, We sincerely appreciate your further clarification, and we want to express our huge gratitude for the positive rating incline to acceptance! In this work, * we **provide a novel theoretical bound on both OOD generalization and calibration errors in a single unified formulation that solely requires ID-related terms**, i.e., ID calibration error and the smallest singular value of the ID covariance matrix. * **CaRot, which is designed to minimize this error upper bound, was extensively validated on the large-scale dataset across diverse backbones**. * Through the ablation studies, we confirm that the **adoptions of each component**, i.e., orthogonality constraint and calibration regularization, of CaRot **induce consistent improvements in the OOD generalization and calibration**. We respect your viewpoint on the effectiveness of the orthogonality term and thank you for the opinion of direct regularization on the feature singular value. While our orthogonality constraint was introduced to promote a larger smallest singular value of the feature covariance matrix, **it also allows us to view our multimodal contrastive loss as a constrained singular value decomposition (SVD) on the cross-covariance matrix of image-text representation pairs that helps interpretation of our method**. In Table 1. of the attached PDF, we included a result of the direct feature regularization method based on the singular value decomposition (SVD) and using the negative smallest singular value as an additional loss term. This method achieved promising outcomes in terms of OOD performance. We will further investigate the other direct constraint terms in future work. About your second concern 'weak linkage between the method and VLM, framing of paper', while the combination of each component has originality in terms of theoretical motivation and interpretation, we respect and will accommodate your opionion to increase the impact of our work. Thanks again for your invaluable feedback so far. We believe that our manuscript will be significantly improved. Best regard

Reviewer a8to2024-08-11

Dear Authors, Thank you for your detailed responses, which have addressed most of my concerns. I would like to kindly request that you revise the notations, add an explanation of the assumption of the one-dimensional function, and discuss other possible design choices for the smallest singular value regularization in the updated version. Before I raise my rating, I have one additional question regarding the ablation study in Table 4 and Table 3: In Table 3, applying orthogonal regularization seems to reduce ID accuracy. However, in Table 4,$\lambda_{OC} = 0.1$ results in higher ID performance than $\lambda_{OC} = 0$, which appears to contradict the conclusion of Table 3. Could you please further explain this discrepancy? Best regards,

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC