Bias Before Pixels: A Surrogate Framework for Auditing Demographic Bias in Text-to-Image Models

Rayyan Ahmed, Enzo Tartaglione, Stephan AlanizarXiv 2026

TL;DR

Auditing text-to-image (T2I) models for demographic bias usually means generating thousands of images and running classifiers on every single one—a slow, expensive bottleneck. This paper introduces a lightweight surrogate that predicts a T2I model’s gender and race output distributions directly from the text prompt, before a single pixel is generated. Because it reduces an audit to a single forward pass, it lets researchers compare models, test thousands of prompt combinations in seconds, and even catch failing debiasing attempts before they happen.

What Problem Does This Paper Address?

Text-to-image models like FLUX and Stable Diffusion routinely reproduce and amplify demographic stereotypes from their web-scraped training data. Even when a prompt is completely neutral (e.g., "a person working as a baker"), the model may overwhelmingly generate one gender or race.

Traditionally, measuring this bias requires a costly "generate-and-classify" pipeline: for every prompt you want to audit, you must generate a large batch of images, detect the people in them, and classify their attributes. This makes large-scale auditing—like comparing multiple models or testing thousands of prompt variations—prohibitively slow, and it makes pre-generation filtering impossible.

Figure 1: An incidental clause shifts the surrogate’s prediction (left) to a female skew, which the model’s generations confirm (right; border marks male/female).

Methods

The authors train an Attribute Distribution Surrogate (ADS): a small model that takes a text prompt $x$ and predicts the exact probability distribution $\hat{P}(x)$ of demographic attributes (gender or race) that a target T2I model $G$ would produce.

Figure 2: A prompt is encoded by a LoRA-adapted (or the target model’s own, frozen) text encoder; token embeddings are mean-pooled and projected by a small MLP head to a K-way softmax distri- bution ˆP(x), trained with a KL objective against the empirical ground-truth distribution PG(x).

The architecture is refreshingly simple:

  1. Text Encoding: A text encoder maps the prompt to token embeddings, which are mean-pooled into a single vector.
  2. MLP Head: A small two-layer MLP (widths 512 and 256) projects this vector into a $K$-way softmax distribution.
  3. Training Objective: The surrogate is trained using forward Kullback–Leibler (KL) divergence against the empirical ground-truth distribution $P_G(x)$ measured from real generated images (using YOLOv10 for person detection and InternVL-2 for labeling).

Crucially, ADS comes in two variants:

  • ADS-External: Uses its own pretrained text encoder (T5-XXL) adapted with LoRA. Because it never touches $G$’s weights or internal activations at inference time, it works even for black-box, API-only models.
  • ADS-Native: Reuses $G$’s own frozen text encoder. Since $G$ already computes this embedding during generation, ADS-Native adds only a tiny MLP pass, making it ideal for real-time auditing during deployment.

Datasets

Because no suitable dataset of prompts paired with measured demographic distributions existed, the authors built one for three architecturally distinct T2I models: FLUX.2-klein, SDXL Turbo, and Z-Image Turbo. It combines two prompt styles:

  • Descriptive prompts (~13k): Sampled from Human Caption-HQ and FaceCaption-15M, neutralized via regex to remove explicit gendered words, and enriched with random context (scenes, occupations, activities, objects, or cultural descriptors).
  • Templated prompts (~15k): Short, everyday-situation prompts from Girrbach et al. (2025) covering ~3,000 concepts with neutral subject nouns (person, individual, friend, colleague, someone).

The authors also test zero-shot generalization on TIFA (4,081 unseen captions).

Key Insights and Ideas

  • Prompt diversity beats image-batch precision: During training, generating just 1 image per descriptive prompt across ~10k unique prompts outperformed spending the same compute budget on 5–10 images per prompt across fewer prompts. Soft-label loss naturally averages out single-image noise.
  • Models diverge sharply on identical text: Single-pass auditing makes cross-model comparison trivial. On "working as a health technologist," for example, FLUX.2-klein’s predicted male probability is ~0.08, while Z-Image Turbo’s is ~0.92—gaps confirmed by actual generations.
  • Activities drive gender bias more than objects: By evaluating all $58 \times 162 = 9,396$ object–activity combinations in one batched pass, the authors show an asymmetric interaction: adding female activities shifts a male-biased object cluster by 0.35 on average, whereas adding female objects to male-biased activities shifts it by only ~0.15.
  • Predicting debiasing failures before generation: Direction-guided debiasing methods (like FairImagen) steer text embeddings toward a target demographic, but they sometimes "flip" and generate the wrong attribute anyway. Running ADS on the steered embedding catches 51% of these flips before any image is generated, allowing the pipeline to reselect a better steering perturbation on the fly.

Key Results

  • Gender Bias Detection: Across all three models and both prompt splits, ADS outperforms text-embedding baselines (RepE, Text Embedding Probe) and white-box diffusion-internal baselines (InterpretFlux, Diffusion Activation Probe), improving bias-detection accuracy by 11–25% (e.g., reaching 0.8348 vs. 0.7221 on FLUX.2-klein Descriptive).
  • Race Distribution Prediction: ADS lowers Total Variation (TV) distance by 0.09–0.34 compared to the strongest baseline and achieves entropy correlations of 0.27–0.65, whereas baselines sit near zero or negative.
  • Debiasing Boost: Integrating surrogate-guided perturbation reselection into FairImagen on FLUX.2-klein raises gender fairness from 0.6233 to 0.7450 and race fairness from 0.6555 to 0.6951, while leaving image quality (MUSIQ) and prompt alignment (CLIP) essentially unchanged.

Limitations and Future Work

The authors note that their ground-truth labels rely on an automatic classifier (InternVL-2), which reduces gender to a binary category and race to six fixed categories—simplifications made for measurement tractability rather than endorsement. They also note that while ADS-External is designed for black-box, API-only models, it has not yet been validated on a closed commercial API. Extending the framework to more inclusive attribute definitions and testing on closed APIs are natural next steps.

Summary updated

BibTeX
@misc{ahmed2026bias,
  author = {Rayyan Ahmed and Enzo Tartaglione and Stephan Alaniz},
  title = {{Bias Before Pixels: A Surrogate Framework for Auditing Demographic Bias in Text-to-Image Models}},
  year = {2026},
  eprint = {2612.03974},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.03974},
}
Figure