FairCoder: Evaluating Social Bias of LLMs in Code Generation

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Du, Yongkang, Huang, Jen-tse, Zhao, Jieyu, Lin, Lu
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866915222592159744
author Du, Yongkang
Huang, Jen-tse
Zhao, Jieyu
Lin, Lu
author_facet Du, Yongkang
Huang, Jen-tse
Zhao, Jieyu
Lin, Lu
contents Large language models (LLMs) have been widely deployed in coding tasks, drawing increasing attention to the evaluation of the quality and safety of LLMs' outputs. However, research on bias in code generation remains limited. Existing studies typically identify bias by applying malicious prompts or reusing tasks and dataset originally designed for discriminative models. Given that prior datasets are not fully optimized for code-related tasks, there is a pressing need for benchmarks specifically designed for evaluating code models. In this study, we introduce FairCoder, a novel benchmark for evaluating social bias in code generation. FairCoder explores the bias issue following the pipeline in software development, from function implementation to unit test, with diverse real-world scenarios. Additionally, three metrics are designed to assess fairness performance on this benchmark. We conduct experiments on widely used LLMs and provide a comprehensive analysis of the results. The findings reveal that all tested LLMs exhibit social bias.
format Preprint
id arxiv_https___arxiv_org_abs_2501_05396
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle FairCoder: Evaluating Social Bias of LLMs in Code Generation
Du, Yongkang
Huang, Jen-tse
Zhao, Jieyu
Lin, Lu
Computation and Language
Software Engineering
Large language models (LLMs) have been widely deployed in coding tasks, drawing increasing attention to the evaluation of the quality and safety of LLMs' outputs. However, research on bias in code generation remains limited. Existing studies typically identify bias by applying malicious prompts or reusing tasks and dataset originally designed for discriminative models. Given that prior datasets are not fully optimized for code-related tasks, there is a pressing need for benchmarks specifically designed for evaluating code models. In this study, we introduce FairCoder, a novel benchmark for evaluating social bias in code generation. FairCoder explores the bias issue following the pipeline in software development, from function implementation to unit test, with diverse real-world scenarios. Additionally, three metrics are designed to assess fairness performance on this benchmark. We conduct experiments on widely used LLMs and provide a comprehensive analysis of the results. The findings reveal that all tested LLMs exhibit social bias.
title FairCoder: Evaluating Social Bias of LLMs in Code Generation
topic Computation and Language
Software Engineering
url https://arxiv.org/abs/2501.05396