Text-Only Training for Image Captioning using Noise-Injected CLIP

David Nukrai, Ron Mokady, Amir Globerson

Introduction

Traditional image captioning models rely heavily on large-scale datasets of images paired with human-annotated descriptions, such as MS-COCO. Curating these datasets is both labor-intensive and expensive. CapDec (Captioning via Decoding) introduces a paradigm shift by enabling the training of high-quality captioning models using only text data. By leveraging the shared embedding space of CLIP and strategically injecting noise during training, CapDec bridges the "modality gap" between vision and language, setting a new state-of-the-art for unsupervised image captioning.

The Modality Gap Challenge

While models like CLIP (Contrastive Language-Image Pre-training) provide a shared vector space for images and text, these embeddings are not perfectly aligned. Even when an image and a text description represent the same concept, their respective embeddings reside in slightly different neighborhoods—a phenomenon known as the modality gap.

If a decoder is trained solely to reconstruct a caption from its CLIP text embedding, it often fails at inference time when presented with an image embedding. The decoder has only learned to interpret a specific point in the text modality, making it brittle when faced with the shifted distribution of the vision modality.

The CapDec Framework

CapDec addresses this gap through a deceptively simple yet effective training pipeline using a frozen CLIP model and a GPT-2 decoder.

Training Process

  1. Text-Only Supervision: The model is trained on a corpus of text without any corresponding images.
  2. Embedding: Each text string is passed through the frozen CLIP text encoder.
  3. Noise Injection: This is the core innovation. Zero-mean Gaussian noise is added to the text embedding, creating a "ball" of uncertainty around the original vector.
  4. Decoding: A lightweight mapping network and a GPT-2 decoder are trained to reconstruct the original text from this noisy embedding.

Inference

At test time, an image is passed through the CLIP image encoder. Because the decoder was trained to handle a region of the embedding space (the "noise ball") rather than just a single point, it is robust enough to generate an accurate caption from the image embedding, even though it never saw an image during training.

The CapDec framework: (a) illustrates the CLIP modality gap, (b) shows the noise-injected training process, and (c) demonstrates zero-shot inference.

Key Insights: Noise as a Bridge

The primary insight of this work is that injecting noise acts as a form of latent-space data augmentation. It forces the decoder to become "modality-agnostic." By learning that any vector within a certain radius of a text embedding should yield the same description, the decoder naturally learns to accommodate the shift inherent in image embeddings.

This approach also enables Zero-Shot Style Transfer. Since the model only requires text to learn a specific linguistic style, a decoder can be trained on specialized corpora (e.g., humorous or romantic text) to generate styled captions for images without ever requiring a paired image-style dataset.

Experimental Results

CapDec was evaluated on standard benchmarks including MS-COCO, Flickr30k, and FlickrStyle10K. The results demonstrate a significant leap over previous unsupervised methods:

  • State-of-the-Art Performance: On MS-COCO, CapDec achieved a CIDEr score of 91.8, nearly doubling the performance of the previous leading unsupervised method, MAGIC (49.3).
  • Robustness: The model showed strong cross-domain performance, maintaining high accuracy when trained on Flickr30k text but tested on MS-COCO images.
  • Ablation of Noise: The authors confirmed that without noise injection, performance drops precipitously. There is an optimal "sweet spot" for the noise scale ($\epsilon$) that maximizes the model's ability to bridge the modality gap without losing semantic clarity.
Performance metrics (CIDEr, ROUGE-L, METEOR, B@4, B@1) as a function of the noise scale epsilon, showing peak performance at specific noise levels.

Limitations and Future Directions

While CapDec represents a major advancement in text-only supervision, it still trails behind fully supervised models (e.g., LEMON at 133.3 CIDEr) that benefit from explicit image-text pairs. Additionally, the current implementation is focused on English; extending this framework to multilingual contexts remains a challenge. Future work may involve more sophisticated modeling of the modality gap beyond simple Gaussian noise to further align the vision and language spaces.

Summary updated

BibTeX
@inproceedings{nukrai2022text,
  author = {David Nukrai and Ron Mokady and Amir Globerson},
  title = {{Text-Only Training for Image Captioning using Noise-Injected CLIP}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  url = {https://openreview.net/forum?id=C_wQu3h4vQ7},
}
Figure