Fair Text-to-Image Diffusion via Fair Mapping

Jia Li, Lijie Hu, Jingfeng Zhang, Tianhang Zheng, Hua Zhang, Di Wang

Abstract

Text-to-image diffusion models often generate demographically biased images due to implicit biases inherited from their training data via text encoders. This paper introduces Fair Mapping, a lightweight, plug-and-play linear network that debiases text embeddings before they reach the image generator. This approach significantly improves demographic fairness across gender and race without requiring expensive model retraining or sacrificing visual quality.

Introduction

When prompted with neutral terms like "a computer programmer" or "a confident person," state-of-the-art models like Stable Diffusion overwhelmingly generate images of white men. This phenomenon stems from generative models learning implicit correlations between demographic traits and specific occupations or traits from biased real-world datasets.

The central challenge lies in disentangling sensitive attributes (race, gender, age) from the target language context. Existing solutions typically involve fine-tuning the entire diffusion model—an expensive process that risks "catastrophic forgetting" and image degradation—or manual prompt engineering. Fair Mapping addresses this by asking: How can we achieve unbiased inference from a biased model efficiently and automatically?

Methodology: The Fair Mapping Approach

Fair Mapping is a model-agnostic, post-processing technique. Instead of modifying the massive U-Net architecture, the authors freeze the base model and insert a small, trainable linear network immediately following the text encoder.

The training process involves three key components:

  1. Metric Definition: The authors quantify Language Bias (the proximity of neutral words to specific demographic attributes in embedding space) and Diffusion Bias (the demographic skew in generated images).
  2. Dual-Objective Training: The linear network maps biased embeddings into a debiased space using two competing objectives:
  3. Semantic Consistency Loss: Ensures the embedding retains its original meaning (e.g., "doctor" still represents a medical professional).
  4. Fairness Loss: Adjusts the embedding to be equidistant from different sensitive attributes, neutralizing implicit assumptions.
  5. Smart Inference: A detector identifies explicit demographic requests (e.g., "female doctor"). If a request is specific, Fair Mapping is bypassed to respect user intent; if the prompt is neutral ("a doctor"), the debiasing network is engaged.

Key Insights

  • Embedding-Visual Correlation: Implicit bias in the text encoder's representation space directly correlates with visual bias in generated images. They are mutually reinforcing.
  • Efficiency at the Bottleneck: Correcting bias at the text embedding stage—the "bottleneck" before cross-attention layers—fixes the root cause without altering heavy image generation weights.
  • Variance Minimization: Simply minimizing the variance in Euclidean distance between neutral and demographic-specific prompts effectively neutralizes the embedding space.

Key Results

Fair Mapping achieved superior fairness scores compared to base Stable Diffusion and other state-of-the-art methods like StruD and UCE. It reduced gender bias by 18% for occupations and 54% for emotions compared to the baseline.

Comparison of image generation between base Stable Diffusion and Fair Mapping for gender and race debiasing.

Crucially, image quality remained high, with a 13% improvement in the "Human-CLIP" metric (measuring alignment with human-related prompts) over competing debiasing methods. The computational overhead is minimal: training takes only 50 minutes on a single GPU, and inference time is virtually identical to the base model (434s vs 424s for 100 images).

Conclusion and Future Work

While Fair Mapping significantly improves demographic balance, a trade-off exists between fairness and perfect alignment with complex textual descriptions. Some users noted slight drops in fidelity for nuanced expressions. Future research will focus on maintaining this demographic balance while enhancing consistency for highly complex and detailed prompts.

Summary updated

BibTeX
@inproceedings{li2025fair,
  author = {Jia Li and Lijie Hu and Jingfeng Zhang and Tianhang Zheng and Hua Zhang and Di Wang},
  title = {{Fair Text-to-Image Diffusion via Fair Mapping}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i25.34823},
}
Figure