一句话:为代码评审评论生成修复补丁的MetaMateCR系统,通过微调Llama实现离线68%精确匹配,并借助安全试验成功落地生产。
Meta每周产生数万条代码评审评论。本文提出MetaMateCR,为评审意见提供AI辅助修复。作者构建了包含64k条〈评审评论, 补丁〉的内部基准,微调Llama模型,并将离线表现与GPT-4o对比。离线结果显示,LargeLSFT模型生成的补丁有68%与人工修复完全一致,超出GPT-4o九个百分点,且更倾向于使用现代Hack函数而非GPT-4o建议的PHP函数。为确保AI不拖慢评审速度,作者开展随机对照安全试验,发现直接向评审者展示AI补丁会使评审时间增加5%以上;改为仅向作者展示后,时间回归无显著差异。最终在生产环境中,LargeLSFT的ActionableToApplied率达到19.7%,比GPT-4o高9.2个百分点。该工作强调了安全试验在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.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2507-13499,
title = {AI-Assisted Fixes to Code Review Comments at Scale},
author = {Chandra Maddila and Negar Ghorbani and James Saindon and Parth Thakkar and Vijayaraghavan Murali and Rui Abreu and Jingyue Shen and Brian Zhou and Nachiappan Nagappan and Peter C Rigby},
booktitle = {FSE},
year = {2026},
doi = {10.1145/3803437.3805217}
}