CF-VLM:CounterFactual Vision-Language Fine-tuning

Jusheng Zhang, Kaitong Cai, Yijia Fan, Jian Wang, Keze Wang

Abstract

Vision-Language Models (VLMs) like CLIP often achieve high performance by exploiting superficial statistical correlations rather than understanding the underlying causal logic of a scene. This leads to failures in compositional reasoning and frequent visual hallucinations. We introduce CF-VLM (CounterFactual Vision-Language Fine-tuning), a novel framework designed to enhance causal reasoning by training models on "minimal semantic edits." By utilizing synthetic counterfactual samples—where only a single attribute or action is altered—CF-VLM teaches models to identify the specific semantic shifts that determine factual truth. Our approach employs a triple-objective training strategy and a large-scale synthetic dataset of 2 million counterfactual pairs, resulting in significant improvements in fine-grained discrimination and a reduction in hallucinations across benchmarks like Conme, ARO, and POPE.

Introduction: The Challenge of Compositional Reasoning

While models like CLIP have revolutionized cross-modal alignment, they are often "right for the wrong reasons." They tend to rely on superficial statistical correlations rather than a deep understanding of causal logic. For instance, a model might assign a high score to the caption "A man runs in the park" simply because it detects a "man" and a "park," even if the person in the image is a woman or is standing still.

This lack of compositional reasoning—the ability to understand how individual components like objects, attributes, and relations combine to form meaning—is a major bottleneck. Current models struggle with "causal decision points": the specific, often subtle differences that determine whether a description is factually true or a "counterfactual" lie. Traditional training strategies often change too many elements at once, making it difficult for the model to isolate which specific change affects the semantic meaning.

Comparison between traditional Triplet Clip and CF-VLM training strategies. CF-VLM focuses on 'one change' at a time to improve recognition.

Methodology: Learning from Counterfactuals

CF-VLM centers the learning process around counterfactual samples to teach the model the "why" behind a match. The framework consists of two primary stages:

1. Counterfactual Data Generation

Using a fine-tuned Stable Diffusion XL (SDXL) model and Qwen2-72B-Instruct, the researchers generate "minimal yet semantically crucial edits." They create two types of data:

  • Complete Counterfactual Scenario Pairs: Both the image and text are modified to represent a logically consistent but different "parallel reality."
  • Minimally Edited Counterfactual Images: Only the image is changed (e.g., changing a red apple to a green one) and paired with the original text to serve as a difficult "hard negative."

2. Triple-Objective Training

The model is optimized using a weighted sum of three distinct loss functions:

  • $L_{align}$ (Foundational Alignment): A standard contrastive loss to maintain basic cross-modal matching capabilities.
  • $L_{csd}$ (Counterfactual Scenario Discrimination): Forces the model to distinguish the factual anchor from coherent "parallel" counterfactual scenarios.
  • $L_{fcd}$ (Fine-Grained Causal Discrimination): The core innovation. It sharpens the model’s sensitivity to specific semantic shifts caused by minimal edits (e.g., distinguishing between "kicking" and "not kicking").
The CF-VLM pipeline: Counterfactual data generation using SDXL and a triple-objective training loss ($L_{align}$, $L_{csd}$, $L_{fcd}$).

Experimental Setup and Datasets

The models were trained on filtered versions of CC12M (8.6M pairs) and CC3M (2.6M pairs). A key contribution of this work is the introduction of a new resource: a large-scale dataset containing 2 million synthetic counterfactual image-text pairs. Evaluation was conducted across several dimensions including compositional reasoning (Conme, ARO), generalization (ImageNet-1k), and hallucination mitigation (POPE, MME).

Key Results and Insights

CF-VLM consistently outperformed strong baselines, including TripletCLIP and NegCLIP, as well as larger instruction-tuned models.

  • Compositional Reasoning: On the Conme benchmark, CF-VLM (ViT-B/32) achieved 59.13% accuracy, a +4.7 point improvement over standard fine-tuning. When applied to the Qwen-VL 7B backbone, it reached 87.57% (+4.9 points).
  • Attribute and Relation Recognition: The model saw massive gains on Visual Genome, hitting 90.3% on VG-Attr compared to 61.9% for zero-shot CLIP.
  • Hallucination Mitigation: On the MME benchmark, it showed notable improvements in hallucination-sensitive subtasks like Color (+2.0) and Position (+1.4).
  • Optimal Training Ratio: The authors found that a counterfactual-to-factual ratio of 4:1 provided the best trade-off between performance and training stability.

These results suggest that visual hallucinations are often failures of fine-grained alignment. By improving causal reasoning through $L_{fcd}$—which acts as a "microscope" for semantic shifts—CF-VLM naturally mitigates these errors.

Conclusion and Future Work

CF-VLM demonstrates that training on "parallel realities" and minimal semantic edits is a powerful way to move beyond binary matching toward true causal understanding. While the framework currently relies on synthetic data from generative models, it sets a new standard for compositional reasoning in VLMs. Future work will explore human-in-the-loop editing for higher semantic fidelity and extending these causal principles to generative tasks like Visual Question Answering (VQA).

Summary updated

BibTeX
@inproceedings{zhang2025cf,
  author = {Jusheng Zhang and Kaitong Cai and Yijia Fan and Jian Wang and Keze Wang},
  title = {{CF-VLM:CounterFactual Vision-Language Fine-tuning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=0qGtaRTsCo},
}
Figure