DiffCap: Exploring Continuous Diffusion on Image Captioning

Yufeng He, Zefan Cai, Xu Gan, Baobao ChangarXiv 2023 · DOI

Abstract

Image captioning has traditionally relied on autoregressive (AR) models, which often suffer from sequential error accumulation and limited output diversity. We present DiffCap, a novel non-autoregressive (NAR) framework that leverages continuous diffusion models for text generation. By operating on word embeddings rather than discrete tokens, DiffCap simplifies the NAR architecture while significantly enhancing caption diversity. Our results on MS-COCO demonstrate competitive performance and superior creativity compared to state-of-the-art models.

Introduction

Most modern image captioning systems employ autoregressive (AR) decoding, predicting tokens sequentially. While effective, these models are prone to error propagation and tend to produce generic, "safe" descriptions. Non-autoregressive (NAR) models offer a parallel alternative but often involve complex multi-stage designs.

DiffCap bridges this gap by applying the principles of diffusion models—highly successful in image generation—to the domain of language. Unlike previous attempts that struggle with the discrete nature of text, DiffCap utilizes a continuous diffusion process over word embeddings, guided by visual features.

Methodology

DiffCap treats image captioning as a continuous diffusion process consisting of four primary components:

  1. Visual Encoding: A pre-trained backbone (e.g., ViT or CLIP) extracts global image features to condition the generation process.
  2. Continuous Text Diffusion: Tokens are mapped to a continuous embedding space. During training, Gaussian noise is added (forward process), and a reinitialized BERT-based decoder is trained to reverse this noise (denoising) based on the noisy input and image features.
  3. [UNK] Masking: To prevent the generation of "Unknown" tokens, a specific loss mask is applied during training, forcing the model to converge on valid vocabulary.
  4. Rounding: During inference, denoised continuous vectors are mapped back to discrete tokens via a linear layer and softmax.
Overview of the DiffCap architecture, illustrating the integration of visual features with the BERT-based diffusion process.

Experiments and Key Insights

The model was evaluated on the MS-COCO and Flickr30k benchmarks. Several key findings emerged:

  • Diversity as a Core Strength: Unlike AR models that often produce deterministic outputs, DiffCap's stochastic nature allows it to generate multiple distinct, valid descriptions for a single image.
  • Encoder Impact: Utilizing CLIP as the visual encoder significantly outperformed standard ViT, likely due to CLIP's pre-existing alignment between visual and textual modalities.
  • Architectural Simplicity: By using a standard BERT-like decoder, DiffCap avoids the complexity of multi-stage refinement typical in other NAR models.

Results

DiffCap achieves competitive quality on the MS-COCO dataset with a BLEU@4 score of 31.6, matching state-of-the-art NAR models like MNIC. However, its primary advantage lies in diversity. DiffCap achieved an Inter-Distinct score of 46.61, vastly outperforming the BLIP model's score of 6.19.

Qualitative comparison of captions generated by BLIP, GIT_B, and DiffCap, highlighting the superior diversity of DiffCap's outputs.

As shown in the qualitative results, DiffCap generates a variety of semantically rich descriptions for the same scene, whereas traditional models often repeat a single generic sentence.

Limitations and Future Work

While promising, DiffCap faces challenges common to diffusion models, such as slower inference due to the iterative sampling process (denoising from $T=2000$ down to 0). Additionally, the "semantic gap" in embedding space—where Euclidean distance doesn't always map to semantic similarity—can lead to minor grammatical inconsistencies. Future research will focus on better aligning the diffusion process with semantic word distances and optimizing sampling speed.

Summary updated

BibTeX
@misc{he2023diffcap,
  author = {Yufeng He and Zefan Cai and Xu Gan and Baobao Chang},
  title = {{DiffCap: Exploring Continuous Diffusion on Image Captioning}},
  year = {2023},
  eprint = {2305.12144},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.12144},
}
Figure