通过多粒度编辑降低代码大模型中的性别偏见
Mitigating Gender Bias in Code Large Language Models via Model Editing
- 提出多粒度编辑方法MG-Editing,可从参数到神经元逐级修正偏见
- 在行和神经元级别编辑时,既减少性别偏见又保持生成能力
- 构建CodeGenBias数据集与FB-Score指标,量化代码模型的性别偏差
近年来,随着大语言模型(LLM)技术成熟及高质量编程数据集的出现,程序自动生成的挑战正逐步被攻克。然而,由于多数训练样本未经筛选,导致模型性能难以匹配真实场景,产生社会偏见。为评估和量化代码类大模型中的性别偏见,本文提出名为CodeGenBias(代码生成中的性别偏见)的数据集与基于相关职业实际性别分布的评价指标FB-Score。借助该数据集与指标,我们对八款主流代码大模型进行了性别偏见分析。已有研究表明,知识编辑类模型编辑方法在缓解社会偏见方面具有潜力。因此,本文提出多粒度编辑方法MG-Editing,包含定位与编辑两个阶段,支持全参数、层、模块、行、神经元五个不同粒度层级的修改。大量实验表明,MG-Editing能有效缓解代码大模型中的性别偏见,同时保持其通用代码生成能力,且具备良好泛化性;在综合考虑偏见水平与生成能力的前提下,行级与神经元级编辑效果最佳。
原文摘要 · Abstract (English)
In recent years, with the maturation of large language model (LLM) technology and the emergence of high-quality programming code datasets, researchers have become increasingly confident in addressing the challenges of program synthesis automatically. However, since most of the training samples for LLMs are unscreened, it is inevitable that LLMs' performance may not align with real-world scenarios, leading to the presence of social bias. To evaluate and quantify the gender bias in code LLMs, we propose a dataset named CodeGenBias (Gender Bias in the Code Generation) and an evaluation metric called FB-Score (Factual Bias Score) based on the actual gender distribution of correlative professions. With the help of CodeGenBias and FB-Score, we evaluate and analyze the gender bias in eight mainstream Code LLMs. Previous work has demonstrated that model editing methods that perform well in knowledge editing have the potential to mitigate social bias in LLMs. Therefore, we develop a model editing approach named MG-Editing (Multi-Granularity model Editing), which includes the locating and editing phases. Our model editing method MG-Editing can be applied at five different levels of model parameter granularity: full parameters level, layer level, module level, row level, and neuron level. Extensive experiments not only demonstrate that our MG-Editing can effectively mitigate the gender bias in code LLMs while maintaining their general code generation capabilities, but also showcase its excellent generalization. At the same time, the experimental results show that, considering both the gender bias of the model and its general code generation capability, MG-Editing is most effective when applied at the row and neuron levels of granularity.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。