评测大模型当代码裁判的表现,发现思维模型更优但结果仍不稳定。
CodeJudgeBench: Benchmarking LLM-as-a-Judge for Coding Tasks
- 设计三类代码任务的评测基准,测试大模型判题能力。
- 小模型如Qwen3-8B可超70B大模型,但判断仍有随机性。
- 顺序变化和代码来源影响评分,适合关注评测可靠性的研究者。
大语言模型(LLMs)在各类编码任务中已取得显著进展。除了直接回答用户问题外,它们还能充当裁判,评估并比较其他模型生成响应的质量。这种评估能力对模型性能对比及通过排序提升响应质量至关重要。然而,尽管LLM-as-a-Judge范式被广泛采用,其在编码场景中的有效性仍因缺乏专用基准而未充分探索。为此,我们提出CodeJudgeBench,一个专为评估LLM-as-a-Judge在代码生成、代码修复和单元测试生成三类关键编码任务中表现而设计的基准。通过对26个LLM-as-a-Judge模型的全面评测,我们发现近期具备思维能力的模型在我们的精心设计任务上显著优于非思维模型。值得注意的是,相对较小的思维模型(如Qwen3-8B)甚至可超越高达70B规模的专门训练的判题模型。然而,所有模型在代码评判中仍表现出显著随机性:对于成对评判任务,仅改变响应呈现顺序即可显著影响准确率。此外,当评判由不同LLM生成的代码与单元测试时,判题模型也表现出性能差异。这种敏感性引发对其在编码场景中可靠性与一致性的担忧。最后,我们研究了最优提示策略,发现成对比较优于单点评分,且保留原始响应中的注释与推理内容能提升判题性能。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have significantly advanced the state-of-the-art in various coding tasks. Beyond directly answering user queries, LLMs can also serve as judges, assessing and comparing the quality of responses generated by other models. Such an evaluation capability is crucial both for benchmarking different LLMs and for improving response quality through response ranking. However, despite the growing adoption of the LLM-as-a-Judge paradigm, its effectiveness in coding scenarios remains underexplored due to the absence of dedicated benchmarks. To address this gap, we introduce CodeJudgeBench, a benchmark explicitly designed to evaluate the performance of LLM-as-a-Judge models across three critical coding tasks: code generation, code repair, and unit test generation. Through comprehensive benchmarking of 26 LLM-as-a-Judge models, we find that recent thinking models significantly outperform non-thinking models on our carefully designed code judging tasks. Notably, even relatively small thinking models, such as Qwen3-8B, can outperform specially trained LLM-as-a-Judge models up to 70B in size. Nevertheless, all models still exhibit significant randomness in their judgment of coding tasks. For pairwise judging tasks, simply changing the order in which responses are presented can substantially impact accuracy. In addition, when judging code and unit tests written by different LLMs, LLM-as-a-Judge models also show variance in performance. This sensitivity raises concerns about the reliability and consistency of LLM-as-a-Judge in coding scenarios. Lastly, we study optimal prompting strategies for LLM-as-a-Judge. We find that using pair-wise comparison outperforms scalar point-wise judging. Furthermore, retaining comments and reasoning in the full, unprocessed LLM response leads to improved judge performance.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。