Gradient-Regulated Meta-Prompt Learning for Generalizable Vision-Language Models

Juncheng Li, Minghe Gao, Longhui Wei, Siliang Tang, Wenqiao Zhang, Mengze Li, Wei Ji, Qi Tian, Tat-Seng Chua, Yueting Zhuang

TL;DR

GRAM (Gradient-RegulAted Meta-prompt learning) is a model-agnostic framework that solves two major headaches in prompt tuning for vision-language models: extreme sensitivity to initialization and rapid overfitting in few-shot scenarios. By meta-learning both a robust prompt initialization and a lightweight gradient regulator using only unlabeled image-text data, GRAM significantly enhances the generalizability of models like CLIP across new classes, domains, and datasets.

What Problem Does This Paper Address?

Vision-language models (VLMs) like CLIP have revolutionized zero-shot learning, but getting them to perform well on specific downstream tasks usually requires "prompt tuning." Instead of manual engineering (e.g., "a photo of a [CLASS]"), researchers use soft prompts—learnable continuous embeddings.

However, soft prompt tuning has two critical flaws:

  1. Initialization Sensitivity: Small changes in how you start the prompt vectors lead to massive swings in final accuracy. Finding a "good" starting point is a time-consuming trial-and-error process.
  2. Generalizability Degradation: Because these prompts are often tuned on very few samples (few-shot learning), they easily overfit to "spurious correlations"—patterns specific to the training images that don't exist in the broader world. As training progresses, the model's ability to generalize to new classes or domains often plummets.
Figure 1: (a) Prompt tuning accuracy varies significantly with different initialization. (b) As the training continues, CoOp’s performance drops severely while our GRAM pre- vents CoOp from overfitting to spurious correlations.
Figure 1: (a) shows how initialization impacts accuracy, while (b) illustrates how standard methods like CoOp overfit over time compared to GRAM.

Methods

The authors introduce GRAM, a bi-level meta-learning paradigm. The core idea is to "learn how to learn" prompts so that the resulting model is both fast to adapt and hard to break.

1. Cross-Modal Hierarchical Clustering (CHC)

To train a meta-learner, you need many diverse tasks. GRAM generates these automatically from unlabeled web-scale image-text pairs (like CC3M).

  • Semantic Topic Clustering: It uses text descriptions to group data into broad topics (e.g., "Cars," "Animals").
  • Visual Domain Clustering: Within each topic, it clusters images based on visual features to simulate different "domains" (e.g., studio photos of cars vs. cars on a rainy street). This allows the model to simulate domain shift during training: it learns on one domain (support set) and is evaluated on others (query set).

2. Gradient-Regulated Meta-Learning

GRAM jointly learns two things:

  • The Initialization ($\theta$): A starting point for prompt vectors that is optimized for fast, effective adaptation to new tasks.
  • The Gradient Regulator ($R_\phi$): This is a lightweight function that intercepts the raw fine-tuning gradient. It performs an affine transformation to "nudge" the gradient toward a direction that is consistent across different domains, effectively filtering out domain-specific noise.
Figure 2: Overview of the proposed GRAM framework.
Figure 2: Overview of the GRAM framework, showing the CHC task generation and the bi-level meta-optimization process.

Datasets

  • Meta-Training: CC3M (3.1 million unlabeled image-text pairs).
  • Evaluation: 11 diverse image recognition datasets, including ImageNet (objects), OxfordPets (fine-grained), EuroSAT (satellite), and UCF101 (action recognition).
  • Cross-Domain Testing: Four ImageNet variants with domain shifts: ImageNetV2, ImageNet-Sketch, ImageNet-A, and ImageNet-R.

Key Insights and Ideas

  • Unlabeled Data is a Goldmine for Meta-Learning: You don't need expensive human-annotated datasets to learn generalizable prompts. The inherent structure of the internet (images paired with descriptive text) provides enough signal to simulate complex domain shifts.
  • Regulating the Update, Not Just the Weights: Most methods focus on the final weights. GRAM focuses on the gradient. By forcing the update direction to be similar across domains, the model is mathematically incentivized to ignore spurious correlations.
  • Modality Synergy (UNIGRAM): The authors found that textual prompt tuning (CoOp) and visual prompt tuning (VPT) are orthogonal. GRAM enables a "Universal" version (UNIGRAM) where both modalities are meta-learned together, leading to better results than either alone.

Key Results

GRAM was tested across 11 datasets in a 16-shot setting, showing consistent gains:

  • Base-to-New Generalization: On average, GRAM improved the accuracy of new (unseen) classes by 1.82% for CoOp and 1.87% for VPT.
  • UNIGRAM Superiority: The combined UNIGRAM approach achieved a harmonic mean (balancing base and new class accuracy) of 78.07%, significantly outperforming the standard CoOp (75.28%).
  • Cross-Dataset Robustness: When training on ImageNet and testing on 10 other datasets, GRAM-enhanced models showed a ~1.1-1.2% average improvement, proving it doesn't just memorize one dataset.
  • Stability: As shown in Figure 1(b), while standard CoOp's performance decays after 50 epochs due to overfitting, GRAM's performance remains stable and even improves.

Limitations and Future Work

  • Computational Cost of CHC: While the meta-learning happens once, the initial hierarchical clustering of millions of image-text pairs is computationally intensive.
  • Simple Regulator: The gradient regulator currently uses a relatively simple affine transformation. Exploring more complex architectures for $R_\phi$ might yield even better alignment.
  • Scaling: The paper focuses on few-shot (4 to 16 shots). How GRAM behaves in many-shot scenarios or with even larger VLM backbones (like ViT-L or ViT-G) remains an open question.

Summary updated

BibTeX
@inproceedings{li2023gradient,
  author = {Juncheng Li and Minghe Gao and Longhui Wei and Siliang Tang and Wenqiao Zhang and Mengze Li and Wei Ji and Qi Tian and Tat-Seng Chua and Yueting Zhuang},
  title = {{Gradient-Regulated Meta-Prompt Learning for Generalizable Vision-Language Models}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
}
Figure