FairCode
收藏资源简介:
FairCode是由宾夕法尼亚州立大学和南加州大学的研究团队开发的一个基准数据集,旨在评估大型语言模型(LLMs)在代码生成任务中的社会偏见。该数据集包含两个主要任务:函数实现和测试用例生成,涵盖了从招聘、大学录取到医疗治疗等多个现实场景。数据集通过多样化的敏感属性(如性别、种族、年龄等)来评估模型是否存在偏见。FairCode的创建过程包括从现实世界统计数据中提取场景,并使用GPT-4o生成非敏感属性。该数据集的应用领域主要集中在代码生成模型的公平性评估,旨在解决LLMs在生成代码时可能存在的社会偏见问题。
FairCode is a benchmark dataset developed by research teams from Pennsylvania State University and the University of Southern California, aiming to evaluate social biases of large language models (LLMs) in code generation tasks. This dataset includes two primary tasks: function implementation and test case generation, covering a variety of real-world scenarios such as recruitment, college admissions, and medical treatment. It utilizes diverse sensitive attributes including gender, race, age and others to assess whether models exhibit biases. The development process of FairCode involves extracting scenarios from real-world statistical data and generating non-sensitive attributes using GPT-4o. The main application scope of this dataset focuses on fairness evaluation of code generation models, aiming to address the potential social bias issues in LLMs' code generation processes.
FairCode 数据集概述
数据集简介
FairCode 是一个用于评估大型语言模型(LLMs)在代码生成中的社会偏见的数据集。该数据集旨在通过生成代码和测试用例,分析模型在不同社会背景下的表现。
数据集文件
code_job.py: 用于实现与工作相关的代码生成功能。code_edu.py: 用于实现与教育相关的代码生成功能。code_med.py: 用于实现与医疗相关的代码生成功能。code_test.py: 用于生成测试用例。
数据处理工具
get_info_code.py: 用于从生成的代码中提取统计信息。get_info_testcase.py: 用于从生成的测试用例中提取统计信息。
相关论文

- 1FairCode: Evaluating Social Bias of LLMs in Code Generation宾夕法尼亚州立大学; 南加州大学 · 2025年



