FairGen: controlling fair generations in diffusion models via adaptive latent guidance

Mintong Kang, Vinayshekhar Bannihatti Kumar, Shamik Roy, Abhishek Kumar, Sopan Khosla, Balakrishnan Murali Narayanaswamy, Rashmi Gangadharaiah · Submission to ICLR 2025 · Rejected

TL;DR

FairGen is a training-free, inference-time framework that allows text-to-image diffusion models to generate balanced demographic distributions without degrading image fidelity. By combining a prompt-adaptive latent guidance vector with a memory-backed controller that tracks generation history, FairGen can steer outputs toward any arbitrary target demographic distribution across complex prompts and multiple sensitive attributes.

What Problem Does This Paper Address?

Text-to-image diffusion models (such as Stable Diffusion and SDXL) inherit pervasive societal biases from web-scraped data—frequently associating professions, traits, and social roles with specific genders, races, or age groups.

Existing mitigation strategies face steep trade-offs:

  1. Prompt intervention (e.g., automatically appending demographic tags) alters semantic fidelity and degrades image-text alignment.
  2. Model fine-tuning requires expensive retraining, degrades generation quality, and locks the model into a single distribution (e.g., exactly 50/50), preventing adaptation to different real-world proportions.
  3. Static latent intervention (e.g., FairDiffusion) injects fixed attribute vectors into the diffusion latent space. However, the optimal direction for an attribute (like "female") depends heavily on the surrounding prompt context; static vectors fail on diverse, complex prompts.

FairGen tackles this challenge: How can we steer generation distributions toward flexible target ratios dynamically at inference time without harming visual quality?

Methods

FairGen modifies the diffusion noise estimate during the sampling trajectory:

$$\epsilon_{\text{FairGen}}(x_t, t, c) = \epsilon_\theta(x_t, t, c) + I(c, \mathcal{M}, (a_1, a_2)) \cdot f_{\text{ALD}}(x_t, c, (a_1, a_2))$$

It relies on two cooperating components:

Input Prompt ───► [ LLM (Mistral-7B) ] ───► Attribute Prompts ───► [ Latent Guidance f_ALD ] ──┐
                         │                                                                       ▼
                         ▼                                                              [ Modified Noise ]
                  [ Memory Module M ] ───► Underrepresented? ───► [ Indicator Scalar I ] ────────┘
  1. Adaptive Latent Guidance Module ($f_{\text{ALD}}$): Instead of a static vector, FairGen computes the direction dynamically as the difference between noise estimates of attribute-conditioned prompts: $$f_{\text{ALD}} = \epsilon_\theta(x_t, t, K(c, a_1)) - \epsilon_\theta(x_t, t, K(c, a_2))$$ The attribute-aware prompt pairs $K(c, a_1)$ and $K(c, a_2)$ are generated by a fine-tuned Mistral-7B-Instruct model trained via Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) to produce prompt pairs that isolate demographic attributes while preserving context.

  2. Indicator Guidance Module ($I$): Rather than flipping a biased coin per image (which produces high variance), FairGen maintains a cluster-based memory module ($\mathcal{M}$). Incoming prompts are mapped into contextual clusters (e.g., "software engineer"). The module tracks demographic counts within that cluster and outputs a scalar ($+1$ or $-1$) to prioritize the currently underrepresented group, converting generation into a self-correcting random walk.

  3. Mid-Trajectory Application: FairGen applies guidance only during the middle 25% of reverse-diffusion timesteps. This prevents altering high-level layout (early steps) or destroying fine image texture (late steps).

Datasets

  • Stable Bias Occupation Dataset: A standard benchmark evaluating occupational gender and racial representations.
  • Holistic Bias Evaluation Benchmark (HBE): A new benchmark introduced by the authors featuring 2,000 prompts spanning 10 distinct domains (occupation, education, healthcare, criminal justice, finance, politics, technology, sports, daily activities, traits). Unlike prior benchmarks that rely on simple phrases (e.g., "a photo of a doctor"), HBE includes complex, scenario-based prompts and evaluates across gender, race, and age.

Key Insights and Ideas

  • Prompt-Dependent Orthogonal Guidance: The semantic direction of "gender" or "race" is not uniform across latent space; it shifts based on clothing, background, and action. Deriving the direction from LLM-aligned prompt pairs produces guidance approximately orthogonal to base scene drift, cleanly steering demographic identity without altering background composition.
  • Memory-Based Closed-Loop Control vs. Open-Loop Sampling: Probabilistic sampling (enforcing female with probability $P_t$) has high variance and fails when guidance is imperfect. Tracking cumulative output statistics in a memory buffer guarantees that generations drift back to the target ratio.
  • Timing Matters in Diffusion Latents: Early-stage interventions are washed out by later denoising, while late-stage interventions corrupt high-frequency detail. Targeting the middle 25% yields optimal Pareto trade-offs between debiasing and image fidelity.

Key Results

  • Substantial Bias Reduction: On the HBE benchmark with Stable Diffusion 2, FairGen lowered gender bias from $0.734 \to 0.231$ and race bias from $0.500 \to 0.217$, while maintaining image-text CLIP scores competitive with unguided generation ($Q \approx 0.270$ vs. $0.276$).
  • Outperforming Baselines: On the Stable Bias dataset, FairGen achieved a bias score of 0.160, substantially lower than prompt intervention (0.637), fine-tuning (0.392), and FairDiffusion (0.523).
  • Flexible Distribution Steering: Across target female ratios ranging from $0.0$ to $1.0$, FairGen achieved the lowest average bias ($0.238$) and smallest standard deviation ($0.025$), outperforming fine-tuning ($0.319 \pm 0.038$) and static guidance ($0.692 \pm 0.105$).
  • Inference Efficiency: Because guidance is restricted to intermediate timesteps, FairGen adds only modest inference overhead (14.9 hours vs. 12.3 hours on the SD2 benchmark run) and requires zero diffusion model training.

Limitations and Future Work

  • Multi-Attribute Intersections: While effective on single attributes, mitigating intersecting attributes simultaneously (e.g., gender + race + age) is noticeably harder (bias score was 0.601 on SD2).
  • External Dependency: The pipeline depends on an auxiliary fine-tuned LLM for prompt expansion and a vision-language model (InstructBLIP-2) for attribute verification.
  • Memory Management: The clustering threshold and memory budget ($B$) introduce hyperparameters that require tuning based on expected prompt diversity.

Summary updated

BibTeX
@misc{kang2025fairgen,
  author = {Mintong Kang and Vinayshekhar Bannihatti Kumar and Shamik Roy and Abhishek Kumar and Sopan Khosla and Balakrishnan Murali Narayanaswamy and Rashmi Gangadharaiah},
  title = {{FairGen: controlling fair generations in diffusion models via adaptive latent guidance}},
  year = {2025},
  eprint = {2503.01872},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.01872},
}
Figure