GradBias: Unveiling Word Influence on Bias in Text-to-Image Generative Models

Moreno D'Incà, Elia Peruzzo, Massimiliano Mancini, Xingqian Xu, Humphrey Shi, Nicu Sebe

TL;DR

Text-to-image models suffer from complex biases far beyond just gender and race, but detecting them usually requires knowing what to look for in advance. This paper introduces an open-set framework that uses LLMs and VQA to automatically discover novel biases (like laptop brands or train colors) and leverages gradient backpropagation (GradBias) to pinpoint exactly which prompt words are driving those biases.

What Problem Does This Paper Address?

Traditional bias detection in text-to-image (T2I) models is limited to "closed-set" categories—predefined attributes like age, gender, and ethnicity. However, generative models harbor hidden, domain-specific biases (e.g., rendering all laptops as MacBooks or all kitchens as modern/western) that go unnoticed by standard evaluation suites.

Furthermore, even if a bias is detected, understanding why it happened is incredibly difficult. Existing methods to track how specific words influence bias rely on brute-force word replacement (swapping words with synonyms and regenerating images), which is computationally prohibitive.

Closed-set vs. Open-set bias detection pipelines

Methods

The authors propose a unified, modular pipeline consisting of two main variants: OpenBias (for bias discovery) and GradBias (for word-level explanation).

The core pipeline operates in three stages:

  1. Bias Proposal: An LLM (Llama 2) analyzes a set of text captions to propose potential biases, their possible classes, and a target question (e.g., "What is the brand of the laptop?"). A two-stage filtering process ensures attributes explicitly mentioned in the prompt are ignored.
  2. Image Generation: The target T2I model (e.g., Stable Diffusion) generates images from the captions.
  3. Bias Assessment: A Vision-Question-Answering (VQA) model (Llava) answers the LLM-generated questions based on the generated images.

From here, the two variants diverge:

  • OpenBias quantifies the overall bias intensity by calculating the normalized entropy of the VQA model's answers. It can analyze bias globally (context-free) or per-caption (context-aware).
  • GradBias identifies word-level influence. Instead of swapping words, it computes the cross-entropy loss of the VQA model's prediction and backpropagates the gradients directly to the text tokens of the T2I model. The magnitude of the gradient for each token reveals its relative influence on the generated bias.
The general pipeline for open-set bias detection, quantification, and word-level explanation

Datasets

  • COCO and Flickr30k: Used as sources of real-world textual captions to feed into the bias proposal module.
  • GradBias Evaluation Dataset: A newly introduced benchmark containing 391 captions across 11 distinct biases (discovered by OpenBias) to evaluate word-level influence. Ground truth was established using an optimized word-removal strategy.

Key Insights and Ideas

  • The Open-Set Surprise: T2I models exhibit strong biases toward non-social attributes. For instance, Stable Diffusion XL has a massive bias toward generating Apple laptops and yellow trains from completely neutral prompts.
  • Context is King: Bias isn't static. The intensity of a bias changes significantly depending on the surrounding context of the sentence. For example, "A military is running" vs. "A person is running" shifts gender bias profiles dramatically, even though both are technically gender-neutral prompts.
  • Neutral Words Trigger Bias: Seemingly benign adjectives or nouns can heavily steer a model's bias. For example, changing "passenger train" to "cargo train" triggers a massive shift toward generating yellow trains.

Key Results

  • Human Alignment: OpenBias closely matches human perception of bias intensity across 15 diverse biases, achieving a low Absolute Mean Error (AME) of 0.15 against human scores.
  • GradBias Performance: GradBias significantly outperforms NLP-based dependency trees and LLM-based prompting baselines. On Stable Diffusion 1.5, 2, and XL, it achieves a top-1 accuracy improvement of up to +12.29% over a random baseline.
  • Data Efficiency: Unlike previous word-replacement methods that require generating hundreds of images per prompt, GradBias operates effectively even with a single generated image ($N=1$), making it highly practical for low-resource settings.

Limitations and Future Work

  • Bias Propagation: The framework relies heavily on foundation models (LLMs and VQAs), which themselves contain inherent biases that might skew the detection results.
  • White-Box Requirement: GradBias requires gradient computation through the T2I text encoder, meaning it cannot be used on closed-source, API-only models like Midjourney or DALL-E 3.
  • Future Directions: The authors suggest integrating this framework into active bias-mitigation loops to dynamically guide T2I models toward fairer generations at inference time using fairer guidance terms.

Summary updated

BibTeX
@article{dinca2025gradbias,
  author = {Moreno D'Incà and Elia Peruzzo and Massimiliano Mancini and Xingqian Xu and Humphrey Shi and Nicu Sebe},
  title = {{GradBias: Unveiling Word Influence on Bias in Text-to-Image Generative Models}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2025},
  doi = {10.1109/tpami.2025.3592901},
}
Figure