FairImagen: Post-Processing for Bias Mitigation in Text-to-Image Models

Zihao Fu, Ryan Brown, Shun Shao, Kai Rawal, Eoin D. Delaney, Chris Russell

Abstract

Text-to-image (T2I) models often amplify societal biases present in training data, leading to skewed demographic representations for various professions. We present FairImagen, a post-hoc, training-free framework that mitigates these biases by projecting prompt embeddings into a "fair" subspace using Fair Principal Component Analysis (FairPCA). To prevent over-neutralization and maintain visual diversity, we introduce an empirical noise injection technique. Our results demonstrate that FairImagen significantly improves demographic fairness across gender and race while maintaining high image quality and prompt fidelity, outperforming existing post-hoc debiasing methods.

Introduction

Modern text-to-image (T2I) models, such as Stable Diffusion, have revolutionized digital content creation. However, these models frequently reflect and amplify societal biases found in their massive training datasets. For instance, prompts for "CEO" or "firefighter" often result in a gallery of images predominantly featuring white men, while "nurse" or "librarian" prompts skew heavily toward women. These biases are not merely reflective; they are often amplified. A model trained on data where 60% of CEOs are male might generate 90% male CEOs. This "representation bias" can reinforce harmful stereotypes and limit the creative potential of generative AI.

Typical biased output from a base text-to-image model for the prompt 'firefighter', showing a lack of demographic diversity.

Existing mitigation strategies generally fall into two categories: prompt-based methods and model fine-tuning. Prompt-based methods require manual intervention or complex rewriting, which can be inconsistent. Fine-tuning, on the other hand, is computationally expensive and requires access to internal model weights, making it impractical for many users. FairImagen addresses these challenges through a lightweight, post-hoc editing framework that intercepts and "cleans" text embeddings before image generation.

Methodology

FairImagen operates in three distinct stages to ensure fair and diverse image generation:

1. Fair Representation Transformation

The core of FairImagen is Fair Principal Component Analysis (FairPCA). Unlike standard PCA, which identifies directions of maximum variance, FairPCA finds a subspace that preserves semantic information while minimizing variance associated with specific demographic groups. By projecting prompt embeddings into this "fair" subspace, the model suppresses mathematical directions that correlate specific professions with gender or race.

2. Empirical Noise Injection

A common issue with debiasing is "over-neutralization," where the resulting images lose individual characteristics and appear as featureless "average" humans. FairImagen solves this by sampling noise from the actual distribution of group-specific embeddings and injecting it back into the transformed prompt. This reintroduces realistic human diversity—such as varied skin tones and facial features—without re-establishing the biased correlations. The noise injection (epsilon) is a critical hyperparameter that allows the model to sample from the "diversity" of the human population without being tethered to the biased "mean" of the training data.

3. Cross-Demographic Projection

To handle intersectional identities (e.g., "Black Female"), FairImagen utilizes a unified formulation. Instead of sequential debiasing, which can degrade information, it treats the Cartesian product of attributes as distinct groups in a single joint projection. This approach preserves more detail and ensures better representation for complex demographic queries.

Experimental Evaluation

The framework was evaluated using an extended version of the Winobias dataset, covering 120 professions (e.g., "Janitor," "CEO," "Librarian") to provide a robust benchmark for both gender and racial bias. Performance was monitored using:

  • DeepFace: A pretrained facial attribute classifier used to monitor the distribution of generated images.
  • CLIP & MUSIQ: Standard benchmarks used to measure how well the image matches the prompt (Accuracy) and the aesthetic quality of the output (Quality).

Results and Discussion

FairImagen consistently achieved superior fairness scores compared to other post-hoc methods like SDID or TBIE. While there is a moderate trade-off—a slight dip in CLIPScore and visual quality compared to biased base models—FairImagen maintains a better balance than its competitors.

FairImagen's output for the same 'firefighter' prompt, demonstrating significantly improved representation across gender and racial groups.

The "Cross" debiasing method proved particularly effective at handling multiple attributes simultaneously. Furthermore, because FairImagen modifies embeddings at the encoder level, it is model-agnostic, working across different architectures like Stable Diffusion v1.5 and SDXL without requiring retraining. It also shows contextual intelligence, respecting prompts with legitimate demographic requirements (such as historical figures like "The Pope") better than heavy-handed prompt-rewriting.

Limitations and Future Work

Despite its success, FairImagen has limitations. It inherits the fundamental "blind spots" of the text encoders it uses (like CLIP or T5). If an encoder has no concept of a specific identity, FairImagen cannot project it into a fair subspace. Additionally, the current implementation relies on binary gender and coarse racial categories, which do not capture the full spectrum of human identity. Finding the perfect balance of noise and hidden dimensions also requires manual tuning. Future research will focus on expanding the framework to include non-binary identities and more nuanced ethnic backgrounds, as well as exploring applications in video and 3D generative models.

Summary updated

BibTeX
@inproceedings{fu2025fairimagen,
  author = {Zihao Fu and Ryan Brown and Shun Shao and Kai Rawal and Eoin D. Delaney and Chris Russell},
  title = {{FairImagen: Post-Processing for Bias Mitigation in Text-to-Image Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=uaQWgFk2Pf},
}
Figure