arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.15134cs.SE
收藏

BitsAI-CR:实践中基于 LLM 的自动化代码审查

BitsAI-CR: Automated Code Review via LLM in Practice

Tao Sun, Jian Xu, Yuanpeng Li, Zhao Yan, Ge Zhang, Lintao Xie, Lu Geng, Zheng Wang, Yueyan Chen, Qin Lin, Wenbo Duan, Kaixin Sui

AI总结:

本文提出 BitsAI-CR 框架,通过结合 RuleChecker 和 ReviewFilter 的两阶段方法及数据飞轮机制实现自动化代码审查,在 ByteDance 成功部署并服务超 12,000 名周活用户。

摘要:

代码审查在软件开发中仍然是一个关键但耗费资源的过程,在大规模工业环境中尤其具有挑战性。尽管大型语言模型(LLMs)在自动化代码审查方面展现出前景,但现有解决方案在精确性和实用性上面临重大局限。本文提出了 BitsAI-CR,一个创新框架,通过结合用于初始问题检测的 RuleChecker 和用于精确性验证的 ReviewFilter 的两阶段方法来增强代码审查。该系统建立在全面的审查规则分类体系之上,并实现了数据飞轮机制,通过结构化反馈和评估指标实现持续的性能提升。我们的方法引入了 Outdated Rate 指标,能够反映开发者对审查评论的实际采纳情况,从而实现大规模的自动化评估和系统优化。实证评估证明了 BitsAI-CR 的有效性,在审查评论生成中达到了 75.0% 的精确率。对于在 ByteDance 占主导地位的 Go 语言,我们保持了 26.7% 的 Outdated Rate。该系统已成功部署在 ByteDance,为超过 12,000 名周活跃用户(WAU)提供服务。我们的工作为自动化代码审查的实际应用提供了宝贵见解,并为寻求大规模实施自动化代码审查的组织提供了蓝图。

英文摘要:

Code review remains a critical yet resource-intensive process in software development, particularly challenging in large-scale industrial environments. While Large Language Models (LLMs) show promise for automating code review, existing solutions face significant limitations in precision and practicality. This paper presents BitsAI-CR, an innovative framework that enhances code review through a two-stage approach combining RuleChecker for initial issue detection and ReviewFilter for precision verification. The system is built upon a comprehensive taxonomy of review rules and implements a data flywheel mechanism that enables continuous performance improvement through structured feedback and evaluation metrics. Our approach introduces an Outdated Rate metric that can reflect developers' actual adoption of review comments, enabling automated evaluation and systematic optimization at scale. Empirical evaluation demonstrates BitsAI-CR's effectiveness, achieving 75.0% precision in review comment generation. For the Go language which has predominant usage at ByteDance, we maintain an Outdated Rate of 26.7%. The system has been successfully deployed at ByteDance, serving over 12,000 Weekly Active Users (WAU). Our work provides valuable insights into the practical application of automated code review and offers a blueprint for organizations seeking to implement automated code reviews at scale.

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

↑