Abstract
Image captioning requires a sophisticated bridge between computer vision and natural language processing. While Transformer architectures have revolutionized NLP, their application to image captioning has been hindered by a lack of a priori knowledge and the loss of multi-level visual information during encoding. We present the Meshed-Memory Transformer ($M^2$), a novel architecture that introduces learnable persistent memory to the encoder and a meshed connectivity schema to the decoder. Our model achieves state-of-the-art results on the COCO benchmark, demonstrating the efficacy of fully-attentive models in multi-modal tasks.
Introduction
The task of automatically generating natural language descriptions for images is a cornerstone of multi-modal AI. Historically, Recurrent Neural Networks (RNNs) like LSTMs dominated this field. However, the transition to Transformer-based models introduced two significant challenges:
- Lack of A Priori Knowledge: Standard self-attention only models relationships within a specific image, failing to leverage "common sense" knowledge about typical object relationships (e.g., understanding that "eggs" and "toast" usually appear in a "breakfast" context).
- Layer-Specific Information Loss: Traditional Transformers typically only connect the final encoder layer to the decoder, ignoring valuable low-level spatial arrangements and mid-level semantic features captured in earlier layers.
Methodology
The $M^2$ Transformer addresses these hurdles through two primary architectural innovations:
Memory-Augmented Encoding
The encoder's self-attention mechanism is augmented with learnable, persistent memory vectors. These vectors are not image-specific; instead, they are updated during training to store global knowledge about visual relationships. This allows the model to retrieve contextual information not explicitly present in the input pixels.
Meshed Decoding
Unlike standard decoders, the $M^2$ decoder employs a meshed connectivity schema, performing cross-attention with every encoding layer. A learnable gating mechanism determines the relative importance of each layer's contribution for every generated word. This enables the model to dynamically balance low-level spatial cues and high-level semantic abstractions.
The model is trained in two stages: initial cross-entropy loss optimization followed by Reinforcement Learning using Self-Critical Sequence Training (SCST) to directly optimize the CIDEr metric.
Experiments and Results
The $M^2$ Transformer was evaluated on the MS-COCO and nocaps datasets. On the COCO "Karpathy" test split, the model achieved a CIDEr score of 131.2 (single model) and 134.5 (ensemble), outperforming previous state-of-the-art models like AoANet. At the time of publication, it held the top rank on the official COCO online leaderboard.
Qualitative analysis demonstrates that the $M^2$ Transformer generates more descriptive and accurate captions compared to standard Transformers, particularly in identifying complex relationships and specific object attributes.
On the nocaps dataset, the model showed significant improvements in "out-of-domain" scenarios, suggesting that the memory-augmented features enhance generalization to unseen objects.
Conclusion
The Meshed-Memory Transformer represents a significant advancement in image captioning, proving that fully-attentive models can excel by incorporating persistent memory and multi-level feature integration. Future work will explore extending the meshed-memory concept to other domains such as Visual Question Answering (VQA) and video captioning.
Summary updated