Nemesis: Normalizing the Soft-prompt Vectors of Vision-Language Models

Shuai Fu, Xiequn Wang, Qiushi Huang, Yu Zhang

Abstract

With the prevalence of large-scale pretrained vision-language models (VLMs), such as CLIP, soft-prompt tuning has become a popular method for adapting these models to various downstream tasks. However, few works delve into the inherent properties of learnable soft-prompt vectors, specifically the impact of their norms to the performance of VLMs. This motivates us to pose an unexplored research question: "Do we need to normalize the soft prompts in VLMs?" To fill this research gap, we first uncover a phenomenon, called the Low-Norm Effect by performing extensive corruption experiments, suggesting that reducing the norms of certain learned prompts occasionally enhances the performance of VLMs, while increasing them often degrades it. To harness this effect, we propose a novel method named Normalizing the soft-prompt vectors of vision-language models (Nemesis) to normalize soft-prompt vectors in VLMs. To the best of our knowledge, our work is the first to systematically investigate the role of norms of soft-prompt vector in VLMs, offering valuable insights for future research in soft-prompt tuning.

Introduction

Large-scale vision-language models (VLMs) like CLIP have revolutionized how we approach computer vision by aligning visual and textual representations. To adapt these models to specific downstream tasks without expensive full-model fine-tuning, researchers often employ soft-prompt tuning. This technique replaces manual text prompts (e.g., "a photo of a [CLASS]") with a set of continuous, learnable vectors.

While soft-prompt tuning is highly effective, the community has largely overlooked the intrinsic mathematical properties of these learned vectors—specifically their norm (magnitude). Standard training procedures often allow these vectors to grow unchecked, which can lead to overfitting and performance degradation. This research investigates the fundamental question: "Do we need to normalize the soft prompts in VLMs?"

The Low-Norm Effect

To understand the relationship between prompt magnitude and model performance, the authors conducted "corruption experiments" on learned prompts using two primary operations:

  1. REPLACE: Substituting a prompt vector with a low-variance Gaussian vector.
  2. RESCALE: Mathematically shrinking the vector's magnitude while preserving its direction.

These experiments revealed a consistent phenomenon termed the Low-Norm Effect: reducing the norms of specific learned prompts often improves accuracy, whereas increasing them typically degrades it. This suggests that as soft prompts grow in magnitude during training, they may accumulate noise or overfit to the training distribution, hindering the model's ability to generalize.

The Nemesis Framework

To exploit the Low-Norm Effect systematically, the researchers introduced Nemesis, a framework that incorporates normalization directly into the training objective. Nemesis utilizes two distinct loss functions:

1. Position-Uniform Normalization (PUN)

PUN is a straightforward regularization term that applies a penalty to the norms of all prompt vectors equally. It forces the model to find solutions within a lower-norm space, acting as a global constraint against vector growth.

2. Position-Aware Normalization (PAN)

PAN is a more sophisticated, dynamic approach. Before each training batch, the model performs a "pre-inference" step where it creates temporary, shrunken versions of the prompts. It then evaluates whether these shrunken prompts would have yielded a more accurate prediction than the original vectors. If a shrunken prompt at a specific position shows better performance, the model applies normalization specifically to that position during the actual training update. This allows for selective refinement of the prompt sequence.

Experimental Results

Few-Shot Learning

The study evaluated Nemesis across 11 diverse datasets, including ImageNet (general objects), OxfordPets (fine-grained), and EuroSAT (satellite imagery). On the challenging ImageNet dataset, Nemesis (via PUN) achieved significant gains over the standard CoOp baseline:

  • +2.06% accuracy in 1-shot learning.
  • +3.84% accuracy in 2-shot learning.

The Low-Norm Effect was found to be most pronounced in these "low-shot" scenarios, where data scarcity makes the model particularly prone to overfitting.

Domain Generalization

To test robustness, the authors evaluated models trained on standard ImageNet against out-of-distribution variants like ImageNet-Sketch and ImageNet-Adversarial. Nemesis improved accuracy on ImageNet-Sketch by nearly 2%, demonstrating that normalized prompts maintain better alignment between visual and textual features even when the visual style shifts significantly.

Broad Compatibility

Nemesis is not limited to a single architecture. The authors demonstrated that integrating Nemesis into other state-of-the-art methods, such as PLOT, consistently improved performance, suggesting it is a general-purpose enhancement for soft-prompt tuning.

Conclusion and Future Work

Nemesis provides a novel perspective on VLM adaptation by highlighting the importance of prompt vector norms. By constraining these norms, the method prevents overfitting and enhances generalization.

However, some challenges remain. The PAN loss introduces computational overhead due to its pre-inference step, and the normalization strength ($\omega$) requires careful tuning across different datasets. Future research will focus on developing more efficient normalization strategies and establishing a more rigorous mathematical foundation for why lower norms facilitate better high-dimensional alignment in VLMs.

Summary updated

BibTeX
@inproceedings{fu2024nemesis,
  author = {Shuai Fu and Xiequn Wang and Qiushi Huang and Yu Zhang},
  title = {{Nemesis: Normalizing the Soft-prompt Vectors of Vision-Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=zmJDzPh1Dm},
}
Figure