[论文解读] Finetune like you pretrain: Improved finetuning of zero-shot vision models
本文提出了一种名为 FLYP(Fine-tune Like You Pretrain)的简单但极为有效的方法,用于微调零样本视觉模型(如 CLIP),其在微调过程中使用与预训练阶段相同的对比损失。通过将类别标签视为文本提示,并优化图像嵌入与提示嵌入之间的对比损失,FLYP 在 16 个基准测试中实现了最先进性能,相比之前的方法在少样本学习中最高提升 4.6%,在分布外(OOD)泛化任务中最高提升 2.7%。
Finetuning image-text models such as CLIP achieves state-of-the-art accuracies on a variety of benchmarks. However, recent works like WiseFT (Wortsman et al., 2021) and LP-FT (Kumar et al., 2022) have shown that even subtle differences in the finetuning process can lead to surprisingly large differences in the final performance, both for in-distribution (ID) and out-of-distribution (OOD) data. In this work, we show that a natural and simple approach of mimicking contrastive pretraining consistently outperforms alternative finetuning approaches. Specifically, we cast downstream class labels as text prompts and continue optimizing the contrastive loss between image embeddings and class-descriptive prompt embeddings (contrastive finetuning). Our method consistently outperforms baselines across 7 distribution shifts, 6 transfer learning, and 3 few-shot learning benchmarks. On WILDS-iWILDCam, our proposed approach FLYP outperforms the top of the leaderboard by $2.3\%$ ID and $2.7\%$ OOD, giving the highest reported accuracy. Averaged across 7 OOD datasets (2 WILDS and 5 ImageNet associated shifts), FLYP gives gains of $4.2\%$ OOD over standard finetuning and outperforms the current state of the art (LP-FT) by more than $1\%$ both ID and OOD. Similarly, on 3 few-shot learning benchmarks, our approach gives gains up to $4.6\%$ over standard finetuning and $4.4\%$ over the state of the art. In total, these benchmarks establish contrastive finetuning as a simple, intuitive, and state-of-the-art approach for supervised finetuning of image-text models like CLIP. Code is available at https://github.com/locuslab/FLYP.
研究动机与目标
- 解决微调后的视觉-语言模型在分布内与分布外泛化之间存在的性能差距。
- 探究是否通过使微调目标与预训练目标对齐,能够提升模型的鲁棒性与准确性。
- 评估一种极简且直观的方法——在微调过程中使用对比损失——是否能够超越复杂的多阶段或集成基线方法。
- 通过证明对比微调的一致优越性,建立零样本视觉模型监督微调的新标准基线。
- 探索该方法在少样本和分布偏移设置下的有效性,尤其是在标注数据稀缺的情况下。
提出的方法
- 将每个类别标签表示为自然语言提示(例如,'a photo of a {class}',以呼应预训练阶段的提示风格)。
- 使用图像编码器对输入图像进行嵌入,使用文本编码器对类别描述性提示进行嵌入。
- 优化图像嵌入与其对应提示嵌入之间的对比损失,以镜像预训练目标。
- 仅使用对比损失进行端到端微调,不引入交叉熵头或额外正则化。
- 使用标准优化方法(如 AdamW)和学习率调度策略,在下游数据集上训练模型。
- 在微调过程中使用与预训练阶段相同的损失函数,确保优化目标的一致性。

实验结果
研究问题
- RQ1在微调过程中使用与预训练阶段相同的对比损失,是否能带来优于标准交叉熵微调的性能?
- RQ2一个简单统一的目标(对比损失)是否能够超越复杂的多阶段微调方法(如 LP-FT)或集成策略?
- RQ3与最先进方法相比,FLYP 在分布外泛化基准测试中的表现如何?
- RQ4该对比微调方法在标注数据有限的少样本学习场景中是否具备良好的可扩展性?
- RQ5为何一种朴素的对比微调方法能超越包含正则化或权重集成的更复杂基线方法?
主要发现
- 在 WILDS-iWildCam 基准上,使用 CLIP ViT-L/14@336px 时,FLYP 在分布内准确率上比排行榜榜首(ModelSoups,70+ 个集成模型)高出 2.3%,在分布外准确率上高出 2.7%。
- 在 7 个 OOD 基准(2 个 WILDS 和 5 个 ImageNet shifts)上,FLYP 的 OOD 准确率比标准微调高出 4.2%,在 ID 和 OOD 上均比 LP-FT 高出 1% 以上。
- 在少样本学习中,FLYP 在二分类任务(如 Rendered-SST2 和 PatchCamelyon)上,相比标准微调最高提升 4.6%,相比 SOTA(LP-FT)最高提升 4.4%。
- FLYP 在所有基准上均持续主导 ID-OOD 前沿曲线,表明其在分布内性能与鲁棒性之间具有更优的权衡。
- 在 FLYP 中添加交叉熵损失会降低性能,表明仅使用对比目标已足够且最优。
- 该方法简单直观,无需架构修改、超参数调优或模型集成,却在多样化设置下实现了最先进结果。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。