Prompt Learning via Meta-Regularization

Jinyoung Park, Juyeon Ko, Hyunwoo J. KimCVPR 2024

Abstract

Pre-trained vision-language models (VLMs) like CLIP have demonstrated remarkable zero-shot capabilities across diverse computer vision tasks. To adapt these models efficiently, researchers often employ prompt learning, which optimizes a small set of "soft prompts" while keeping the backbone frozen. However, these methods frequently suffer from task overfitting, where the model gains proficiency in specific training classes at the expense of the general knowledge acquired during pre-training. This paper introduces ProMetaR (Prompt Meta-Regularization), a framework that meta-learns a regularizer to balance task-specific adaptation with general knowledge retention. By utilizing bi-level optimization and task augmentation, ProMetaR achieves state-of-the-art performance in base-to-new generalization and domain robustness.

Introduction

The emergence of foundational Vision-Language Models has shifted the paradigm of computer vision. Instead of training models from scratch, practitioners now use prompt tuning to steer pre-trained models toward specific downstream tasks. While effective, this process often leads to a "forgetting" effect: as the soft prompts specialize in a target dataset, they lose the broad, task-agnostic features that enable zero-shot generalization.

Existing solutions often rely on manual regularization, which is difficult to tune and lacks the flexibility to adapt to varying task requirements. ProMetaR addresses this by treating regularization as a learnable component, automatically discovering the optimal balance between learning new features and preserving pre-trained intelligence.

The ProMetaR Framework

1. Bi-level Optimization and Meta-Learning

ProMetaR operates through a bi-level optimization strategy. In the inner loop, the model updates the soft prompts using a combination of the standard task loss and a learnable regularizer. In the outer loop, the framework evaluates the updated prompts on a validation set and optimizes the "meta-parameters"—the function governing the regularization strength. This ensures that the regularization is not a static penalty but an adaptive mechanism that responds to the training dynamics.

2. Adaptive Gradient Modulation

At the heart of ProMetaR is a gradient modulation function ($\mathcal{M}^\phi$). Instead of applying a uniform weight to the regularization term, ProMetaR learns to adjust the regularization strength based on the alignment (or conflict) between task-specific gradients and general-knowledge gradients. This allows the model to prioritize task-specific learning when it doesn't interfere with general knowledge, while stepping in to regularize when the two directions diverge.

3. Mitigating Meta-Overfitting via Task Augmentation

Meta-learning typically requires a diverse set of tasks to generalize well. However, in prompt tuning, we often only have access to a single dataset. To prevent the meta-parameters from overfitting to this limited data, ProMetaR employs Manifold Mixup to generate "virtual tasks." By creating these synthetic variations, the model simulates a multi-task environment, enhancing the robustness of the meta-regularizer.

4. Gradient Alignment Perspective

Theoretical analysis of ProMetaR reveals that it functions by aligning the update direction of the prompts with the task-agnostic knowledge of the original VLM. This alignment ensures that the optimization path remains within a region of the parameter space that preserves the model's inherent zero-shot capabilities.

Experimental Evaluation

The researchers evaluated ProMetaR across three rigorous benchmarks to test its versatility and robustness:

  • Base-to-New Generalization: Testing on 11 diverse datasets (including ImageNet, OxfordPets, and EuroSAT) to see how well the model generalizes from seen "base" classes to unseen "new" classes.
  • Domain Generalization: Training on standard ImageNet and testing on out-of-distribution variants like ImageNet-Sketch, ImageNet-A (Adversarial), and ImageNet-R (Rendition).
  • Cross-Dataset Transfer: Training on ImageNet and evaluating the transferability to 10 other distinct datasets.

Key Results

ProMetaR demonstrated significant improvements over existing prompt learning baselines:

  • Superior Generalization: On the "New Class" benchmark, ProMetaR achieved an average accuracy of 76.93%, outperforming the base CoOp method (73.35%) and previous state-of-the-art methods like PromptSRC (76.10%).
  • Balanced Performance: The framework achieved a Harmonic Mean (H) of 80.49%, the highest reported in the study. This metric is crucial as it indicates the model's ability to perform well on both training classes and unseen classes simultaneously.
  • Robustness to Distribution Shift: In domain generalization tests, ProMetaR maintained an average accuracy of 60.77% across ImageNet variants, proving more resilient to visual style changes and adversarial examples than standard tuning methods.
  • Compatibility: ProMetaR is designed as a "plug-and-play" module. Experiments showed it could be integrated into existing architectures like CoOp or Visual Prompt Tuning (VPT) to consistently boost their generalization performance.

Conclusion

ProMetaR offers a sophisticated solution to the problem of task overfitting in vision-language models. By meta-learning the regularization process and utilizing task augmentation, it removes the need for manual hyperparameter tuning while significantly enhancing the model's ability to retain general knowledge. As VLMs continue to grow in scale and application, adaptive frameworks like ProMetaR will be essential for efficient and robust model adaptation.

Summary updated

BibTeX
@inproceedings{park2024prompt,
  author = {Jinyoung Park and Juyeon Ko and Hyunwoo J. Kim},
  title = {{Prompt Learning via Meta-Regularization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  url = {https://openreview.net/forum?id=B7dAJ7T0mU},
}
Figure