[Paper Review] Prompt-aligned Gradient for Prompt Tuning
This paper proposes Prompt-aligned Gradient (ProGrad), a novel prompt tuning method that prevents vision-language models like CLIP from forgetting general knowledge during few-shot fine-tuning by aligning optimization updates to the general knowledge direction derived from zero-shot predictions. ProGrad improves few-shot generalization across multiple benchmarks, outperforming state-of-the-art methods by up to 4.5% in harmonic mean accuracy on base-to-new generalization tasks.
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.
Motivation & Objective
- Address the failure mode in prompt tuning where fine-tuning with few samples leads to performance degradation below zero-shot baselines.
- Overcome the limitations of traditional regularization techniques like early stopping and data augmentation, which lack principled grounding in prompt tuning dynamics.
- Preserve the general knowledge encoded in pre-trained vision-language models (e.g., CLIP) during prompt tuning to prevent catastrophic forgetting.
- Develop a gradient-based regularization mechanism that selectively updates prompts only when the update direction aligns with the general knowledge direction.
- Improve model robustness in low-data regimes, domain generalization, and cross-dataset transfer by enforcing alignment between domain-specific and general knowledge directions.
Proposed method
- Define the general knowledge direction $\bm{G}_{\text{g}}$ as the gradient of the KL divergence between zero-shot CLIP predictions and the few-shot fine-tuned model’s predictions.
- Compute the domain-specific direction $\bm{G}_{\text{d}}$ as the gradient of cross-entropy loss between ground-truth labels and the fine-tuned model’s predictions.
- Decompose $\bm{G}_{\text{d}}$ into two orthogonal components: $\bm{G}_{\parallel}$ (parallel to $\bm{G}_{\text{g}}$) and $\bm{G}_{\perp}$ (orthogonal to $\bm{G}_{\text{g}}$), representing aligned and non-conflicting knowledge respectively.
- Discard updates where $\bm{G}_{\parallel}$ points in the opposite direction of $\bm{G}_{\text{g}}$, as they conflict with general knowledge.
- Update only the prompt parameters in the direction of $\bm{G}_{\parallel}$ when it aligns with $\bm{G}_{\text{g}}$, and in the direction of $\bm{G}_{\perp}$, ensuring no conflict with general knowledge.
- Apply the method during each training step to maintain attention on foreground objects and prevent overfitting to background patterns.

Experimental results
Research questions
- RQ1Can gradient-based regularization improve few-shot prompt tuning performance when the number of training samples is extremely limited?
- RQ2Does enforcing alignment between prompt updates and the general knowledge direction from zero-shot predictions prevent performance degradation below zero-shot baselines?
- RQ3How does ProGrad compare to existing prompt tuning methods (e.g., CoOp, CoCoOp) in terms of generalization under few-shot, domain generalization, and base-to-new transfer settings?
- RQ4To what extent does ProGrad preserve attention on foreground objects, as evidenced by Grad-CAM visualizations?
- RQ5Can ProGrad outperform existing knowledge distillation and gradient masking methods in low-data regimes without requiring additional data augmentation?
Key findings
- ProGrad achieves a harmonic mean accuracy of 69.06% on base-to-new generalization across 11 datasets, outperforming CoOp (65.58%) and CoCoOp (65.35%) by over 3.5 percentage points.
- On the Stanford Cars dataset, ProGrad achieves 63.66% harmonic mean accuracy, surpassing CoOp (62.14%) and CoCoOp (60.82%) under 4-shot few-shot learning.
- In domain generalization, ProGrad improves accuracy by 1.0–1.5% on ResNet50 and ViT-B/16 models compared to CoOp, with consistent gains across ImageNet variants.
- Grad-CAM visualizations show that ProGrad maintains attention on foreground objects, unlike CoOp, which shifts focus to background regions due to conflicting updates.
- ProGrad outperforms CoOp + KD and CoOp + GM, demonstrating that its gradient alignment mechanism is more effective than knowledge distillation or gradient masking in preserving general knowledge.
- On the Caltech101 dataset, ProGrad achieves 92.46% harmonic mean accuracy, significantly outperforming CoOp (90.80%) and CoCoOp (91.00%) under the same 4-shot setting.
![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)
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.