Guiding image captioning models toward more specific captions

Simon Kornblith, Lala Li, Zirui Wang, Thao Nguyen

Abstract

Standard image captioning models frequently generate generic descriptions (e.g., 'a dog') because they are trained to maximize the likelihood of human-provided references, which are often non-specific. This research explores the application of Classifier-Free Guidance (CFG) and Language Model (LM) guidance during the decoding phase to encourage the generation of more descriptive, image-specific captions. While these methods significantly improve image-retrieval performance and fine-grained recognition, they reveal a fundamental trade-off with traditional reference-based similarity metrics like CIDEr.

Introduction: The Problem of Generic Captions

When humans label images for datasets like MS-COCO, they often provide 'safely generic' descriptions. For instance, a specific breed of dog might simply be labeled 'a dog.' Models trained on these datasets learn to replicate this behavior to minimize loss, leading to two primary issues:

  1. Lack of Specificity: Captions fail to uniquely identify the specific visual content of an image.
  2. Metric Misalignment: Standard metrics like CIDEr or BLEU reward models for matching the generic nature of human references, effectively penalizing more accurate, specific descriptions (e.g., identifying a 'station wagon' when the ground truth says 'car').

Methodology: Guiding the Decoding Process

The authors propose two strategies to modify the decoding distribution at inference time without retraining the entire model.

Classifier-Free Guidance (CFG)

Adapted from diffusion models for autoregressive captioning, CFG involves fine-tuning a 'bottleneck' version of the CoCa (Contrastive Captioners) architecture. During training, image conditioning is occasionally masked. At inference, the model calculates the difference between the conditional distribution $p(\text{caption}|\text{image})$ and the unconditional distribution $p(\text{caption})$. A guidance scale $\gamma$ is used to amplify this difference: $$\tilde{f}_\theta = f_\theta(\text{tokens}, \text{image}) + \gamma(f_\theta(\text{tokens}, \text{image}) - f_\theta(\text{tokens}, \mathbf{0}))$$ This effectively pushes the model toward text that is highly dependent on the visual input and unlikely to appear in a vacuum.

Language Model (LM) Guidance

This approach uses a separate, pre-trained Large Language Model to shift the captioning model's prior. By few-shot prompting the LM with highly descriptive examples, the captioner is steered toward a more detailed style, which is particularly effective for models trained on noisy web-scale data (alt-text) that often lacks the quality of curated datasets.

Results and the Pareto Frontier

The research identifies a clear 'Pareto Frontier' representing the trade-off between reference-based metrics (CIDEr) and reference-free metrics (CLIPScore). As the guidance scale $\gamma$ increases, captions become more specific, leading to higher CLIPScores and dramatically improved image retrieval. However, these captions deviate from the generic human ground truth, causing CIDEr scores to drop.

Qualitative and quantitative effects of Classifier-Free Guidance (CFG) on caption specificity and retrieval performance.

Key quantitative findings include:

  • Retrieval Performance: On MS-COCO, increasing $\gamma$ from 1.0 to 2.0 improved Recall@1 from 26.5% to 44.6%.
  • Fine-grained Accuracy: On the Stanford Dogs dataset, breed identification rose from a mere 1.9% with standard decoding to 42.4% with CFG ($\gamma=2.0$).
  • Zero-Shot Gains: LM guidance allowed a model trained on noisy web data to improve its CIDEr score from 21.8 to 59.7 by simply using 50 high-quality MS-COCO examples as prompts.

Discussion and Limitations

While guidance significantly enhances specificity, it introduces new challenges. High CFG scales ($\gamma > 3.0$) can result in agrammatical or repetitive text. Conversely, while LM guidance maintains grammaticality, it is more prone to 'hallucinations'—generating plausible but non-existent details based on the prompt's context rather than the image itself. Furthermore, retrieval performance eventually saturates and declines at very high guidance scales as the generated text becomes too distorted. Future work may focus on better grounding techniques to ensure descriptive captions remain both grammatical and faithful to the visual evidence.

Summary updated

BibTeX
@inproceedings{kornblith2023guiding,
  author = {Simon Kornblith and Lala Li and Zirui Wang and Thao Nguyen},
  title = {{Guiding image captioning models toward more specific captions}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
}
Figure