Bias Unveiled: Investigating Social Bias in LLM-Generated Code
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) have significantly advanced the field of automated code generation. However, a notable research gap exists in evaluating social biases that may be present in the code produced by LLMs. To solve this issue, we propose a novel fairness framework, i.e., Solar, to assess and mitigate the social biases of LLM-generated code. Specifically, Solar can automatically generate test cases for quantitatively uncovering social biases of the auto-generated code by LLMs. To quantify the severity of social biases in generated code, we develop a dataset that covers a diverse set of social problems. We applied Solar and the crafted dataset to four state-of-the-art LLMs for code generation. Our evaluation reveals severe bias in the LLM-generated code from all the subject LLMs. Furthermore, we explore several prompting strategies for mitigating bias, including Chain-of-Thought (CoT) prompting, combining positive role-playing with CoT prompting and dialogue with Solar. Our experiments show that dialogue with Solar can effectively reduce social bias in LLM-generated code by up to 90%. Last, we make the code and data publicly available is highly extensible to evaluate new social problems.
Key facts. Cited by 25 papers in the map (data through 14 Oct 2026). First posted on arXiv 15 Nov 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 11; 2026: 14.
25 papers.
Sort:
By area:
- 2025A Study of LLMs' Preferences for Libraries and Programming Languagescited by 20
- 2025The Bias is in the Details: An Assessment of Cognitive Bias in LLMscited by 10
- 2025FairCoder: Probing LLM Bias in High-Stakes Decision Making via Coding Taskscited by 9
- 2025Bias Amplification in RAG: Poisoning Knowledge Retrieval to Steer LLMscited by 8
- 2026Reward Modeling for Reinforcement Learning-Based LLM Reasoning: Design, Challenges, and Evaluationcited by 7
- 2026Bias in the Loop: Auditing LLM-as-a-Judge for Software Engineeringcited by 4
- 2026From GPT-3 to GPT-5: Mapping their capabilities, scope, limitations, and consequencescited by 3
- 2025BabelCoder: Agentic Code Translation with Specification Alignmentcited by 1
- 2025Benchmarking Code LLM-as-a-Judge via Constrained Perturbation and Calibrationcited by 1
- 2026Social Bias in LLM-Generated Code: Benchmark and Mitigationcited by 1
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2026PaperFit: Vision-in-the-Loop Typesetting Optimization for Scientific Documentscited by 1
13 more
- 2025Mapping the Trust Terrain: LLMs in Software Engineering -- Insights and Perspectivescited by 0
- 2025Large Language Models' Varying Accuracy in Recognizing Risk-Promoting and Health-Supporting Sentiments in Public Health Discourse: The Cases of HPV Vaccination and Heated Tobacco Productscited by 0
- 2025GPT and Prejudice: A Sparse Approach to Understanding Learned Representations in Large Language Modelscited by 0
- 2025What AI Speaks for Your Community: Polling AI Agents for Public Opinion on Data Center Projectscited by 0
- 2025A Multifaceted Analysis of Social Biases in Large Language Modelscited by 0
- 2026Fairness in Multi-Agent Systems for Software Engineering: An SDLC-Oriented Rapid Reviewcited by 0
- 2026From If-Statements to ML Pipelines: Revisiting Bias in Code-Generationcited by 0
- 2026Large Language Models in K-12 Education: Alignment with State Curriculum Standards and Student Personascited by 0
- 2026Wait, am I Being Fair? Characterizing Deductive Stereotyping and Mitigating It with Fair-GCGcited by 0
- 2026Pattern over Pixels: Measuring Pattern Completion Bias in Multimodal Code Generationcited by 0
- 2026GuardianBench: A Same-Scene Instruction-Contrastive Benchmark for Latent Contextual Risk in Embodied AIcited by 0
- 2026When Who You Are Can Change the Code You Get: A Study of Persona-Induced Bias in LLM Code Generationcited by 0
- 2026A Framework for Identifying, Categorizing, and Explaining Bias in AI-Generated Codecited by 0
- 2026A Framework for Identifying, Categorizing, and Explaining Bias in AI-Generated Code25 Sep 2026
- 2026GuardianBench: A Same-Scene Instruction-Contrastive Benchmark for Latent Contextual Risk in Embodied AI22 Aug 2026
- 2026When Who You Are Can Change the Code You Get: A Study of Persona-Induced Bias in LLM Code Generation12 Aug 2026
- 2026Pattern over Pixels: Measuring Pattern Completion Bias in Multimodal Code Generation4 Aug 2026
- 2026Wait, am I Being Fair? Characterizing Deductive Stereotyping and Mitigating It with Fair-GCG30 Jun 2026
- 2026Large Language Models in K-12 Education: Alignment with State Curriculum Standards and Student Personas3 Jun 2026
- 2026PaperFit: Vision-in-the-Loop Typesetting Optimization for Scientific Documents11 May 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026Social Bias in LLM-Generated Code: Benchmark and Mitigation1 May 2026
- 2026From If-Statements to ML Pipelines: Revisiting Bias in Code-Generation23 Apr 2026
- 2026Bias in the Loop: Auditing LLM-as-a-Judge for Software Engineering18 Apr 2026
- 2026From GPT-3 to GPT-5: Mapping their capabilities, scope, limitations, and consequences11 Apr 2026
13 more
- 2026Fairness in Multi-Agent Systems for Software Engineering: An SDLC-Oriented Rapid Review10 Apr 2026
- 2026Reward Modeling for Reinforcement Learning-Based LLM Reasoning: Design, Challenges, and Evaluation10 Feb 2026
- 2025Benchmarking Code LLM-as-a-Judge via Constrained Perturbation and Calibration23 Dec 2025
- 2025A Multifaceted Analysis of Social Biases in Large Language Models16 Dec 2025
- 2025BabelCoder: Agentic Code Translation with Specification Alignment7 Dec 2025
- 2025What AI Speaks for Your Community: Polling AI Agents for Public Opinion on Data Center Projects27 Nov 2025
- 2025The Bias is in the Details: An Assessment of Cognitive Bias in LLMs26 Sep 2025
- 2025GPT and Prejudice: A Sparse Approach to Understanding Learned Representations in Large Language Models24 Sep 2025
- 2025Large Language Models' Varying Accuracy in Recognizing Risk-Promoting and Health-Supporting Sentiments in Public Health Discourse: The Cases of HPV Vaccination and Heated Tobacco Products6 Jul 2025
- 2025Bias Amplification in RAG: Poisoning Knowledge Retrieval to Steer LLMs13 Jun 2025
- 2025A Study of LLMs' Preferences for Libraries and Programming Languages21 Mar 2025
- 2025Mapping the Trust Terrain: LLMs in Software Engineering -- Insights and Perspectives18 Mar 2025
- 2025FairCoder: Probing LLM Bias in High-Stakes Decision Making via Coding Tasks9 Jan 2025
- 2025A Study of LLMs' Preferences for Libraries and Programming Languagescited by 20
- 2025The Bias is in the Details: An Assessment of Cognitive Bias in LLMscited by 10
- 2025FairCoder: Probing LLM Bias in High-Stakes Decision Making via Coding Taskscited by 9
- 2026Bias in the Loop: Auditing LLM-as-a-Judge for Software Engineeringcited by 4
- 2026From GPT-3 to GPT-5: Mapping their capabilities, scope, limitations, and consequencescited by 3
- 2025Benchmarking Code LLM-as-a-Judge via Constrained Perturbation and Calibrationcited by 1
- 2026Social Bias in LLM-Generated Code: Benchmark and Mitigationcited by 1
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2026PaperFit: Vision-in-the-Loop Typesetting Optimization for Scientific Documentscited by 1
- 2025Mapping the Trust Terrain: LLMs in Software Engineering -- Insights and Perspectivescited by 0
- 2025Large Language Models' Varying Accuracy in Recognizing Risk-Promoting and Health-Supporting Sentiments in Public Health Discourse: The Cases of HPV Vaccination and Heated Tobacco Productscited by 0
- 2025GPT and Prejudice: A Sparse Approach to Understanding Learned Representations in Large Language Modelscited by 0
12 most cited of 19 All 19 (JSON)
- 2026A Framework for Identifying, Categorizing, and Explaining Bias in AI-Generated Code25 Sep 2026
- 2026GuardianBench: A Same-Scene Instruction-Contrastive Benchmark for Latent Contextual Risk in Embodied AI22 Aug 2026
- 2026When Who You Are Can Change the Code You Get: A Study of Persona-Induced Bias in LLM Code Generation12 Aug 2026
- 2026Wait, am I Being Fair? Characterizing Deductive Stereotyping and Mitigating It with Fair-GCG30 Jun 2026
- 2026Large Language Models in K-12 Education: Alignment with State Curriculum Standards and Student Personas3 Jun 2026
- 2026PaperFit: Vision-in-the-Loop Typesetting Optimization for Scientific Documents11 May 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026Social Bias in LLM-Generated Code: Benchmark and Mitigation1 May 2026
- 2026From If-Statements to ML Pipelines: Revisiting Bias in Code-Generation23 Apr 2026
- 2026Bias in the Loop: Auditing LLM-as-a-Judge for Software Engineering18 Apr 2026
- 2026From GPT-3 to GPT-5: Mapping their capabilities, scope, limitations, and consequences11 Apr 2026
- 2025Benchmarking Code LLM-as-a-Judge via Constrained Perturbation and Calibration23 Dec 2025
12 newest of 19 All 19 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2026How Reasoning Shapes Social Bias in LLM-Generated Code?
- 2023Bias Testing and Mitigation in LLM-based Code Generation
- 2026Measuring and Mitigating Bias in Code Generated by Large Language Models
- 2024With a Grain of SALT: Are LLMs Fair Across Social Dimensions?
- 2023Can Instruction Fine-Tuned Language Models Identify Social Bias through Prompting?
- 2024BiasAlert: A Plug-and-play Tool for Social Bias Detection in LLMs
- 2025Debiasing LLMs by Masking Unfairness-Driving Attention Heads
- 2025Does Reasoning Introduce Bias? A Study of Social Bias Evaluation and Mitigation in LLM Reasoning