AB
AiBoss
project

BitsAI-CR - Automated code review tool launched by ByteDance

BitsAI-CR is an automated code review tool developed by ByteDance based on a large language model (LLM). It achieves efficient code review through a two-stage process: RuleChecker is responsible for detecting potential code errors based on 219 rules...

What is BitsAI-CR?

BitsAI-CR is an automated code review tool developed by ByteDance based on a large language model (LLM). It achieves efficient code review through a two-stage process: RuleChecker is responsible for detecting potential issues based on 219 rules, while ReviewFilter verifies the issues to improve accuracy. BitsAI-CR introduces an "obsolete rate" metric to automatically assess developers' acceptance of review suggestions and optimizes review rules through a data flywheel mechanism.

Main functions of BitsAI-CR

  • High-precision code review comment generationBitsAI-CR achieves high-precision code review comment generation through a two-stage processing flow.
  • Code review rules classificationA comprehensive review rule classification system, built upon code style guidelines and practical review experience, provides fundamental support for the system.
  • Integration and AutomationBitsAI-CR can be easily integrated into existing code review processes, automatically identifying potential issues, confirming review categories, locating problematic lines of code, and providing relevant comments. After developers modify the code based on the review suggestions, BitsAI-CR will re-evaluate the code and mark the original comments as "obsolete," while providing "LGTM" (Looks Good To Me) approval.

BitsAI-CR Technical Principles

  • Two-stage review pipeline:
    • RuleCheckerBased on a comprehensive classification of 219 review rules, it detects potential problems in code through fine-tuned LLM.
    • ReviewFilterFollowing RuleChecker, another finely tuned LLM is used to verify detected issues, further improving review accuracy.
  • Data flywheel mechanismOptimize large-scale industrial scenarios through real feedback.
    • Outdated RateAutomatically measures the percentage of lines of code modified after being flagged by BitsAI-CR, assessing whether the developer accepted and implemented the review recommendations.
    • Dynamically adjust review rulesThe review rules are dynamically adjusted based on obsolescence rate and accuracy measurements, and rules that generate low-value comments are removed.
  • Model training and optimizationBased on ByteDance's LLM (Doubao-Pro-32K-0828), the model is fine-tuned using low-rank adaptation (LoRA) technology to ensure a balance between security and performance. It is trained using historical review data to optimize the model and improve review accuracy.

BitsAI-CR project address

Application scenarios of BitsAI-CR

  • Automated code reviewBitsAI-CR automatically identifies potential problems in code through a two-stage review pipeline (RuleChecker and ReviewFilter), generates highly accurate review comments, and locates problematic lines of code.
  • Continuous optimization and feedback mechanismBitsAI-CR introduces the "Outdated Rate" metric, which dynamically adjusts review rules by automatically measuring developers' acceptance and modification of review suggestions.
  • Multilingual support and rule classificationBitsAI-CR is based on a comprehensive review rule classification system, supports multiple programming languages (such as Go), and has developed detailed review rules for the characteristics and common problems of different languages.
  • Integration and Automation ProcessesBitsAI-CR can be seamlessly integrated into existing code review processes, automating the entire process of code submission, review, modification, and approval.