NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Image Captioning with Context-Aware Auxiliary Guidance

Zeliang Song, Xiaofei Zhou, Zhendong Mao, Jianlong Tan

Abstract

Traditional image captioning models typically generate descriptions word-by-word, often failing to capture global sentence context—a phenomenon known as "tunnel vision." We present Context-Aware Auxiliary Guidance (CAAG), a novel mechanism that utilizes a preliminary global prediction to refine word generation. By incorporating semantic attention over a "rough draft" of the caption, CAAG allows the model to anticipate future context, leading to more accurate and descriptive outputs. Our approach is model-agnostic and achieves state-of-the-art performance on the MSCOCO dataset.

Introduction

Image captioning aims to generate natural language descriptions for visual content. Most state-of-the-art models utilize an encoder-decoder framework, where a Convolutional Neural Network (CNN) extracts visual features and a Recurrent Neural Network (RNN) or Long Short-Term Memory (LSTM) network generates the caption sequentially. Despite their success, these models often suffer from "tunnel vision"—a limitation where the prediction of the next word depends solely on the image and previously generated words, without considering the global context of the entire sentence.

The Problem: Local vs. Global Context

In traditional sequential generation, the model lacks foresight. For instance, if a model has generated "A boy is...", it might predict "standing" based on high-frequency patterns in the training data, even if the visual evidence later in the sentence (e.g., "playing baseball") would have dictated a different choice. This leads to "incomplete semantics" and "exposure bias," where small errors early in the sequence propagate and degrade the final output.

Comparison between traditional sequential captioning (a) and the proposed CAAG approach (b).

As illustrated in Figure 2, the CAAG approach allows the model to "look into the future" by leveraging a preliminary global context to guide the generation of each word, correcting potential local errors.

Context-Aware Auxiliary Guidance (CAAG)

To address these limitations, we propose the Context-Aware Auxiliary Guidance (CAAG) framework. CAAG is a two-stage architecture designed to be integrated into existing captioning models as a plug-in module.

Architecture Overview

The system consists of two main components:

  1. Primary Network: A standard captioner (e.g., the "Up-Down" model) that uses visual features from a Faster R-CNN to generate a preliminary "global context" sentence $Y_{1:T}$.
  2. CAAG Module: This auxiliary guide takes the full preliminary sentence and the current hidden state of the decoder. It employs semantic attention to identify which words in the global context are most relevant to the current generation step $t$.
The overall architecture of the CAAG framework, featuring the Primary Network and the CAAG module.

Training and Inference

During training, the target word is masked within the semantic attention mechanism to prevent the model from simply copying the ground truth, forcing it to learn contextual relationships. The model is optimized using Self-Critical Sequence Training (SCST) to maximize the CIDEr-D metric. During inference, the model performs a "greedy" first pass to obtain the global context, followed by a second pass where the Primary Network and CAAG module collaborate to produce the final refined caption.

Experimental Results

The CAAG framework was evaluated on the Microsoft COCO (MSCOCO) dataset using the Karpathy split. The results demonstrate that CAAG consistently improves performance across various base architectures:

  • Up-Down Baseline: CIDEr-D score increased from 123.4 to 128.8.
  • AoANet Integration: Reached a state-of-the-art CIDEr-D score of 132.2, outperforming many complex graph-based models.

Human evaluations further confirmed these findings, with participants consistently rating CAAG-generated captions as more accurate and descriptive. For example, CAAG was able to correctly identify specific scene elements like "tennis courts" where baseline models hallucinated more common objects like "tennis rackets."

Conclusion

Context-Aware Auxiliary Guidance provides a robust solution to the "tunnel vision" problem in image captioning. By treating captioning as a refinement process rather than a simple sequence prediction, CAAG enables models to produce more contextually grounded descriptions. While the two-pass inference increases computational cost, the significant gains in accuracy and descriptive quality make it a valuable addition to the image captioning pipeline.

Summary updated

BibTeX
@inproceedings{song2021image,
  author = {Zeliang Song and Xiaofei Zhou and Zhendong Mao and Jianlong Tan},
  title = {{Image Captioning with Context-Aware Auxiliary Guidance}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i3.16361},
}
Figure