Fair Sampling in Diffusion Models through Switching Mechanism

Yujin Choi, Jinseong Park, Hoki Kim, Jaewook Lee, Saeroom Park

Introduction

Generative models, particularly diffusion-based architectures, have demonstrated remarkable capabilities in synthesizing high-fidelity images. However, these models often inherit and amplify societal biases present in their training data. For instance, if a dataset contains a disproportionate representation of specific demographics in certain contexts, the model will likely replicate these disparities, leading to unfair outcomes. Addressing this bias is critical for the ethical deployment of AI.

The Limitations of Existing Fairness Approaches

Current strategies to mitigate bias in generative models generally fall into two categories: retraining/fine-tuning and classifier-based guidance. Retraining is computationally expensive and often impractical for large-scale models. Conversely, classifier-based guidance relies on external models to steer the generation process toward fairness. However, these external classifiers are themselves prone to bias, which can compromise the fairness of the final output.

Proposed Method: Attribute Switching

Presented at AAAI 2024, this research introduces Attribute Switching, a novel sampling mechanism designed to achieve $\epsilon$-fairness without the need for retraining or external classifiers. The method leverages a fundamental property of diffusion models: the temporal decomposition of feature learning.

During the denoising process, diffusion models learn features at different scales:

  1. Early stages (high noise): The model establishes coarse semantic structures and general outlines.
  2. Middle stages: The model populates the image with content and rich details.
  3. Late stages (low noise): The model focuses on fine-detail refinement and "cleaning."

The Switching Mechanism

Instead of maintaining a single attribute condition (e.g., "Male") throughout the entire sampling trajectory, the authors propose an intervention. The process begins with an initial attribute $s_0$ and switches to a target attribute $s_1$ at a mathematically optimized transition point $\tau$. By utilizing the coarse features of $s_0$ and the detailed content generation of $s_1$, the resulting image resides between the two distributions, effectively obfuscating the sensitive attribute's statistical signal.

Optimizing the Transition Point ($\tau$)

A key contribution of this work is Theorem 2, which defines the mathematical conditions for an optimal $\tau$. The authors developed an efficient algorithm (Algorithm 2) to identify the point where the influence of both attributes is balanced. This ensures that the generated data achieves independence from the sensitive attribute while remaining on the natural data manifold, preserving image realism.

Experimental Results

The researchers evaluated Attribute Switching across several benchmarks, including FairFace, CelebA, CIFAR-10, and Stable Diffusion.

Quantitative Fairness and Quality

On the FairFace dataset, the method achieved a Balanced Error Rate (BER) of 50.73% for race classification. In this context, a BER of 50% indicates that a classifier cannot distinguish the sensitive attribute better than random chance, signifying near-perfect fairness. This is a significant improvement over vanilla sampling (~15%) and existing "mixing" methods (~41%).

Importantly, this fairness does not come at the cost of image quality. The Fréchet Inception Distance (FID) scores for the switched images remained closely aligned with those of standard vanilla sampling, indicating that the generated images retain high realism.

Downstream Utility

The study also demonstrated that synthetic data generated via Attribute Switching remains useful for training downstream tasks. A classifier trained on this fair data successfully learned to detect target attributes (e.g., "Smiling") while remaining "blind" to sensitive attributes like gender.

Conclusion and Future Work

Attribute Switching provides a computationally efficient and effective path toward fair generative AI. By intervening in the sampling process rather than the training phase, it offers a flexible solution for existing models.

However, some limitations remain. The method's effectiveness can be influenced by attributes with significant contextual impact, where certain features are heavily entangled with the sensitive attribute. Additionally, while the current study focuses on binary attributes, extending the mechanism to multi-nominal attributes remains a subject for future research. Despite these challenges, the switching mechanism represents a major step toward "blind" and fair synthetic data generation.

Summary updated

BibTeX
@inproceedings{choi2024fair,
  author = {Yujin Choi and Jinseong Park and Hoki Kim and Jaewook Lee and Saeroom Park},
  title = {{Fair Sampling in Diffusion Models through Switching Mechanism}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i20.30202},
}
Figure