Re-ViLM: Retrieval-Augmented Visual Language Model for Zero and Few-Shot Image Captioning

Zhuolin Yang, Wei Ping, Zihan Liu, Vijay Korthikanti, Weili Nie, De-An Huang, Linxi Fan, Zhiding Yu, Shiyi Lan, Bo Li, Mohammad Shoeybi, Ming-Yu Liu, Yuke Zhu, Bryan Catanzaro, Chaowei Xiao, Anima Anandkumar

Introduction

State-of-the-art Visual Language Models (VLMs), such as DeepMind's Flamingo, are typically "closed-book." They attempt to store all the world's knowledge—from rare animal species to complex artistic styles—directly within their billions of parameters. This approach has two major drawbacks: parameter inefficiency and static knowledge. To capture the vast diversity of visual concepts, models must grow increasingly massive, making them expensive to train and deploy. Furthermore, incorporating new information requires computationally intensive fine-tuning.

A specific species like this crayfish can be difficult for closed-book models to identify without retrieval.

Re-ViLM (Retrieval-augmented Visual Language Model) addresses these issues by allowing the model to look up relevant information from an external database on the fly, much like a student taking an open-book exam.

Methodology

Re-ViLM is built upon the Flamingo architecture but introduces a sophisticated retrieval mechanism:

  • Multimodal Retriever: When given a query image, the model uses a CLIP-based encoder to find the top-$k$ most similar image-text pairs in a massive external database (using Faiss for fast similarity search).
  • Retrieval-Augmented LM: Instead of a standard language model, Re-ViLM uses RETRO (Retrieval-Enhanced TRansfOrmer) as its backbone. This model features specialized cross-attention layers that allow the text generation process to "attend" to the retrieved captions.
  • Seamless Integration: The model processes the input image through a vision encoder and a perceiver resampler. These tokens, along with the retrieved text evidence, are fed into the LM decoder to generate the final caption.
  • Filtering Strategy: To prevent the model from simply "copy-pasting" during training, the authors implemented a filtering step to discard exact training image or caption matches from the database.

Datasets and Evaluation

The authors utilized several large-scale datasets for both training and as retrieval sources, including CCS (Conceptual Captions + SBU) totaling about 15 million pairs, and COYO-700M, filtered down to 104 million high-quality pairs. The model was evaluated on standard benchmarks including MSCOCO, Flickr30k, and NoCaps.

Key Insights

  • Efficiency over Size: A smaller model with access to a database can beat a much larger model without one. Re-ViLM-base (420M parameters) outperformed Flamingo-large (2.1B parameters) in zero-shot evaluations.
  • Initialization Matters: Initializing Re-ViLM with a pre-trained retrieval-augmented LM (like RETRO) is significantly more effective than starting from a vanilla LM.
  • Out-of-Domain Excellence: Retrieval is most powerful when the model encounters something it hasn't seen often in its training set, which is why Re-ViLM shows its biggest gains in "zero-shot" and "out-of-domain" settings like NoCaps.

Results

Re-ViLM demonstrates impressive gains across the board. On MSCOCO, Re-ViLM achieved a CIDEr score of 60.8, a massive jump over the Flamingo-large baseline of 49.2, despite having a similar parameter count. Qualitatively, the model produces more specific and informative captions. For example, where a standard model might say "an animal in water," Re-ViLM can retrieve evidence about sea otters and correctly identify the species and its behavior.

Retrieved evidence of a sea otter helps the model generate more precise captions.

Limitations

While Re-ViLM shows great results up to 2.4B parameters, it hasn't yet been scaled to the 80B+ range. Additionally, performing a vector search adds latency (roughly 50ms per query), and the model's performance is naturally capped by the quality and breadth of its external database.

Summary updated

BibTeX
@inproceedings{yang2023re,
  author = {Zhuolin Yang and Wei Ping and Zihan Liu and Vijay Korthikanti and Weili Nie and De-An Huang and Linxi Fan and Zhiding Yu and Shiyi Lan and Bo Li and Mohammad Shoeybi and Ming-Yu Liu and Yuke Zhu and Bryan Catanzaro and Chaowei Xiao and Anima Anandkumar},
  title = {{Re-ViLM: Retrieval-Augmented Visual Language Model for Zero and Few-Shot Image Captioning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.793},
}
Figure