{"id":28759986,"url":"https://github.com/voerik/sd-3-ethics","last_synced_at":"2026-03-10T04:03:37.682Z","repository":{"id":292694595,"uuid":"981596552","full_name":"VoErik/sd-3-ethics","owner":"VoErik","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-07T10:55:54.000Z","size":2821,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T21:50:18.538Z","etag":null,"topics":["bias","diffusion-models","ethics","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VoErik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-11T13:22:11.000Z","updated_at":"2025-06-07T10:55:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"42af1df2-9217-4c1f-b075-624007705c4c","html_url":"https://github.com/VoErik/sd-3-ethics","commit_stats":null,"previous_names":["voerik/sd-3-ethics"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VoErik/sd-3-ethics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoErik%2Fsd-3-ethics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoErik%2Fsd-3-ethics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoErik%2Fsd-3-ethics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoErik%2Fsd-3-ethics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VoErik","download_url":"https://codeload.github.com/VoErik/sd-3-ethics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoErik%2Fsd-3-ethics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262151861,"owners_count":23266929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bias","diffusion-models","ethics","stable-diffusion"],"created_at":"2025-06-17T06:00:46.029Z","updated_at":"2026-03-10T04:03:37.675Z","avatar_url":"https://github.com/VoErik.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ethics Diffusion\n\nThis repository contains the source code, data, and analysis for the research paper `Seeing Bias: Demographic \nRepresentation of Professions in Image-Generation Systems` which was the final product of the seminar **Ethics\nand Epistemology of AI**, which was conducted as a cooperation between the Otto-Friedrich-University of Bamberg,\nthe Technical University Berlin, and the Berlin Ethics Lab.\n\n![img](assets/wallpaper_grid.jpg)\n\n## Abstract\n_This paper investigates demographic bias in the text-to-image model Stable Diffusion 3.5, focusing on the \nrepresentation of professions. By systematically varying prompt-specificity with respect to demographic \nattributes (gender, ethnicity, profession), we analyze the model's outputs and compare them with real-world \nlabor statistics. Our findings show that the model overrepresents white individuals and defaults to gender \nstereotypes, portraying men in technical roles and women in caregiving positions. Increasing prompt \nspecificity does not mitigate these biases and, in some cases, amplifies or hides them through \n\"stereotype stacking\". These results show that the model does not mirror reality but instead reinforces \nand magnifies existing societal biases, raising critical ethical concerns about representational harm, \nsymbolic erasure, and the perpetuation of inequality through GenAI._\n\n**Read the full paper [here](assets/paper.pdf).**\n\n## 🔑 Key Findings\nOur analysis demonstrates that Stable Diffusion 3.5:\n\n* 🧑‍💻 **Defaults to Stereotypes:** When given neutral prompts (e.g., \"a photo of an engineer\"), the model defaults to \ngenerating images of white men, reinforcing a narrow, stereotypical view of the profession.\n* 🔥 **Amplifies Existing Biases:** The model doesn't just reflect real-world demographic distributions; \nit often exaggerates them. For example, female-majority professions were depicted with an almost exclusively \nfemale representation (95%), far exceeding real-world figures.\n* 📉 **Fails at Intersectionality:** Prompts for intersectional identities (e.g., \"Black female engineer\") often \nresulted in lower-quality images, visual distortions, or complete erasure, suggesting the model struggles to \nrepresent identities that deviate from its trained defaults.\n* 🎭 **Performs \"Stereotype Stacking\":** Increasing prompt specificity by adding demographic markers did not \nconsistently reduce bias. Instead, it sometimes layered stereotypes, creating an illusory improvement while \nleaving systemic issues unaddressed.\n* 🌐 **Exhibits Strong \"White Normativity\":** Across nearly all professions, the model showed a strong tendency \nto generate white-presenting individuals unless another ethnicity was explicitly requested.\n\n## 📊 Data\nYou can access all results via this [Google Drive](https://drive.google.com/drive/folders/1tZUvYm-MlYgFQ-REH_i9Qv0Pgx6VQmuv?usp=drive_link).\n\n## 🌳 Repository Structure\n```\n.\n├── 📄 README.md            \n├── 📜 LICENSE              \n├── 📋 requirements.txt\n├── run.py     \n|\n├── 📂 assets/\n│   ├── prompts.csv         \n│   └── imgs/     \n|\n├── 📂 src/\n|   ├── visualize.csv \n│   └── sd_pipe.py  \n|\n└── 📂 analysis/\n    ├── prompt-specificity/ \n    ├── self-analysis/ \n    └── survey/\n\n```\n## ⚙️ Settings\n\n* You need a HuggingFace access token. See how you can generate it [here](https://huggingface.co/docs/hub/security-tokens).\n* Create an `.env` file and save the token there. If you name it other than `HF_KEY`, you need to modify the code accordingly.\n* The configuration for the model is set in `SDConfig`. \n* We use the `stabilityai/stable-diffusion-3.5-large-turbo` model by default. Be aware that you need to get access to the models first (https://huggingface.co/stabilityai)\n* Generated images and prompts are saved in the `./images` directory by default. \n\n## 🏃🏽‍♂️ Quickstart\n\n#### Clone the repository\n```\ngit clone https://github.com/VoErik/sd-3-ethics.git\ncd sd-3-ethics\n```\n#### Create and activate a virtual environment\n```\npython -m venv venv\nsource venv/bin/activate  # On Windows, use `venv\\Scripts\\activate`\n```\n#### Install the required dependencies\n```\npip install -r requirements.txt\n```\n#### And run it!\n```\npython run.py --task=g \\\n              --num_imgs=10 \\\n              --width=512 \\\n              --height=512 \\\n              --model=\"turbo-3.5\" \\\n              --steps=50 \\\n              --guidance=7.0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoerik%2Fsd-3-ethics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoerik%2Fsd-3-ethics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoerik%2Fsd-3-ethics/lists"}