Multi-Modal Generative Embedding Model

Feipeng Ma, Hongwei Xue, Guangting Wang, Yizhou Zhou, Fengyun Rao, Shilin Yan, Yueyi Zhang, Siying Wu, Mike Zheng Shou, Xiaoyan SunarXiv 2024

Abstract

Most multi-modal tasks can be formulated into problems of either generation or embedding. Existing models usually tackle these two types of problems by decoupling language modules into a text decoder for generation, and a text encoder for embedding. To explore the minimalism of multi-modal paradigms, we attempt to achieve only one model per modality in this work. We propose a Multi-Modal Generative Embedding Model (MM-GEM), whereby the generative and embedding objectives are encapsulated in one Large Language Model. We also propose a PoolAggregator to boost efficiency and enable the ability of fine-grained embedding and generation. A surprising finding is that these two objectives do not significantly conflict with each other. For example, MM-GEM instantiated from ViT-Large and TinyLlama shows competitive performance on benchmarks for multimodal embedding models such as cross-modal retrieval and zero-shot classification, while has good ability of image captioning. Additionally, MM-GEM can seamlessly execute region-level image caption generation and retrieval tasks. Besides, the advanced text model in MM-GEM brings over 5% improvement in Recall@1 for long text and image retrieval.

Addressing Modality Divergence

In the current multi-modal landscape, a "modality divergence" exists between two primary task types. Embedding models, like CLIP, typically utilize a dual-encoder structure to project images and text into a shared latent space for retrieval and classification. Conversely, generative models, such as LLaVA, employ auto-regressive decoders to interpret images and generate descriptive text.

These paradigms require fundamentally different textual treatments: embedding models require a global summary of a sentence, whereas generative models must predict text token-by-token. Previous attempts to unify these functions often resulted in complex "Frankenstein" architectures with separate encoders and decoders. MM-GEM addresses this by asking if a single Large Language Model (LLM) can perform both roles simultaneously without performance degradation.

Methodology: A Unified Framework

MM-GEM proposes a minimalist framework where a single LLM (specifically TinyLlama) serves as both the text encoder and the text decoder.

The MM-GEM architecture unifies generative and embedding objectives within a single LLM using a dual-loss approach and a PoolAggregator.

The model is trained using two simultaneous objectives:

  • Embedding: The model aligns image features with the hidden state of a special [EMB] token using an Info-NCE loss.
  • Generation: A standard cross-entropy loss is used to predict the next token following a [CAP] prompt.

To move beyond collapsing images into a single global vector, MM-GEM utilizes a PoolAggregator. This component maintains a spatial feature map, allowing the model to flexibly aggregate visual information from specific regions. Training occurs in two stages: large-scale pre-training on 2.3 billion image-text pairs (Stage 1), followed by fine-tuning on dense caption data using RoIAlign to teach the model to associate specific image regions with text (Stage 2).

Key Insights and Spatial Awareness

A core finding of this research is the "No-Conflict" surprise: contrastive learning (embedding) and auto-regressive learning (generation) are compatible within a single LLM. Training them together does not degrade performance; rather, they appear to complement each other. Furthermore, using a full LLM like TinyLlama as a text encoder significantly improves performance on long, complex text retrieval tasks, yielding a 5% improvement in Recall@1 compared to smaller transformer encoders.

MM-GEM demonstrates spatial awareness by focusing on specific regions, such as distinguishing between a dog, a car, and a bicycle in a single scene.

Because the model is trained to attend to specific regions during Stage 2, it gains exceptional spatial awareness. It can perform region-level captioning, describing specific objects within a crowded scene based on a bounding box, whereas standard models typically default to a global image description.

Performance Evaluation

MM-GEM demonstrates state-of-the-art performance across multiple benchmarks:

  • Retrieval: Using a ViT-L/14, MM-GEM achieved a Recall@1 of 45.6 on COCO text-to-image retrieval, outperforming OpenAI CLIP (34.3) and matching OpenCLIP.
  • Captioning: On the NoCaps benchmark, the model achieved a CIDEr score of 100.7, significantly outperforming larger models like Flamingo-9B (79.4).
  • Zero-Shot Classification: The model maintained high accuracy across the ICinW benchmark, proving that generative training does not compromise its classification capabilities.

Conclusion and Future Directions

While MM-GEM successfully unifies generative and embedding tasks, limitations remain. The web-scale pre-training data is often noisy, which can affect initial caption quality. Future work will explore incorporating more text-only data to enhance linguistic reasoning and scaling the architecture to larger LLMs (e.g., 7B or 13B parameters) to further improve complex multi-modal reasoning.

Summary updated

BibTeX
@misc{ma2024multi,
  author = {Feipeng Ma and Hongwei Xue and Guangting Wang and Yizhou Zhou and Fengyun Rao and Shilin Yan and Yueyi Zhang and Siying Wu and Mike Zheng Shou and Xiaoyan Sun},
  title = {{Multi-Modal Generative Embedding Model}},
  year = {2024},
  eprint = {2405.19333},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.19333},
}
Figure