BiasAuditFW is an automated, open-source auditing framework designed to quantify representational and cultural biases in text-to-image diffusion models (e.g., Stable Diffusion, Midjourney, DALL-E, NanoBanana).
This project transitions bias auditing from qualitative observation to a rigorous quantitative pipeline, exposing the "Patchwork Effect" and the aesthetic erasure of the Global South in synthetic media.
The framework operates on a dual-axis auditing pipeline:
- Demographic Extraction (DeepFace): Utilizes the
RetinaFacebackend to extract facial features, transforming unstructured pixel data into categorical variables (Race and Gender) and isolating the algorithmic "default whiteness" and male dominance. - Zero-Shot Semantic Evaluation (CLIP): Projects generated images and cultural anchor texts (e.g., "A typical Latin American university campus") into a high-dimensional latent space. By calculating cosine similarity, it mathematically proves whether models possess the cultural competence to depict non-Eurocentric realities.
The pipeline automatically runs non-parametric hypothesis testing (Mann-Whitney U Test,
To ensure strict scientific reproducibility and avoid dependency conflicts (e.g., Python/TensorFlow versioning), this framework is fully containerized. Any researcher can run the auditing dashboard locally in an isolated environment.
1. Build the Docker Image:
docker build -t biasauditfw .
docker run -p 8501:8501 biasauditfwAccess the interactive dashboard in your browser at http://localhost:8501.
🚀 Repository Structure notebooks/: Contains the Google Colab environment with the core extraction pipeline.
app.py: An interactive Streamlit Dashboard for data visualization.
data/: The validated .csv dataset generated during the extraction phase.
docs/: Academic charts (Seaborn/Matplotlib) ready for publication.
💻 How to Run the Dashboard Locally (Without Docker) You can explore the generated data and statistical reports locally using standard Python and Streamlit:
# Clone the repository
git clone [https://github.com/your-username/BiasAuditFW.git](https://github.com/your-username/BiasAuditFW.git)
cd BiasAuditFW
# Install dependencies
pip install -r requirements.txt
# Run the dashboard
streamlit run app.pyThis framework is being developed as a Bachelor's Thesis in Computer Science at the State University of Mato Grosso do Sul (UEMS), expanding upon qualitative research conducted during an academic exchange at the Universidad Nacional de Colombia (UNAL).
Author: Kauan Henrick Teixeira da Silva
Role: Software Developer | Python & Computer Vision