arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2507.13499cs.SEcs.AIcs.PL
收藏

大规模AI辅助修复代码评审意见

AI-Assisted Fixes to Code Review Comments at Scale

Meta

Chandra Maddila, Negar Ghorbani, James Saindon, Parth Thakkar, Vijayaraghavan Murali, Rui Abreu, Jingyue Shen, Brian Zhou, Nachiappan Nagappan, Peter C. Rigby

AI总结:

本文提出MetaMateCR系统,通过微调Llama模型在64k数据点上实现代码评审意见的AI辅助修复,离线准确率达68%且生产环境ActionableToApplied比率达19.7%,并通过安全试验优化用户体验避免拖慢评审流程。

摘要:

目标:Meta每周有数万条代码评审意见。我们开发了Metamate for Code Review(MetaMateCR),在生产环境中大规模提供针对评审者意见的AI辅助修复方案。方法:我们构建了一个包含64,000个<评审意见,补丁>数据点的内部基准,用于微调Llama模型。当模型在离线评估中取得合理结果后,我们将其部署到生产环境。为确保AI辅助修复不会对代码评审所需时间产生负面影响,我们进行了随机对照安全试验以及完整的生产实验。离线结果:作为基线,我们将GPT-4o与我们的小型和大型Llama模型进行比较。在离线结果中,我们的LargeLSFT模型在68%的情况下生成了完全匹配的补丁,比GPT-4o高出9个百分点(pp)。与GPT-4o建议的PHP函数相比,内部模型还使用了更现代的Hack函数。安全试验:当我们将MetaMateCR部署到生产环境进行安全试验,比较无AI补丁与AI补丁建议时,我们发现评审者进行评审的时间延长了超过5%,出现了显著回退。经过调查,我们修改了用户体验,仅向作者展示AI补丁,结果评审时间未出现回退。生产环境:当我们将LargeLSFT部署到生产环境时,观察到ActionableToApplied比率为19.7%,比GPT-4o提高了9.2个百分点。我们的结果说明了安全试验在确保AI不会无意中降低工程师效率方面的重要性,并展示了一个成功的大规模运行的从评审意见到AI补丁的产品。

英文摘要:

Aim. There are 10s of thousands of code review comments each week at Meta. We developed Metamate for Code Review (MetaMateCR) that provides AI-assisted fixes for reviewer comments in production at scale. Method. We developed an internal benchmark of 64k <review comment, patch> data points to fine-tune Llama models. Once our models achieve reasonable offline results, we roll them into production. To ensure that our AI-assisted fixes do not negatively impact the time it takes to do code reviews, we conduct randomized controlled safety trials as well as full production experiments. Offline Results. As a baseline, we compare GPT-4o to our small and large Llama models. In offline results, our LargeLSFT model creates an exact match patch 68% of the time outperforming GPT-4o by 9 percentage points (pp). The internal models also use more modern Hack functions when compared to the PHP functions suggested by GPT-4o. Safety Trial. When we roll MetaMateCR into production in a safety trial that compares no AI patches with AI patch suggestions, we see a large regression with reviewers taking over 5% longer to conduct reviews. After investigation, we modify the UX to only show authors the AI patches, and see no regressions in the time for reviews. Production. When we roll LargeLSFT into production, we see an ActionableToApplied rate of 19.7%, which is a 9.2pp improvement over GPT-4o. Our results illustrate the importance of safety trials in ensuring that AI does not inadvertently slow down engineers, and a successful review comment to AI patch product running at scale.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑