Robust fine-tuning aims to ensure performance on out-of-distribution (OOD) samples, which is sometimes compromised by pursuing adaptation on in-distribution (ID) samples. However, another criterion for reliable machine learning -- confidence calibration has been overlooked despite its increasing demand for real-world high-stakes applications, e.g., autonomous driving. We raise concerns about the calibration of fine-tuned vision-language models (VLMs) under distribution shift by showing that naive fine-tuning and even state-of-the-art robust fine-tuning hurt the calibration of pre-trained VLMs, especially on OOD datasets. We first show the OOD calibration error is bounded from above with ID calibration errors and domain discrepancy between ID and OOD. From this analysis, we propose CaRot, a calibrated robust fine-tuning method that incentivizes ID calibration and robust prediction across domains to reduce the upper bound of OOD calibration error. Extensive experiments on three types of distribution shifts (natural, synthetic, and adversarial) on ImageNet-1K classification demonstrate the effectiveness of CaRot across diverse environments. We justify the empirical success of CaRot through our theoretical analysis.
翻译:鲁棒微调旨在确保模型在分布外样本上的性能,但这一目标有时因追求在分布内样本上的适配而受到损害。然而,另一个可靠机器学习的关键准则——置信度校准——尽管在现实高 stakes 应用(例如自动驾驶)中需求日益增长,却一直未被重视。我们通过展示朴素微调甚至最先进的鲁棒微调会损害预训练视觉-语言模型在校准上的表现(尤其在分布外数据集上),提出了对分布偏移下微调视觉-语言模型校准问题的关注。我们首先证明了分布外校准误差的上界可由分布内校准误差以及分布内外之间的域差异构成。基于这一分析,我们提出CaRot,一种校准鲁棒微调方法,通过激励分布内校准和跨域鲁棒预测来降低分布外校准误差的上界。在ImageNet-1K分类的三种分布偏移类型(自然、合成和对抗)上的广泛实验证明了CaRot在不同环境下的有效性。我们通过理论分析论证了CaRot经验成功的合理性。