Investigating and Mitigating Object Hallucinations in Pretrained Vision-Language (CLIP) Models

Yufang Liu, Tao Ji, Changzhi Sun, Yuanbin Wu, Aimin Zhou

TL;DR

Large Vision-Language Models (LVLMs) frequently "hallucinate" objects that don't exist in an image, but where does this error originate? This paper demonstrates that the widely used CLIP visual backbone is a primary culprit, failing to identify object hallucinations in up to 80% of test cases. By introducing a fine-grained object-level contrastive loss and counterfactual data augmentation, the authors significantly mitigate these hallucinations in both CLIP and downstream LVLMs without sacrificing general performance.

What Problem Does This Paper Address?

When an LVLM describes a scene, it often confidently includes objects that are completely absent—a phenomenon known as object hallucination. While previous research has focused on fixing the Large Language Model (LLM) alignment or the modality connector, this paper investigates the visual perception module itself: the pretrained CLIP encoder.

The authors discover a fundamental flaw in how CLIP is trained. Standard contrastive pretraining pairs an image with its correct caption and uses captions from other images in the batch as negative examples. Because these negative captions describe entirely different scenes, the model easily distinguishes them without needing to learn fine-grained details about specific object presence or absence. Consequently, CLIP struggles when faced with subtle, object-level errors.

Methods

To teach CLIP to recognize fine-grained object details, the authors developed a two-part strategy:

  1. Counterfactual Data Augmentation: They generated hard negative text samples by perturbing correct image captions. Using an open-vocabulary segmentation model (SEEM) to identify actual objects in an image, they used GPT-4 to alter the captions in two ways:
  2. Inserting Hallucinatory Objects: Adding objects that are either completely random, highly popular across the dataset, or adversarial (frequently co-occurring with present objects but absent in this specific image).
  3. Removing Existing Objects: Deleting or altering descriptions of objects that actually exist in the image.
  4. Fine-Grained Object-Level Contrastive Loss: The authors fine-tuned CLIP using a modified loss function that incorporates these counterfactual negatives ($T^{neg}$). Crucially, they introduced two margin losses:
  5. $L_1$ Loss: Ensures the similarity score between an image and its true caption is higher than its score with a hallucinated caption by a set threshold.
  6. $L_2$ Loss: Acknowledges that a counterfactual caption still contains mostly correct information, forcing the model to score it higher than a completely random caption from another image.
Figure 1: The pipeline of our benchmark creation process. For an image, we first use SEEM (Zou et al., 2023) to identify objects within the image and obtain illusory objects that do not exist in the picture through different sampling strategies. Then we ask GPT to insert or delete objects in the original sentences to create negative samples. We provide both positive and negative samples to the CLIP model to observe if the model predicts the positive samples as having the highest score. This image is from the NoCaps dataset, and the model is CLIP ViT-B/32.

Datasets

The authors introduced the Object Hallucination Detection (OHD-Caps) benchmark to evaluate how well models spot object hallucinations in a paired comparison setup.

  • Composition: Curated from subsets of COCO, Flickr30K, and NoCaps (used as an out-of-domain test set to evaluate zero-shot generalization to unseen object classes).
  • Structure: It contains 16k training, 1k development, and 1.5k test samples. Each image is paired with 1 positive caption and 27 carefully engineered negative captions.

For downstream evaluation, they tested the enhanced CLIP on standard zero-shot classification datasets (ImageNet-1K, CIFAR-10/100, Eurosat, DTD, GTSRB, STL10) and integrated it into LLaVA-1.5 to evaluate on LVLM benchmarks like POPE, CHAIR, AMBER, MME, and VQAv2.

Key Insights and Ideas

  • CLIP is a Root Cause: Vanilla CLIP models perform dismally at detecting hallucinations. For instance, the widely used CLIP ViT-L/14 correctly identifies the true caption over hallucinated ones only 19.0% of the time.
  • High Data Efficiency: Fixing this issue doesn't require massive datasets. The authors found that fine-tuning CLIP with just 1% of their augmented data (only 160 images) caused hallucination detection accuracy to skyrocket from 20% to 60%.
Figure 2: The performance of the model on the OHD- Caps dataset with different training data volumes pro- vided. We report the average results of three random seeds.
  • Downstream Benefits are Direct: Replacing the standard CLIP encoder in LLaVA-1.5 with the authors' fine-tuned version significantly reduced object hallucinations in the downstream model's generated text, proving that visual encoder improvements directly transfer to the final language output.

Key Results

  • OHD-Caps Benchmark: The authors' method achieved massive improvements. Ours-B/32 jumped from a baseline accuracy of 14.3% to 82.5%, and Ours-L/14 improved from 23.3% to 88.8% average accuracy across COCO, Flickr30k, and NoCaps.
Quantitative results comparing baseline CLIP models against the authors' fine-tuned versions on the OHD-Caps benchmark.
  • Preserved Zero-Shot Capabilities: Unlike previous methods (like NegCLIP or CECLIP) which suffered severe drops in standard image classification accuracy after fine-tuning, the proposed method maintained standard zero-shot performance (averaging 66.0% top-1 accuracy vs. the baseline's 65.6%).
  • LLaVA-1.5 Integration: When plugged into LLaVA-1.5, the new encoder boosted the model's F1 score on the NoCaps POPE benchmark from 80.2 to 83.2 and reduced the CHAIR generative hallucination metric.

Limitations and Future Work

While highly effective, the authors note a few key limitations:

  • Scope of Hallucinations: The study focuses strictly on object hallucinations. It does not address other common hallucination types in LVLMs, such as spatial relationships, attributes (e.g., color, size), or actions.
  • Benchmark Scale: Due to API budget constraints when querying GPT-4, the OHD-Caps evaluation benchmark is relatively small compared to some standard compositional understanding datasets.
  • Encoder Variety: The evaluation was restricted to the CLIP family of vision encoders and did not explore other architectures, such as the ResNet variant NFNet-F6 used in models like Flamingo.

Summary updated

BibTeX
@inproceedings{liu2024investigating,
  author = {Yufang Liu and Tao Ji and Changzhi Sun and Yuanbin Wu and Aimin Zhou},
  title = {{Investigating and Mitigating Object Hallucinations in Pretrained Vision-Language (CLIP) Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.1016},
}
Figure