arXiv:2604.16790cs.SEcs.AI2026-04被引 2

LLM当代码裁判时易受提示词干扰,结果不可靠

Bias in the Loop: Auditing LLM-as-a-Judge for Software Engineering

论文配图:Bias in the Loop: Auditing LLM-as-a-Judge for Software Engineering
图 1 · 摘自论文原文
  • 通过控制提示词变量,发现相同代码在不同提示下判决差异大
  • 提示词偏差可使正确率下降30%以上,甚至改变模型排名
  • 建议报告偏差敏感性,提升代码评估可信度

大型语言模型正被用作代码评估的裁判,尤其在无法进行人工审查或完整测试覆盖时。然而当前实践缺乏对可靠性与偏见的系统性分析:同一代码多次评估结果不一致,微小提示修改即可改变结论,看似等价的语义调整也会引发不同判罚。本文从测量出发,研究代码生成、修复和测试生成三个任务中,两种逐项评估范式下的提示偏见。通过控制难度等级与单一提示要素干预,评估模型的一致性与对偏见的敏感性。结果表明,即使代码不变,判断结果仍高度依赖提示内容。多个偏见会系统性偏向提示所倾向的选项——若该选项为正确答案则提升准确率,否则显著降低;某些场景下偏差足以改变任务结论并重排模型优先级。这说明报告的评估性能可能反映的是提示设计而非真实能力,威胁评估的有效性与可复现性。因此我们主张,相关研究应报告偏差敏感性,并加入显式控制以实现更可信的模型对比。

原文摘要 · Abstract (English)

Large Language Models are increasingly used as judges to evaluate code artifacts when exhaustive human review or executable test coverage is unavailable. LLM-judge is increasingly relevant in agentic software engineering workflows, where it can help rank candidate solutions and guide patch selection. While attractive for scale, current practice lacks a principled account of reliability and bias: repeated evaluations of the same case can disagree; small prompt edits can swing outcomes; and seemingly semantics-preserving, human-equivalent perturbations may elicit divergent verdicts. This paper studies LLM-as-a-Judge for code through a measurement-first lens. We analyze two pointwise judging regimes across code generation, code repair task, and test generation, and we systematically probe prompt-induced biases. Our study considers difficulty levels for repeated runs and controlled prompt interventions that isolate one presentation cue at a time, and it evaluates judges using consistency and sensitivity to bias. We find that judge decisions are highly sensitive to prompt biases even when the underlying code snippet is unchanged. Across all three tasks, several biases systematically shift preferences toward the option favored by the prompt, improving accuracy when that option aligns with the gold answer but substantially reducing it otherwise. In some settings, these effects are large enough to change task-level conclusions and alter relative model rankings. These findings show that reported judge performance may reflect prompt artifacts rather than stable assessment ability, posing a direct threat to the validity and reproducibility of code evaluation. We therefore argue that LLM-as-a-Judge studies should report bias sensitivity alongside accuracy and incorporate explicit controls to support more trustworthy model comparison in software engineering.

大模型评估代码生成提示偏见软件工程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。