A Framework for Identifying, Categorizing, and Explaining Bias in AI-Generated Code

Manaal Basha, Aimee M. Ribeiro, Gema Rodriguez-Perez
9/25/2026
cs.SEcs.AI

No confident code implementation found for this paper.

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{basha2026framework,
  title  = {A Framework for Identifying, Categorizing, and Explaining Bias in AI-Generated Code},
  author = {Manaal Basha and Aimee M. Ribeiro and Gema Rodriguez-Perez},
  year   = {2026},
  eprint = {2609.30642},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.30642v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2609.30642.svg)](https://codeofpaper.com/paper/2609.30642)

Discussion