NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Counterfactual GAN for Debiased Text-to-image Synthesis

Xianghua Kong, Ning Xu, Zefang Sun, Zhewen Shen, Bolun Zheng, Chenggang Yan, Jinbo Cao, Rongbao Kang, An-An Liu

Abstract

Text-to-image generation (T2I) is a complex task to produce images that accurately reflect the content and meaning of the provided textual descriptions. Essentially, not every word in the sentence has a corresponding visual appearance. For example, the non-visual words “are” and “a” do not have corresponding visual regions, whereas the visual words “men" and “basketball" are crucial to generating visual regions. Existing methods treat all words equally to produce images, without distinguishing between visual and non-visual words. Gradients from non-visual words can introduce harmful bias that diminishes the total effect of textual guidance in generating image content. This paper presents a new debiased text-to-image synthesis method with a counterfactual learning scheme. First, we build a causal graph for text-to-image synthesis, which stands in the cause-effect interpretation of visual and non-visual words. Second, we treat the non-visual words as confounders that introduce misleading associations during the image generation process. To mitigate the influence of non-visual words, we conceptualize the process as calculating the Natural Direct Effect on the generated visual features and use the Total Indirect Effect to produce the final image for debiased text-to-image generation. By using our method on several existing models, significant improvements can be achieved in two prevailing datasets.

Introduction

Current text-to-image (T2I) models often struggle because they treat every word in a prompt—from "the" and "is" to "volcano" and "tiger"—with equal weight. When a model receives a prompt like "Two men are playing basketball on a sunny day," most systems encode the entire string into a single vector. However, words like "are," "on," and "a" lack a direct visual counterpart. In causal terms, these non-visual words act as confounders.

Figure 1: Mapping between input text and visual regions, highlighting the distinction between visual and non-visual words.

Because existing models do not distinguish between visual and non-visual words, the gradients from these "filler" words can introduce harmful biases or spurious correlations. This language bias competes with the "good" visual words (like "men" or "basketball"), often diluting the model's focus and leading to blurry details or missing objects. The challenge lies in maintaining the grammatical context provided by non-visual words while stripping away the noise they introduce.

Methodology: Counterfactual Causality

The proposed debiasing framework is rooted in Counterfactual Causality. The approach follows three main steps:

  1. Word Differentiation: The TextRank algorithm is used to automatically split a sentence into "visual words" (keywords) and "non-visual words" (filler words).
  2. Causal Graph Construction: The T2I process is modeled using two scenarios:
  3. Factual (Total Effect): The standard process where both visual and non-visual words influence the image features.
  4. Counterfactual (Natural Direct Effect): A "what if" scenario where the model is given only the non-visual words (with visual words masked out). This captures the pure bias/noise introduced by the filler words.
  5. The Subtraction Logic: To generate the final, debiased image, the model calculates the Total Indirect Effect (TIE). It takes the features from the factual path and subtracts the "bias" features identified in the counterfactual path.
Figure 5: Causal graphs representing (a) the factual scenario and (b) the counterfactual scenario used for debiasing.

This logic is implemented within a GAN architecture (specifically building on DF-GAN). The generator uses six upsampling fusion blocks, with the counterfactual correction applied at the third block to balance high-level semantics and fine-grained detail.

Evaluation and Results

The model was evaluated on two industry-standard benchmarks: the CUB (Caltech-UCSD Birds-200-2011) dataset and MS COCO.

The Counterfactual GAN outperformed several state-of-the-art models (including AttnGAN, DM-GAN, and DF-GAN) across both quantitative and qualitative metrics:

  • Quantitative Performance: On the CUB dataset, the model achieved a 20.5% reduction in FID (Fréchet Inception Distance). On the more complex MS COCO dataset, it saw a 38.4% improvement in FID, dropping from 19.32 to 11.90.
  • Qualitative Results: Visual outputs demonstrated significantly clearer details. For instance, specific textual mentions like "grey feet" were accurately rendered, whereas baseline models often produced blurry or incorrectly colored regions. In COCO, the model excelled at rendering complex objects like train tracks and locomotive details.

Discussion and Conclusion

A key insight of this work is that non-visual words are "frenemies"—they provide necessary grammatical context but also introduce implicit semantic bias. By using causality as a filter, the authors "subtract" noise in a principled manner rather than relying on simple attention masking.

While the results are promising, the system's dependency on the TextRank keyword extractor remains a potential point of failure. Future work could involve adapting this counterfactual logic to Diffusion Models, which have become the new standard in image synthesis, and exploring the computational trade-offs of running dual paths during training.

Summary updated

BibTeX
@article{kong2025counterfactual,
  author = {Xianghua Kong and Ning Xu and Zefang Sun and Zhewen Shen and Bolun Zheng and Chenggang Yan and Jinbo Cao and Rongbao Kang and An-An Liu},
  title = {{Counterfactual GAN for Debiased Text-to-image Synthesis}},
  journal = {Multim. Syst.},
  year = {2025},
  doi = {10.1007/s00530-024-01633-0},
}
Figure