paperbot · PL 论文追踪

全部论文 待读 收藏

P2 How Reasoning Shapes Social Bias in LLM-Generated Code?

推理如何塑造 LLM 生成代码中的社会偏见?
ASE Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering2026匹配度 2/10 · 该论文研究LLM推理式代码生成中的社会偏见与去偏,属于LLM公平性方向,与静态分析、Agentic程序、浮点/贝叶斯程序分析等核心研究方向无直接关联;且研究目标本身是LLM,符合用户明确不感兴趣的类型。引用 0 inbox
Weifeng Sun, Jieke Shi, Zhou Yang, Yuchen Chen, Hongyan Li, Meng Yan, David Lo
crossref: 2026-10-09

AI 速览

一句话:首个系统实证研究推理式代码生成中的社会偏见,并提出推理感知的去偏框架 ProbeDebias。

大语言模型被广泛用于代码生成,已有研究表明生成程序可能携带“代码偏见”,即在涉及敏感人口属性的代码逻辑中体现不公平或差别对待。已有工作只考察直接生成场景,而基于推理的代码生成(模型先产生中间推理轨迹再输出最终代码)中偏见如何表现尚不清楚。本文开展首个针对推理式代码生成中社会偏见的系统性实证研究:在覆盖三类以人为中心决策场景的真实偏见敏感编程任务上,评测了 9 个模型,涵盖标准 LLM 与大型推理模型(LRM)。结果给出四点发现:推理总体上降低了代码偏见率(平均从 0.64 降至 0.40),但改善程度高度依赖模型;推理并未稳定保持代码质量(平均从 0.72 降至 0.59);有偏的推理轨迹强烈预示有偏代码;仅调整生成配置不足以稳健地缓解偏见。基于此,作者提出 ProbeDebias——一种推理感知的去偏框架,先检测有偏的推理轨迹并在最终代码生成前对其重写,大量实验显示其取得 87.76 的效果(摘要在该数值处截断,未给出完整指标名称)。

问题
基于推理的代码生成(模型先生成中间推理过程再产出代码)是否会以及如何引入针对敏感人口属性的社会偏见,此前缺乏系统研究。
方法
在三个以人为中心的决策场景、真实偏见敏感编程任务上评测 9 个标准 LLM 与大型推理模型,分析推理轨迹与代码偏见、代码质量之间的关系,并据此提出推理感知去偏框架 ProbeDebias,用于检测并重写有偏推理轨迹。
评估
通过跨 9 个模型、多场景任务的系统性实证实验,量化推理前后的偏见率(0.64→0.40)与代码质量(0.72→0.59)变化,并验证调整生成配置的局限性;实验显示 ProbeDebias 达到 87.76(摘要截断,未说明指标全称)。
原文摘要(Abstract)

Large language models (LLMs) are increasingly used for code generation, but recent studies have shown that generated programs can exhibit code bias, i.e., unfair or differential treatment encoded in code logic with respect to sensitive demographic attributes. Although prior work has investigated this problem in a direct generation setting, it remains unclear how bias behaves in reasoning-based code generation, where models produce intermediate reasoning traces before generating the final code. To bridge this gap, we conduct the first systematic empirical study of social bias in reasoning-based code generation. We evaluate 9 models spanning both standard LLMs and large reasoning models (LRMs) on realistic bias-sensitive coding tasks covering three human-centered decision scenarios. Our results reveal four main findings. First, reasoning generally reduces code bias, lowering the average bias rate from 0.64 to 0.40, but the improvement is highly model-dependent. Second, reasoning-based generation does not consistently preserve code quality, with the average quality dropping from 0.72 to 0.59. We further find that biased reasoning strongly predicts biased code, and that simply adjusting generation configurations is insufficient for robust bias mitigation. Motivated by these findings, we propose ProbeDebias, a reasoning-aware debiasing framework that detects biased reasoning traces and rewrites them before final code generation. Extensive experiments demonstrate that ProbeDebias achieves 87.76

链接与引用

DOI 原文 · arXiv ·

BibTeX
@inproceedings{paperbot12192,
  title = {How Reasoning Shapes Social Bias in LLM-Generated Code?},
  author = {Weifeng Sun and Jieke Shi and Zhou Yang and Yuchen Chen and Hongyan Li and Meng Yan and David Lo},
  booktitle = {ASE},
  year = {2026},
  doi = {10.1145/3832783.3834387}
}