Retrieval-Augmented Multimodal Language Modeling

Michihiro Yasunaga, Armen Aghajanyan, Weijia Shi, Richard James, Jure Leskovec, Percy Liang, Mike Lewis, Luke Zettlemoyer, Wen-Tau Yih

TL;DR

This paper introduces RA-CM3, the first retrieval-augmented multimodal model capable of generating both images and text. By allowing a base multimodal model to access and utilize relevant external documents, RA-CM3 achieves state-of-the-art performance on image and caption generation tasks with significantly less training compute and parameters than previous models.

What Problem Does This Paper Address?

Current state-of-the-art multimodal models like DALL-E and CM3 store all their knowledge implicitly within their parameters. This approach requires massive datasets and extensive training to capture a wide range of information, leading to increasingly large and computationally expensive models. The authors aim to address this by developing a more scalable and modular approach: retrieval augmentation. This allows a base model to "look up" relevant information from an external memory, similar to how humans access knowledge, rather than memorizing everything. The key challenge is extending this retrieval-augmentation paradigm to the multimodal domain, where both the input and the external memory consist of images and text.

Methods

The proposed approach, Retrieval-Augmented CM3 (RA-CM3), consists of two main components:

  • Multimodal Retriever: This component uses a dense retrieval method with a mixed-modal encoder. The authors leverage a pretrained CLIP model, which is adept at understanding both text and images. Their encoder processes a combination of text and image parts from a document, creating a vector representation. This retriever fetches relevant multimodal documents from an external memory based on a query (which can be text, image, or a mixture).
  • Retrieval-Augmented Generator: The generator is based on the CM3 Transformer architecture, a model capable of both text and image generation. To incorporate retrieved documents, they are prepended to the main input document, effectively acting as in-context examples for the generator. The model is trained by optimizing a joint token prediction loss for both the main input and the retrieved documents.

Key design choices explored include:

  • Retrieval Relevance: Ensuring retrieved documents are relevant to the input is crucial for training.
  • Retrieval Modality: Retrieving multimodal documents (containing both text and images) performs better than retrieving only text or images.
  • Retrieval Diversity: Techniques like "Avoid Redundancy" and "Query Dropout" are used to ensure diverse retrieved documents, which significantly improves performance.
  • Generator Training: Jointly optimizing the loss for the main document and retrieved documents (with a weighting factor $\alpha$) boosts training efficiency and performance.

Datasets

  • Training Data: The LAION dataset, a large-scale collection of text-image pairs, was used. A subset of 150 million text-image pairs was cleaned and formatted for training.
  • External Memory: The same 150 million text-image pairs used for training also served as the external memory for the retriever.
  • Evaluation Data: The MS-COCO dataset was used for evaluating both caption-to-image and image-to-caption generation tasks.

Key Insights and Ideas

  • Knowledge Scalability: Retrieval augmentation offers a more scalable way to incorporate knowledge into multimodal models compared to solely relying on model parameters.
  • Multimodal Retrieval is Key: Retrieving documents that contain both text and images is more effective than retrieving single-modality documents for improving generation quality.
  • In-Context Learning for Multimodality: RA-CM3 demonstrates strong in-context learning capabilities, not just for text generation but also for image generation and classification, a significant advancement.
  • Training Efficiency: By offloading knowledge to an external memory, the model can focus on learning how to use that knowledge, leading to significantly faster training and better performance with fewer parameters.
  • Provenance and Interpretability: Retrieval provides a natural way to understand why a model generated a certain output, offering better interpretability and potentially reducing hallucinations.

Key Results

  • Caption-to-Image Generation: RA-CM3 achieved a FID score of 16 on MS-COCO, significantly outperforming the baseline CM3 (FID 29) and other models like DALL-E (12B parameters).
  • Image-to-Caption Generation: RA-CM3 achieved a CIDEr score of 89, outperforming baseline CM3 (CIDEr 72) and models like Parti (20B parameters) and Flamingo (3B; 4-shot), despite using only ~3B parameters.
  • Training Efficiency: RA-CM3 achieved better FID scores with significantly less training compute compared to models like DALL-E and Parti. Figure 2 illustrates this, showing RA-CM3 achieving a better FID score at a fraction of the training hours.
  • Knowledge-Intensive Generation: RA-CM3 demonstrated superior performance on tasks requiring world knowledge, such as generating images for captions involving rare entities or unusual compositions (e.g., "French flag on the moon").
  • In-Context Learning: The model showed strong performance in one-shot and few-shot image classification, and controllable image generation via in-context examples.

Limitations and Future Work

  • Limitations:
    • The authors acknowledge that despite data filtering, the models may still output problematic text or images due to biases present in the training data.
  • The current work focuses on text and image modalities; extending to other modalities is a future direction.
  • The retriever is fixed, and co-training or fine-tuning the retriever is a potential area for improvement.
  • Future Work:
    • Exploring co-training or fine-tuning the retriever.
  • Investigating larger values of K (number of retrieved documents) for tasks involving more entities.
  • Extending the framework to modalities beyond image and text.
  • Further investigating multimodal prompting and in-context learning.
  • Developing more advanced multimodal retrievers and generators.

Summary updated

BibTeX
@inproceedings{yasunaga2023retrieval,
  author = {Michihiro Yasunaga and Armen Aghajanyan and Weijia Shi and Richard James and Jure Leskovec and Percy Liang and Mike Lewis and Luke Zettlemoyer and Wen-Tau Yih},
  title = {{Retrieval-Augmented Multimodal Language Modeling}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=VZ8bs0fwoO},
}
Figure