PRE: Vision-Language Prompt Learning with Reparameterization Encoder

Thi Minh Anh Pham, An Duc Nguyen, Cephas Svosve, Vasileios Argyriou, Georgios TzimiropoulosarXiv 2023

TL;DR

PRE (Prompt Learning with Reparameterization Encoder) is a simple yet effective method to improve how vision-language models like CLIP adapt to new tasks. By using a BiLSTM-based reparameterization encoder with residual connections, PRE significantly enhances a model's ability to generalize to unseen classes while remaining nearly as fast as standard prompt tuning.

What Problem Does This Paper Address?

Large vision-language models (VLMs) like CLIP are powerful but sensitive to the "prompts" used to describe images. While manual prompt engineering (e.g., "a photo of a [CLASS]") works, it is time-consuming and requires domain expertise.

To solve this, researchers developed Context Optimization (CoOp), which replaces manual words with learnable "soft" tokens. However, CoOp has a major flaw: it tends to overfit to the specific classes seen during training ("Base" classes) and performs poorly on novel classes ("New" classes) within the same domain. Other solutions like CoCoOp attempt to fix this by making prompts image-conditional, but they introduce significant computational overhead. The challenge is to find a prompt learning method that generalizes well without sacrificing efficiency.

Methods

The authors introduce Prompt Learning with Reparameterization Encoder (PRE). Instead of directly optimizing the prompt embeddings (as in CoOp), PRE passes them through a trainable encoder before they reach the frozen CLIP text encoder.

Key components include:

  • Reparameterization Encoder: A one-layer Bidirectional LSTM (BiLSTM). This choice is intentional; the BiLSTM captures long-range sequential dependencies between prompt tokens, allowing the model to learn how tokens relate to one another in a domain-specific context.
  • Residual Connection: A skip connection adds the original prompt embedding to the output of the BiLSTM ($F(v_i) = \phi(v_i) + v_i$). This ensures the model doesn't "forget" the robust, pre-trained knowledge inherent in the original CLIP embeddings while incorporating new task-specific insights.
Figure 1: PRE is depicted in the following illustration: The original prompt embeddings V undergo projection using a trainable prompt encoder F(·) equipped with a residual connection. This process enables the modeling of domain-specific sequential dependencies within the input prompt embeddings and acquires a new mapping for the soft prompts.

Datasets

The authors evaluated PRE on 8 diverse image classification benchmarks to test its generalization across different domains:

  • Generic Objects: Caltech101
  • Fine-Grained Recognition: Oxford-Pets, Stanford Cars, Flowers102, Food101, and FGVC Aircraft.
  • Textures: DTD
  • Satellite Imagery: EuroSAT

The experiments followed a "base-to-new" generalization setting: the model is trained on half the classes in a dataset and then tested on both the seen (Base) and unseen (New) classes.

Key Insights and Ideas

  • Tokens are not Islands: The authors argue that prompt embeddings should be dependent on each other. By using a BiLSTM (shown in detail below), PRE models these interdependencies, which helps in capturing the underlying structure of the domain data better than learning independent tokens.
  • Stability via Residuals: The residual connection is critical. Ablation studies showed that removing it leads to a significant performance drop, especially in Base class accuracy. It acts as a stabilizer that balances pre-trained general knowledge with new few-shot learning.
  • Efficiency Matters: Unlike methods that require processing image features for every prompt (like CoCoOp), PRE only operates on the text side. This makes it roughly 25x faster than CoCoOp during training.
Figure 2: Illustration of one-layer Bidirectional LSTM architecture used in Prompt Encoder.

Key Results

PRE demonstrates a superior balance between learning seen classes and generalizing to new ones, as measured by the Harmonic Mean (H) of Base and New class accuracies.

  • Generalization Boost: In a 16-shot setting, PRE improved average accuracy on "New" classes by 5.60% and the Harmonic mean by 3% compared to CoOp.
  • Competitive Performance: PRE achieved an average H-score of 76.22%, outperforming CoOp (73.34%), CoCoOp (74.47%), and ProGrad (75.58%).
  • Speed: PRE maintains a training time of 6.2ms/image, which is nearly identical to CoOp (6ms/image) and vastly superior to CoCoOp (160ms/image).
Table 1: Compared to existing methods on 8 datasets with 16-shot settings, PRE obtains a higher performance within good training time.

Limitations and Future Work

Despite its improvements, PRE still lags behind zero-shot CLIP (using manual prompts) on "New" classes in 5 out of the 8 datasets. This suggests that while prompt learning is getting better, fully bridging the gap between specialized learning and general zero-shot performance remains an open challenge.

Future research directions suggested by the authors include:

  • Exploring even more efficient architectures for the prompt encoder.
  • Investigating how reparameterization encoders can be integrated with other VLM tuning methods, such as adapter-based approaches.

Summary updated

BibTeX
@misc{pham2023pre,
  author = {Thi Minh Anh Pham and An Duc Nguyen and Cephas Svosve and Vasileios Argyriou and Georgios Tzimiropoulos},
  title = {{PRE: Vision-Language Prompt Learning with Reparameterization Encoder}},
  year = {2023},
  eprint = {2309.07760},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.07760},
}
Figure