Abstract
Traditional image captioning models rely on auto-regressive, left-to-right generation, which limits their ability to leverage holistic sentence context. This paper introduces DDCap, a discrete diffusion model tailored for text generation. By treating captioning as an iterative refinement process of discrete tokens, DDCap overcomes the challenges of categorical data and variable text lengths. Experimental results on the COCO benchmark demonstrate that DDCap achieves competitive accuracy and significantly outperforms traditional models in complex tasks like caption infilling.
Introduction: The Challenge of Text Diffusion
Most state-of-the-art image captioning systems are auto-regressive, predicting words sequentially. While effective, this constraint prevents the model from considering the entire sentence structure during generation. Diffusion models, which have revolutionized image generation, offer a flexible alternative by iteratively refining a noisy input. However, applying diffusion to text is non-trivial because text is categorical, short, and has varied lengths, unlike the continuous and fixed-resolution nature of image pixels.
Naively applying diffusion to text often leads to poor performance, as models can be overwhelmed by [MASK] tokens or inadvertently overwrite correct predictions during refinement. DDCap addresses these issues through specialized architectural designs.
Methodology: The DDCap Framework
DDCap is a discrete diffusion model engineered for the nuances of language. Its architecture centers on a bidirectional Transformer that processes image features and text tokens simultaneously. Key innovations include:
- Text Length Prediction: Unlike images with fixed resolutions, captions vary in length. DDCap uses a dedicated branch, utilizing a CLIP Image Encoder's
[CLS]token, to predict the total caption length upfront, initializing the appropriate number of slots. - Best-First Inference: To prevent the model from flipping correct words back into noise, DDCap identifies tokens with the highest confidence scores and "locks" them in during the iterative refinement process.
- Concentrated Attention Mask (CAM): Early in diffusion, most tokens are uninformative masks. CAM restricts attention flow to prevent these masks from overwhelming the signal, forcing the model to focus on the emerging words.
- Image-Free Training: By occasionally training without visual input, the model learns a strong internal language prior, which is balanced with visual information during inference to ensure grammatical and contextual coherence.
Experimental Setup and Datasets
The model was evaluated on the COCO (Common Objects in Context) dataset using the Karpathy split. To achieve peak performance, the researchers utilized a 4M Vision-Language Pre-training suite, which aggregates data from COCO, Conceptual Captions (CC), SBU Captions, and Visual Genome (VG).
Key Results and Insights
DDCap demonstrates that bidirectional context is a powerful asset for image captioning.
- Competitive Accuracy: On the COCO benchmark, DDCap achieved a CIDEr score of 125.1, matching the performance of well-established auto-regressive frameworks.
- Infilling Dominance: The model's bidirectional nature makes it exceptionally strong at caption infilling (e.g., "A child holding a [MASK] umbrella"). In this task, DDCap reached a CIDEr of 230.3, significantly beating the auto-regressive baseline of 203.5.
- Ablation Analysis: Best-first inference was identified as the most critical design element, providing the single largest jump in performance (from 20.6 to 45.2 CIDEr in controlled settings).
Qualitative analysis reveals that DDCap follows a "sketch-to-detail" approach, typically predicting simple objects and articles first before filling in prepositions, adjectives, and specific nouns to ensure grammatical correctness.
Conclusion and Future Work
DDCap represents a significant advancement in applying diffusion models to discrete language tasks. While it excels in bidirectional context and infilling, challenges remain regarding word repetition and the computational cost of multiple inference steps. Future research will focus on scaling the model to larger datasets and refining the architecture to mitigate repetition without relying on post-processing.
Summary updated