A Framework for Identifying, Categorizing, and Explaining Bias in AI-Generated Code
Not on the map. Why?
Abstract (arXiv)
As Large Language Models (LLMs) become integrated into software development workflows, concerns regarding unintentional biases in AI-generated code. Although evidence suggests these biases exist, limited research has systematically identified, categorized, and explained them. This study investigates bias in AI-generated code and evaluates whether LLMs can reliably identify and explain it through a taxonomy-driven framework. We extended an existing dataset of biased AI-generated Python code and manually annotated snippets with bias categories and human-authored justifications to establish a ground-truth dataset. Using this dataset, we evaluated proprietary and open-source LLMs as automated bias detection and justification systems through ICL. Finally, we analyzed similarity between LLM-generated explanations and human-authored justifications using structured justification and code identification metrics. Our findings demonstrate that LLMs can effectively support code bias identification and explanation. Gemini achieved 80.14% classification accuracy, with 84.0% precision and 95.7% recall, while the best open-source alternative, Qwen3-coder, achieved 82.45% accuracy, 68.64% precision, and 80.22% recall. Additionally, the models achieved justification similarity scores of 80.4% and 80.14%, respectively, relative to human-authored reasoning, and code identification similarity scores of 86.0% and 87.82%. These results suggest that LLMs can detect biased logic in generated Python code and produce explanations that substantially align with expert interpretations.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 22 of its 45 references that are in the map. First posted on arXiv 25 Sep 2026.
Builds on
22 of 45 references.
References · 22
- 2016Equality of Opportunity in Supervised Learningcited by 2,007
- 2020Language (Technology) is Power: A Critical Survey of "Bias" in NLPcited by 956
- 2020Towards Faithfully Interpretable NLP Systems: How should we define and evaluate faithfulness?cited by 599
- 2018A Reductions Approach to Fair Classificationcited by 587
- 2019ERASER: A Benchmark to Evaluate Rationalized NLP Modelscited by 530
- 2021Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLPcited by 337
- 2019Measurement and Fairnesscited by 308
- 2022From Anecdotal Evidence to Quantitative Evaluation Methods: A Systematic Review on Evaluating Explainable AIcited by 302
- 2019What's in a Name? Reducing Bias in Bios without Access to Protected Attributescited by 51
- 2022Representation Bias in Data: A Survey on Identification and Resolution Techniquescited by 37
- 2022Investigating Reasons for Disagreement in Natural Language Inferencecited by 29
- 2022Dbias: Detecting biases and ensuring Fairness in news articlescited by 28
10 more
- 2023Uncovering and Quantifying Social Biases in Code Generationcited by 25
- 2024Bias Unveiled: Investigating Social Bias in LLM-Generated Codecited by 25
- 2025How Developers Interact with AI: A Taxonomy of Human-AI Collaboration in Software Engineeringcited by 15
- 2025The Invisible Hand: Unveiling Provider Bias in Large Language Models for Code Generationcited by 10
- 2024Towards Multi-dimensional Explanation Alignment for Medical Classificationcited by 6
- 2025Bias-Aware Agent: Enhancing Fairness in AI-Driven Knowledge Retrievalcited by 5
- 2025In-Context Learning (and Unlearning) of Length Biasescited by 3
- 2025Are Prompts All You Need? Evaluating Prompt-Based Large Language Models (LLM)s for Software Requirements Classificationcited by 3
- 2026Human-AI Collaboration and the Transformation of Software Engineering Workcited by 2
- 2023Towards clinical AI fairness: A translational perspectivecited by 1
Built on by
Not cited yet.