Finetuning Text-to-Image Diffusion Models for Fairness

Xudong Shen, Chao Du, Tianyu Pang, Min Lin, Yongkang Wong, Mohan S. Kankanhalli

Abstract

The rapid adoption of text-to-image diffusion models in society underscores an urgent need to address their biases. Without interventions, these biases could propagate a skewed worldview and restrict opportunities for minority groups. In this work, we frame fairness as a distributional alignment problem. Our solution consists of two main technical contributions: (1) a distributional alignment loss that steers specific characteristics of the generated images towards a user-defined target distribution, and (2) adjusted direct finetuning of diffusion model's sampling process (adjusted DFT), which leverages an adjusted gradient to directly optimize losses defined on the generated images. Empirically, our method markedly reduces gender, racial, and their intersectional biases for occupational prompts. Gender bias is significantly reduced even when finetuning just five soft tokens. Crucially, our method supports diverse perspectives of fairness beyond absolute equality, which is demonstrated by controlling age to a 75% young and 25% old distribution while simultaneously debiasing gender and race. Finally, our method is scalable: it can debias multiple concepts at once by simply including these prompts in the finetuning data.

Introduction

Text-to-image (T2I) models like Stable Diffusion often reflect and amplify biases present in their training data. For instance, prompts for "doctor" frequently yield images of white men, while "homemaker" skews heavily female. Existing solutions, such as manual prompt engineering or embedding space projections, are often brittle and lack the flexibility to target specific demographic distributions. This paper addresses the challenge of steering pre-trained models toward user-defined target distributions without compromising image quality or semantic relevance.

Methodology: Distributional Alignment and Adjusted DFT

The proposed framework introduces two primary technical innovations to achieve flexible fairness.

Distributional Alignment Loss (DAL)

Rather than penalizing individual images, the Distributional Alignment Loss (DAL) operates on a batch of generated images. It utilizes pre-trained classifiers to estimate attribute probabilities (e.g., gender, race, age) and employs Optimal Transport to calculate the most efficient shift from the current batch distribution to a target distribution. This allows for nuanced control, such as a 75/25 age split, rather than being restricted to simple 50/50 parity.

Adjusted Direct Finetuning (DFT)

Direct finetuning (DFT) aims to optimize the final generated image. However, backpropagating through the diffusion sampling chain is notoriously unstable. The authors demonstrate that "naive" DFT suffers from exploding gradients due to the recursive nature of the sampling process.

Comparison between Naive DFT (a) and the proposed Adjusted DFT (b), which uncouples gradients and standardizes influence across time steps.

To resolve this, Adjusted DFT uncouples these gradients and standardizes the influence of different time steps ($A_i = 1$). This modification ensures stable optimization and effective convergence, as shown in the training dynamics.

Analysis of training loss (a) and gradient norms (b). Adjusted DFT (ours) demonstrates stable loss reduction and controlled gradient norms compared to the exploding gradients in naive approaches.

Experimental Results

The method was evaluated using occupational prompts, LAION-Aesthetics V2, and datasets like FairFace and CelebA.

Bias Reduction and Generalization

The approach consistently outperformed baselines in reducing gender, racial, and intersectional biases. Notably, the fairness improvements generalized to complex styles (e.g., 3D renders, oil paintings) not seen during finetuning. The authors also found that finetuning as few as five "soft tokens" (prompt prefixes) could significantly reduce bias, suggesting that the model already possesses the necessary latent knowledge, which only requires better steering.

Realism and Semantic Integrity

By incorporating preservation losses based on CLIP and DINO embeddings, the method ensures that the debiased models maintain high visual fidelity and semantic alignment with the original prompts. Qualitative assessments show that the images remain realistic and avoid the artifacts often associated with aggressive debiasing.

Discussion and Limitations

While effective, the method's performance is tied to the accuracy of the underlying attribute classifiers. Currently, it treats attributes as discrete categories, which may not capture the full spectrum of human identity. Furthermore, while it addresses demographic bias, other forms of cultural bias (e.g., Western-centric aesthetics) remain an area for future work. Finally, there is a potential risk of "adversarial" solutions where the model learns to trick the classifier with low-level pixel changes; however, the use of semantic preservation losses helps mitigate this risk.

Summary updated

BibTeX
@inproceedings{shen2024finetuning,
  author = {Xudong Shen and Chao Du and Tianyu Pang and Min Lin and Yongkang Wong and Mohan S. Kankanhalli},
  title = {{Finetuning Text-to-Image Diffusion Models for Fairness}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=hnrB5YHoYu},
}
Figure