[论文解读] Prompt-aligned Gradient for Prompt Tuning
本文提出了一种新颖的提示微调方法——提示对齐梯度(ProGrad),通过将优化更新对齐到从零样本预测中提取的一般知识方向,防止像CLIP这样的视觉-语言模型在少样本微调过程中遗忘一般知识。ProGrad在多个基准测试中提升了少样本泛化性能,在基础到新类泛化任务的调和平均准确率上,相比最先进方法最高提升4.5%。
Thanks to the large pre-trained vision-language models (VLMs) like CLIP, we can craft a zero-shot classifier by "prompt", e.g., the confidence score of an image being "[CLASS]" can be obtained by using the VLM provided similarity measure between the image and the prompt sentence "a photo of a [CLASS]". Therefore, prompt shows a great potential for fast adaptation of VLMs to downstream tasks if we fine-tune the prompt-based similarity measure. However, we find a common failure that improper fine-tuning may not only undermine the prompt's inherent prediction for the task-related classes, but also for other classes in the VLM vocabulary. Existing methods still address this problem by using traditional anti-overfitting techniques such as early stopping and data augmentation, which lack a principled solution specific to prompt. We present Prompt-aligned Gradient, dubbed ProGrad, to prevent prompt tuning from forgetting the the general knowledge learned from VLMs. In particular, ProGrad only updates the prompt whose gradient is aligned (or non-conflicting) to the "general direction", which is represented as the gradient of the KL loss of the pre-defined prompt prediction. Extensive experiments demonstrate the stronger few-shot generalization ability of ProGrad over state-of-the-art prompt tuning methods. Codes are available at https://github.com/BeierZhu/Prompt-align.
研究动机与目标
- 解决提示微调中的失败模式:即使用少量样本微调时性能低于零样本基线。
- 克服传统正则化技术(如早停法和数据增强)的局限性,这些方法在提示微调动态中缺乏理论基础。
- 在提示微调过程中保留预训练视觉-语言模型(如CLIP)中编码的一般知识,防止灾难性遗忘。
- 开发一种基于梯度的正则化机制,仅当更新方向与一般知识方向对齐时才更新提示。
- 通过强制对齐领域特定知识与一般知识方向,提升低数据场景、领域泛化和跨数据集迁移中的模型鲁棒性。
提出的方法
- 将一般知识方向 $\bm{G}_{\text{g}}$ 定义为零样本CLIP预测与微调后模型预测之间KL散度的梯度。
- 将领域特定方向 $\bm{G}_{\text{d}}$ 定义为真实标签与微调后模型预测之间交叉熵损失的梯度。
- 将 $\bm{G}_{\text{d}}$ 分解为两个正交分量:$\bm{G}_{\parallel}$(与 $\bm{G}_{\text{g}}$ 平行)和 $\bm{G}_{\perp}$(与 $\bm{G}_{\text{g}}$ 垂直),分别代表对齐知识与非冲突知识。
- 丢弃 $\bm{G}_{\parallel}$ 与 $\bm{G}_{\text{g}}$ 方向相反的更新,因为这些更新与一般知识相冲突。
- 仅当 $\bm{G}_{\parallel}$ 与 $\bm{G}_{\text{g}}$ 对齐时,才沿 $\bm{G}_{\parallel}$ 方向更新提示参数,同时沿 $\bm{G}_{\perp}$ 方向更新,确保不与一般知识冲突。
- 在每个训练步骤中应用该方法,以保持对前景物体的关注,防止对背景模式的过拟合。

实验结果
研究问题
- RQ1在训练样本数量极度有限的情况下,基于梯度的正则化是否能提升少样本提示微调的性能?
- RQ2强制提示更新与零样本预测中提取的一般知识方向对齐,是否能防止性能低于零样本基线?
- RQ3在少样本、领域泛化和基础到新类迁移设置下,ProGrad与现有提示微调方法(如CoOp、CoCoOp)相比,泛化性能如何?
- RQ4ProGrad在多大程度上保持了对前景物体的关注?这一结论是否可通过Grad-CAM可视化得到验证?
- RQ5在低数据场景下,ProGrad是否能超越现有的知识蒸馏和梯度掩蔽方法,且无需额外的数据增强?
主要发现
- 在11个数据集上的基础到新类泛化任务中,ProGrad实现了69.06%的调和平均准确率,优于CoOp(65.58%)和CoCoOp(65.35%),提升超过3.5个百分点。
- 在Stanford Cars数据集上,ProGrad在4-shot少样本学习下实现了63.66%的调和平均准确率,优于CoOp(62.14%)和CoCoOp(60.82%)。
- 在领域泛化任务中,与CoOp相比,ProGrad在ResNet50和ViT-B/16模型上分别提升了1.0%–1.5%的准确率,且在ImageNet各类变体中均保持一致的增益。
- Grad-CAM可视化显示,ProGrad保持了对前景物体的关注,而CoOp则因冲突更新导致注意力转向背景区域。
- ProGrad优于CoOp + KD和CoOp + GM,表明其梯度对齐机制在保留一般知识方面比知识蒸馏或梯度掩蔽更有效。
- 在Caltech101数据集上,ProGrad在相同4-shot设置下实现了92.46%的调和平均准确率,显著优于CoOp(90.80%)和CoCoOp(91.00%)。
![Figure 2 : Comparisons of Grad-CAM [ 43 ] visualization for prompt tuning methods using different gradient strategies on Stanford Cars Datasets.](https://ar5iv.labs.arxiv.org/html/2205.14865/assets/x2.png)
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。