SynthCap: Augmenting Transformers with Synthetic Data for Image Captioning

Davide Caffagni, Manuele Barraco, Marcella Cornia, Lorenzo Baraldi, Rita Cucchiara

Abstract

Image captioning models typically rely on massive, noisy web-crawled datasets to achieve high performance. This paper introduces SynthCap, a framework that augments training data by probabilistically replacing real images with synthetic ones generated by Stable Diffusion. This simple yet effective strategy significantly boosts the performance of a standard Transformer model, proving that AI-generated images are a viable, high-quality alternative to web scraping for vision-language tasks. Our experiments on MS COCO demonstrate that a 50% replacement strategy optimizes performance, allowing a baseline Transformer to outperform several complex state-of-the-art architectures.

Introduction

To push the state-of-the-art in image captioning, researchers usually train models on massive datasets scraped from the web (e.g., downloading images paired with their HTML "alt" text). However, web data is notoriously noisy, often poorly aligned with the visual content, and carries ethical and bias concerns.

SynthCap addresses this by exploring whether modern generative AI, specifically Stable Diffusion, can create synthetic training data on demand. The goal is to determine if synthetic images can effectively augment standard datasets to improve captioning models, bypassing the drawbacks of web-crawled data while still satisfying the scaling requirements of modern neural networks.

Methodology

The core architecture of SynthCap is intentionally simple: a standard encoder-decoder Transformer. It utilizes a frozen, pre-trained CLIP model (ViT-L/14) to extract visual features, which are then processed as visual tokens and fed into a Transformer decoder to generate text.

Overview of the SynthCap architecture and the synthetic data generation process.

The primary innovation is the synthetic data augmentation pipeline:

  1. Generation: Stable Diffusion generates synthetic images based on ground-truth captions from the training set.
  2. Probabilistic Replacement: During training, a hyperparameter ($\lambda_s$) dictates the probability of swapping a real image for its synthetic counterpart.
  3. Targeted Learning: If a real image is used, the model learns from a randomly sampled reference caption. If a synthetic image is used, the model is forced to focus specifically on the caption used to generate that image.

The model is trained in two phases: cross-entropy pre-training followed by reinforcement learning (Self-Critical Sequence Training) optimizing for the CIDEr metric.

Experimental Results

Experiments were conducted on the MS COCO benchmark using the standard "Karpathy splits." The authors introduced a parallel "Synthetic COCO" dataset generated via Stable Diffusion to facilitate the augmentation process.

The 50/50 Sweet Spot

A key finding of the study is the impact of the replacement probability $\lambda_s$. As shown in the ablation study, the best performance was achieved when replacing real images with synthetic ones 50% of the time ($\lambda_s = 0.5$). At this level, the model achieved a CIDEr score of 128.6 during the cross-entropy phase.

Ablation study on the synthetic replacement probability $\lambda_s$ on the MS COCO dataset, highlighting the peak performance at 0.5.

Performance Benchmarks

Using the 50% synthetic augmentation strategy, SynthCap improved the baseline Transformer's CIDEr score from 126.5 to 128.6. After the full CIDEr optimization phase, SynthCap achieved a CIDEr score of 143.1 on the Karpathy test split, outperforming the baseline (141.9). On the official COCO online test server, SynthCap achieved a CIDEr score of 142.6 (c40) and a BLEU-4 of 42.8 (c5), beating several established models like Up-Down, AoANet, and X-Transformer without requiring complex architectural additions.

Discussion and Insights

Analysis of the data revealed that synthetic images often align better with their text descriptions than real images do. When measuring CLIP image-text similarity, synthetic images showed a slightly higher affinity to their captions, likely because generative models are highly literal. This makes their outputs excellent, noise-free training signals.

However, a "Reality Gap" remains. When the replacement probability was set to 100% ($\lambda_s = 1.0$), performance plummeted. This indicates that the model still requires real images to generalize to the natural distribution of real-world photography. Furthermore, synthetic data augmentation outperformed a retrieval-based approach (swapping images for similar real ones), proving that the generative approach provides uniquely useful training data.

Conclusion

SynthCap demonstrates that synthetic data is a powerful tool for augmenting vision-language models. By strategically mixing real and AI-generated images, researchers can achieve state-of-the-art performance while reducing reliance on noisy web-crawled data. Future work will involve scaling this approach to larger, more diverse datasets beyond MS COCO.

Summary updated

BibTeX
@inproceedings{caffagni2023synthcap,
  author = {Davide Caffagni and Manuele Barraco and Marcella Cornia and Lorenzo Baraldi and Rita Cucchiara},
  title = {{SynthCap: Augmenting Transformers with Synthetic Data for Image Captioning}},
  booktitle = {ICIAP},
  year = {2023},
  doi = {10.1007/978-3-031-43148-7\_10},
}
Figure