Abstract
Zero-shot image captioning (IC) without well-paired image-text data can be divided into two categories: training-free and text-only-training. Generally, these two types of methods realize zero-shot IC by integrating pretrained vision-language models like CLIP for image-text similarity evaluation and a pre-trained language model (LM) for caption generation. The main difference between them is whether a textual corpus is used to train the LM. Though achieving attractive performance w.r.t. some metrics, existing methods often exhibit common drawbacks: training-free methods tend to produce hallucinations, while text-only-training often loses generalization capability. To move forward, we propose a novel Memory-Augmented zero-shot image Captioning framework (MeaCap). Specifically, equipped with a textual memory, we introduce a retrieve-then-filter module to get key concepts that are highly related to the image. By deploying our proposed memory-augmented visual-related fusion score in a keywords-to-sentence LM, MeaCap can generate concept-centered captions that maintain high consistency with the image with fewer hallucinations and more world-knowledge. The MeaCap framework achieves state-of-the-art performance on a series of zero-shot IC settings.
Introduction
Image captioning typically relies on massive datasets of paired images and human-written descriptions. However, obtaining such data is expensive and time-consuming. Zero-shot IC attempts to bypass this by leveraging pre-trained vision-language models like CLIP and large-scale language models (LMs) like GPT-2 or BERT. Current approaches generally fall into two categories:
- Training-free methods: These use CLIP to guide a frozen language model during inference. While they generalize well to diverse topics, they often "hallucinate"—imagining details not present in the image—due to the noisy nature of CLIP’s training data.
- Text-only-training methods: These fine-tune an LM on a specific text corpus. While they produce more objective descriptions, they suffer from "catastrophic forgetting," losing the broad world knowledge (e.g., specific celebrities or landmarks) originally present in the pre-trained model.
MeaCap aims to bridge this gap by combining the objectivity of trained models with the broad knowledge of training-free approaches through an external memory mechanism.
Methodology
The core innovation of MeaCap is its Retrieve-then-Filter pipeline and a specialized Memory-Augmented Fusion Score.
External Textual Memory
Instead of merely training on a text corpus, MeaCap treats it as a searchable "memory." This allows the model to access a vast repository of world knowledge without overwriting its internal parameters.
Retrieve-then-Filter Module
- Retrieve: Given an image, the system uses CLIP to find the most relevant sentences from the external memory (e.g., the CC3M corpus).
- Parse & Filter: These sentences are decomposed into Subject-Predicate-Object (SPO) triplets. The system clusters these concepts and filters out "noise"—words that appear infrequently across the retrieved sentences—to find a consensus.
- Identify: It selects the most representative "key concepts" (e.g., "spiderman," "slice lemon pie") from these clusters to serve as a skeleton for the caption.
Keywords-to-Sentence Generation
MeaCap uses these key concepts as anchors for the caption. It employs CBART, a model that iteratively refines a sentence by inserting or replacing words to ensure fluency while staying grounded in the identified concepts.
Memory-Augmented Fusion Score
During word selection, MeaCap calculates a score based on three factors:
- Fluency: How well the word fits the sentence structure.
- Image-Text Similarity: How well the word matches the image via CLIP.
- Text-Text Similarity: How well the word matches the retrieved memory. This acts as a crucial sanity check, preventing the model from straying into hallucinations by ensuring the generated text remains consistent with the retrieved textual evidence.
Experimental Evaluation
The authors evaluated MeaCap on three major benchmarks: MSCOCO and Flickr30K for standard accuracy, and NoCaps for "out-of-domain" performance (objects not seen during training). The external memory was built using the CC3M (Conceptual Captions) corpus.
Key Results
MeaCap achieved state-of-the-art (SOTA) results across multiple zero-shot settings:
- Superior Accuracy: On MSCOCO, MeaCap's training-free version achieved a 42.5 CIDEr score, significantly outperforming previous leaders like ZeroCap (14.6) and ConZIC (13.3).
- Generalization: On the NoCaps "Out-of-domain" subset, MeaCap reached a 50.0 CIDEr score, outperforming DeCap (49.9) while maintaining a more efficient framework.
- Qualitative Success: MeaCap correctly identifies specific entities like "Spider-Man" or "Eiffel Tower" where baseline models produce generic or entirely incorrect descriptions.
As shown in the figure above, baseline models often hallucinate (e.g., calling Spider-Man a "locomotive" or a "person holding a device"). MeaCap's retrieve-then-filter process correctly identifies the core concepts, leading to more accurate and knowledgeable captions.
Discussion and Limitations
MeaCap demonstrates that memory is a powerful buffer against forgetting. By keeping the text corpus as an explicit memory, the model retains its ability to recognize specific characters or landmarks even if they weren't prominent in the training text. Furthermore, the use of in-modal (text-to-text) similarity provides a necessary second opinion to the cross-modal CLIP score.
However, the framework faces some limitations:
- Retrieval Overhead: While currently fast (0.05s on GPU), scaling the memory to billions of sentences could create a computational bottleneck.
- Memory Dependency: Performance is tied to the quality of the external memory. If a concept is entirely absent from the memory, the filtering step may struggle to validate it.
Future work may involve extending this memory-augmented approach to other vision-language tasks, such as Visual Question Answering (VQA).
Summary updated