Context-Adaptive Multi-Prompt Embedding with Large Language Models for Vision-Language Alignment

Dahun Kim, Anelia Angelova

This blog post summarizes the paper "Context-Adaptive Multi-Prompt Embedding with Large Language Models for Vision-Language Alignment," published at COLM 2025 by researchers at Google DeepMind.

TL;DR

Standard vision-language models like CLIP compress an entire description into a single vector, often losing nuanced details. This paper introduces a method to extract multiple "adaptive" embeddings from a Large Language Model (LLM) in a single pass, allowing the model to simultaneously focus on different semantic aspects—like subjects, objects, and background—resulting in significantly better image and video retrieval.

What Problem Does This Paper Address?

Contrastive models (like CLIP) have revolutionized how we search for images using text. They work by projecting images and text into a shared mathematical space where related pairs are close together. However, most current models rely on a single text embedding to represent a whole caption.

This "one-vector-fits-all" approach struggles with complexity. A caption like "A young boy looking at two little dogs sitting in large sneakers" contains multiple distinct entities and relationships. A single vector might prioritize the "boy" but blur the "sneakers." Furthermore, while Large Language Models (LLMs) are excellent at understanding text, they are "decoder-only" (causal), meaning they aren't naturally designed to summarize a whole sentence into a single point. Previous attempts to use LLMs as encoders often used fixed, manual prompts that didn't adapt to the specific visual context.

Methods

The authors propose Context-Adaptive Multi-Prompt Embedding, which turns an LLM into a multi-faceted text encoder through three key innovations:

  1. Adaptive Prompt Tokens (APT): Instead of one prompt, the authors use $K$ structured prompts (e.g., $K=6$). Each prompt includes a unique, learnable token [APT-i]. The format looks like: "[input text]. The [APT-i] of this image means:".
  2. Efficient Prompt-Wise Masking: To avoid running the LLM six separate times (which would be slow), they concatenate all $K$ prompts into one long sequence. They use a custom attention mask so that each prompt can see the original caption but cannot see the other prompts. This allows the model to generate $K$ distinct embeddings in a single forward pass.
  3. Channel-wise Concatenation: Each of the $K$ embeddings is projected to a smaller dimension ($D/K$) and then concatenated to form a final vector of size $D$. Because contrastive learning uses dot products, this forces each [APT-i] to align with a specific "slice" of the visual feature vector, encouraging specialization.

To sharpen these embeddings, the authors add two auxiliary losses:

  • Diversity Regularization ($L_{div}$): Penalizes the model if the $K$ embeddings are too similar to each other.
  • Negation-Aware Loss ($L_{neg}$): The model is also trained on "negated" prompts (e.g., "...does NOT mean:"). This teaches the model to explicitly recognize what is not in the image, improving its discriminative power.

Datasets

  • Training: The models were trained from scratch on LAION (for images) and finetuned on VideoCC3M (for videos).
  • Evaluation: The authors tested zero-shot retrieval performance on standard benchmarks:
  • Image-Text: Flickr30K and MSCOCO.
  • Video-Text: MSR-VTT.

Key Insights and Ideas

  • The "Aha!" Moment - Specialization: By visualizing attention maps, the researchers found that different APTs naturally learned to look at different things. One token might focus on the main subject, while another focuses on the background or secondary objects.
  • LLMs Need a Little "Unfreezing": Simply using a frozen LLM performs poorly. The authors found that unfreezing just the last two layers of a model like Gemma-2B provides the best balance between performance and computational efficiency.
  • Negation Matters: Explicitly telling the model what a caption doesn't mean helps it clear up ambiguity, leading to much sharper alignment between modalities.
  • Scaling the Backbone: Moving from a 2-billion parameter LLM (Gemma-2B) to a 9-billion parameter one (Gemma-9B) yielded consistent performance boosts, suggesting the method scales well with model capacity.

Key Results

The proposed method consistently outperformed vanilla CLIP and other LLM-based baselines:

  • Image Retrieval: On MSCOCO (Recall@1, image-to-text), the method achieved 58.5%, significantly outperforming OpenAI’s CLIP-B at 52.4%.
  • Video Retrieval: On MSR-VTT (Recall@1, text-to-video), the method reached 35.8%, compared to 31.6% for a vanilla CLIP baseline adapted for video.
  • Ablation: Using multiple adaptive prompts ($K=6$) was significantly better than using a single prompt ($K=1$), proving that capturing diverse semantic "views" is crucial.

Limitations and Future Work

  • Computational Overhead: While the prompt-masking trick makes the LLM pass efficient, an LLM is still significantly more "heavy" (in terms of parameters and FLOPs) than the lightweight Transformer encoders used in original CLIP models.
  • Negation Scope: The negation-aware loss was primarily evaluated in image-text settings; its full utility in complex, long-form video temporal dynamics remains an area for further exploration.
  • Prompt Engineering: While the tokens are adaptive, the "wrapper" text (e.g., "of this image means") is still a manual template. Future work could explore learning the entire prompt structure.

For those interested in the intersection of LLMs and Computer Vision, this paper provides a robust framework for moving beyond "global" representations toward more granular, multi-aspect alignment.

Summary updated

BibTeX
@inproceedings{kim2025context,
  author = {Dahun Kim and Anelia Angelova},
  title = {{Context-Adaptive Multi-Prompt Embedding with Large Language Models for Vision-Language Alignment}},
  booktitle = {COLM},
  year = {2025},
}
Figure