Debiasing Text-to-Image Diffusion Models

Ruifei He, Chuhui Xue, Haoru Tan, Wenqing Zhang, Yingchen Yu, Song Bai, Xiaojuan Qi · DOI

Abstract

Current text-to-image (TTI) models, such as Stable Diffusion, frequently exhibit significant social biases, defaulting to stereotypes regarding gender and ethnicity due to biased training data and guidance mechanisms. This paper introduces Iterative Distribution Alignment (IDA), a lightweight and efficient method designed to rebalance these distributions. By treating debiasing as a weight optimization problem, IDA achieves near-uniform demographic representation in just 1–3 iterations, significantly outperforming reinforcement learning approaches in speed while maintaining high image fidelity.

Introduction

When prompted to generate a "photo of a CEO," modern text-to-image models often produce a homogenous set of images—typically middle-aged white men. These biases are not merely reflections of the training data but are often amplified by the models themselves. The root causes are two-fold: the massive, uncurated web-scraped datasets used for training and the CLIP models used to guide the generation process.

Existing solutions to this problem generally fall into two categories: post-hoc filtering or complex optimization. However, resolving deep-seated social bias across multiple intersecting groups (such as the six categories of the Fitzpatrick Skin Scale) remains a difficult optimization challenge. Many current methods are either too computationally expensive for practical deployment or fail to achieve a truly balanced distribution across diverse demographics.

Methodology: Iterative Distribution Alignment (IDA)

The researchers frame the debiasing task as a weight optimization problem, building upon the foundations of "Safe Latent Diffusion" (SLD). While SLD uses text descriptions of unsafe concepts to nudge the diffusion process away from harmful content, IDA extends this to multi-directional guidance.

From RL to Residual Learning

Initially, the authors explored a Reinforcement Learning (RL) approach using Policy Gradients. Although effective at achieving balance, the RL method was prohibitively slow, requiring over 50,000 iterations to converge. This led to the development of Iterative Distribution Alignment (IDA), a residual learning approach.

IDA operates through a simple but effective feedback loop:

  1. Generation: The model generates a batch of images based on a specific prompt.
  2. Classification: An automated classifier (utilizing FaceNet and CLIP) measures the demographic distribution of the generated batch.
  3. Residual Calculation: The system calculates the "residual"—the mathematical difference between the current biased distribution and a target uniform distribution.
  4. Weight Update: This residual is used to update the weights for the next iteration, punishing over-represented attributes and encouraging under-represented ones within the latent guidance.

This iterative process allows the model to quickly find the optimal weights for a balanced output without requiring extensive retraining.

Experimental Setup

The study evaluated the performance of Stable Diffusion across several key demographic and economic axes:

  • Gender: Binary classification (Male/Female).
  • Ethnicity: The Fitzpatrick Skin Scale, categorizing skin types into six distinct groups (I to VI).
  • Occupations: Prompts included high-paying roles (CEO, Politician, Professor) and low-paying roles (Cashier, Housekeeper, Teacher) to observe the intersection of professional and social stereotypes.

Key Results and Insights

Efficiency and Speed

One of the most significant findings is the disparity in efficiency between RL and IDA. IDA achieves in 5–20 minutes on a single A100 GPU what the RL approach would take 11 days to accomplish. This suggests that the "black-box" nature of diffusion models is better addressed by simple iterative feedback than by high-variance policy gradients.

Distributional Accuracy

The quantitative shifts observed were substantial:

  • Gender: For the generic prompt "person," Stable Diffusion's baseline of 74% male shifted to a balanced 49% male and 51% female after two IDA iterations.
  • Ethnicity: The KL divergence (measuring the distance from a uniform distribution) dropped from 0.238 to 0.003, indicating near-perfect diversity across skin tones.
  • Occupational Stereotypes: The prompt "CEO" shifted from 100% male to a 64/36 split, while "Cashier" moved from 67% female to a 49/51 split.

Quality Preservation

Crucially, the debiasing process did not degrade image quality. The COCO FID-30k score, a standard metric for image fidelity, remained stable (14.43 for the baseline vs. 15.21 for IDA). This demonstrates that social fairness can be achieved without sacrificing the generative capabilities of the model.

Discussion and Limitations

The success of IDA suggests a potential linear correlation between the model's output and conditional text embeddings, allowing simple linear weight adjustments to effectively steer results. However, the authors note several areas for future exploration:

  • Per-Prompt Optimization: Currently, IDA weights are optimized for specific prompts. Significant changes to a prompt may require re-running the alignment process.
  • Theoretical Framework: While empirically robust, a formal mathematical proof for the effectiveness of this specific iterative update remains an open question.
  • Scope Expansion: Future work could extend IDA to address biases related to age, disability, and broader cultural or geographical representations.

Conclusion

Iterative Distribution Alignment (IDA) provides a fast, effective, and scalable solution to the problem of social bias in text-to-image models. By focusing on distribution alignment rather than individual image editing, IDA ensures that generative AI can produce content that is both high-quality and socially representative.

Summary updated

BibTeX
@misc{he2024debiasing,
  author = {Ruifei He and Chuhui Xue and Haoru Tan and Wenqing Zhang and Yingchen Yu and Song Bai and Xiaojuan Qi},
  title = {{Debiasing Text-to-Image Diffusion Models}},
  year = {2024},
  eprint = {2402.14577},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.14577},
}
Figure