"Let's not Quote out of Context": Unified Vision-Language Pretraining for Context Assisted Image Captioning

Abisek Rajakumar Kalarani, Pushpak Bhattacharyya, Niyati Chhaya, Sumit Shekhar

TL;DR

This paper introduces a unified Vision-Language (VL) model that generates image captions by explicitly leveraging surrounding text context, such as news articles. By introducing a novel "Contextual Visual Entailment" pretraining task, the authors achieve state-of-the-art results on news captioning benchmarks, significantly outperforming models that treat images as standalone entities.

What Problem Does This Paper Address?

Standard image captioning models typically operate in a vacuum, describing only what is visible in the pixels. However, in real-world applications like news reporting or digital marketing, an image's meaning is often inextricably linked to its context.

For example, a photo of a crowd cheering could represent a political rally in London or a sports victory in Madrid. Without the accompanying text, a model cannot produce a "well-formed" caption containing specific names, locations, or events. Existing unified VL models often lack the ability to process the long-form text associated with these images during their pretraining phase. The authors aim to bridge this gap by creating a model that treats the image and its context as a single, unified premise.

An example showing how context changes caption requirements. Blue text is inferred from the image; green from context; red requires both.

Methods

The researchers built their system on the One For All (OFA) architecture, a task-agnostic framework that treats all VL tasks as sequence-to-sequence problems. Their core innovation lies in a specialized pretraining strategy involving three distinct tasks:

  1. News Image Captioning: Generating a caption based on both the image and the full news article.
  2. Contextual Visual Entailment (Novel): A binary classification task where the model must determine if a caption is consistent with both the image and the provided context. To make this challenging, the authors created negative samples by swapping named entities or slightly altering the meaning of the original caption (e.g., changing "marched peacefully" to "marched violently").
  3. Keyword Extraction: Training the model to identify key phrases within the context text to improve its internal representation of the article's core themes.

The model uses ResNet-152 and VQGAN to convert images into visual tokens, while text is processed using Byte-Pair Encoding (BPE). Everything is mapped to a single unified vocabulary, allowing the transformer-based encoder-decoder to process multimodal inputs seamlessly.

Figure 2: An overview of our unified Vision-Language model pretrained for the three subtasks- context assisted image captioning, contextual visual entailment, and keyword extraction.

Datasets

The authors utilized several large-scale datasets for training and evaluation:

  • Visual News & KPTimes: Used to construct the primary pretraining dataset (2.3M instances).
  • Contextual Visual Entailment Datasets: The authors released two new datasets for this task: a large synthetic set (1.1M pairs) and a manually annotated "challenging" set (2.2K instances).
  • GoodNews & NYTimes800K: These served as the standard benchmarks for evaluating news image captioning performance.

Key Insights and Ideas

  • Context as a First-Class Citizen: This is the first major effort to incorporate long-form contextual information directly into the pretraining phase of a VL model, rather than just fine-tuning.
  • The Power of Entailment: The "Contextual Visual Entailment" task forces the model to learn fine-grained relationships. By training the model to spot when a name or a specific action is "out of context," it becomes much better at generating accurate, entity-rich captions later.
  • Implicit vs. Explicit Entities: Interestingly, the authors found that explicitly injecting named entities into the prompt during fine-tuning actually hurt performance slightly. This is because the entity tokens took up valuable space in the model's 512-token limit, suggesting that the model is already effectively "capturing" these entities implicitly through its contextual pretraining.

Key Results

The proposed model achieved new state-of-the-art (SOTA) results across major benchmarks:

  • GoodNews: Achieved a CIDEr score of 72.33, an 8.34-point improvement over the previous SOTA and a 5.14-point jump over the base OFA model.
  • NYTimes800K: Reached a SOTA CIDEr score of 66.41.
  • Ablation Success: The ablation studies confirmed that the model performs best when all three pretraining tasks are used together. Removing the "Contextual Visual Entailment" task resulted in a noticeable drop in performance.
Comparison of experimental results against other models on GoodNews and NYTimes800K.
Ablation study showing the impact of different pretraining task combinations.

Limitations and Future Work

The primary limitation identified is the context window. The model was restricted to 512 tokens for the news article. While sufficient for many stories, the average article length in the NYTimes800K dataset is 974 words, meaning significant information is often clipped.

Future work aims to scale the model to handle even longer contexts and to deploy it in real-world enterprise authoring tools to automate the tedious process of tagging and captioning vast libraries of marketing assets.

Summary updated

BibTeX
@inproceedings{kalarani2023let,
  author = {Abisek Rajakumar Kalarani and Pushpak Bhattacharyya and Niyati Chhaya and Sumit Shekhar},
  title = {{"Let's not Quote out of Context": Unified Vision-Language Pretraining for Context Assisted Image Captioning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
}
Figure