评测大模型理解代码评审意见的能力,发现其真实短板。
CodeReviewQA: The Code Review Comprehension Assessment for Large Language Models
- 将代码修复分解为三步推理任务,精准定位模型弱点。
- 在900个高质量样本上测试72个模型,覆盖9种语言。
- 避免数据污染,比传统方法更可靠,适合研究者使用。
当前最先进的大语言模型在代码生成方面表现优异,但在实际软件工程任务中,如根据代码评审意见修改源码时仍表现不佳,主要因为评审意见常含隐晦、模糊和口语化表达,需同时理解代码与人类意图。现有评估方法依赖文本匹配指标,难以揭示模型失败原因,且易受训练数据污染影响。为此,我们提出新基准 CodeReviewQA,将代码修复生成任务拆解为三个关键推理步骤:变更类型识别(CTR)、变更定位(CL)和解决方案识别(SI),每步均以多选题形式呈现,涵盖不同难度,实现细粒度评估并降低数据污染风险。我们在900个手工精选的高质量示例上对72个近期发布的大型语言模型进行了全面评估,涵盖九种编程语言。结果表明,CodeReviewQA能有效暴露模型在代码评审理解上的具体缺陷,且独立于其生成能力表现。
原文摘要 · Abstract (English)
State-of-the-art large language models (LLMs) have demonstrated impressive code generation capabilities but struggle with real-world software engineering tasks, such as revising source code to address code reviews, hindering their practical use. Code review comments are often implicit, ambiguous, and colloquial, requiring models to grasp both code and human intent. This challenge calls for evaluating large language models' ability to bridge both technical and conversational contexts. While existing work has employed the automated code refinement (ACR) task to resolve these comments, current evaluation methods fall short, relying on text matching metrics that provide limited insight into model failures and remain susceptible to training data contamination. To address these limitations, we introduce a novel evaluation benchmark, $\textbf{CodeReviewQA}$ that enables us to conduct fine-grained assessment of model capabilities and mitigate data contamination risks. In CodeReviewQA, we decompose the generation task of code refinement into $\textbf{three essential reasoning steps}$: $\textit{change type recognition}$ (CTR), $\textit{change localisation}$ (CL), and $\textit{solution identification}$ (SI). Each step is reformulated as multiple-choice questions with varied difficulty levels, enabling precise assessment of model capabilities, while mitigating data contamination risks. Our comprehensive evaluation spans 72 recently released large language models on $\textbf{900 manually curated, high-quality examples}$ across nine programming languages. Our results show that CodeReviewQA is able to expose specific model weaknesses in code review comprehension, disentangled from their generative automated code refinement results.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。