arXiv:2506.04464cs.SEcs.LG2025-06综述被引 3

用奖励模型指导代码评审评论生成,提升评论质量与实用性。

Leveraging Reward Models for Guiding Code Review Comment Generation

  • 引入强化学习框架,通过语义相似性和可执行性双重奖励
  • 生成评论在质量和对修复模型的可用性上优于现有方法
  • 适合希望自动化代码评审流程的研发团队

代码评审是现代软件开发的关键环节,涉及代码质量评估、问题反馈及代码优化。然而,该过程耗时且易受主观因素影响。为此,已有研究提出部分自动化方案。其中深度学习方法能模拟人类评审者生成评论或自动实施修改。本文提出CoRAL框架,利用强化学习结合奖励机制,综合考虑生成评论的语义准确性及其作为代码修复模型输入的实用性。若评论语义接近预期结果或能被专门的代码修复模型成功执行,则获得高奖励。实验表明,CoRAL生成的评论在定量与定性对比中均优于最新基线方法,展现出更强的有效性与优越性。

原文摘要 · Abstract (English)

Code review is a crucial component of modern software development, involving the evaluation of code quality, providing feedback on potential issues, and refining the code to address identified problems. Despite these benefits, code review can be rather time consuming, and influenced by subjectivity and human factors. For these reasons, techniques to (partially) automate the code review process have been proposed in the literature. Among those, the ones exploiting deep learning (DL) are able to tackle the generative aspect of code review, by commenting on a given code as a human reviewer would do (i.e., comment generation task) or by automatically implementing code changes required to address a reviewer's comment (i.e., code refinement task). In this paper, we introduce CoRAL, a deep learning framework automating review comment generation by exploiting reinforcement learning with a reward mechanism considering both the semantics of the generated comments as well as their usefulness as input for other models automating the code refinement task. The core idea is that if the DL model generates comments that are semantically similar to the expected ones or can be successfully implemented by a second model specialized in code refinement, these comments are likely to be meaningful and useful, thus deserving a high reward in the reinforcement learning framework. We present both quantitative and qualitative comparisons between the comments generated by CoRAL and those produced by the latest baseline techniques, highlighting the effectiveness and superiority of our approach.

代码生成强化学习评审自动化

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