Skip to main content
QUICK REVIEW

[Paper Review] AI-powered Code Review with LLMs: Early Results

Zeeshan Rasheed, M. Sami|arXiv (Cornell University)|Apr 29, 2024
Law, AI, and Intellectual PropertyComputer Science6 citations
TL;DR

Introduces a four-agent LLM-based AI system for autonomous code review to identify bugs, code smells, and optimize code, trained on large GitHub datasets. Preliminary results show effective issue detection and actionable recommendations across diverse AI projects.

ABSTRACT

In this paper, we present a novel approach to improving software quality and efficiency through a Large Language Model (LLM)-based model designed to review code and identify potential issues. Our proposed LLM-based AI agent model is trained on large code repositories. This training includes code reviews, bug reports, and documentation of best practices. It aims to detect code smells, identify potential bugs, provide suggestions for improvement, and optimize the code. Unlike traditional static code analysis tools, our LLM-based AI agent has the ability to predict future potential risks in the code. This supports a dual goal of improving code quality and enhancing developer education by encouraging a deeper understanding of best practices and efficient coding techniques. Furthermore, we explore the model's effectiveness in suggesting improvements that significantly reduce post-release bugs and enhance code review processes, as evidenced by an analysis of developer sentiment toward LLM feedback. For future work, we aim to assess the accuracy and efficiency of LLM-generated documentation updates in comparison to manual methods. This will involve an empirical study focusing on manually conducted code reviews to identify code smells and bugs, alongside an evaluation of best practice documentation, augmented by insights from developer discussions and code reviews. Our goal is to not only refine the accuracy of our LLM-based tool but also to underscore its potential in streamlining the software development lifecycle through proactive code improvement and education.

Motivation & Objective

  • Motivate the use of LLMs to enhance code reviews beyond traditional static analysis.
  • Develop an AI-agent framework that can detect code smells, bugs, and adherence to best practices.
  • Provide actionable improvement recommendations and potential code optimizations.
  • Demonstrate feasibility and developer reception of LLM-driven feedback in real-world projects.
  • Outline future work comparing LLM-generated documentation against manual methods.

Proposed method

  • Define an LLM-assisted code review architecture with four specialized agents: Code Review, Bug Report, Code Smell, and Code Optimization Agents.
  • Train agents on a large corpus of code repositories, including code reviews, bug reports, and best practices documentation.
  • Use GitHub REST API to access public repository data for training and evaluation.
  • Evaluate the system on 10 AI-based GitHub projects to assess its ability to identify issues and suggest improvements.
  • Emphasize proactive identification of issues and optimization opportunities beyond static analysis.

Experimental results

Research questions

  • RQ1RQ1: How can a LLM-based AI agent effectively assist in code reviews by identifying potential issues and offering actionable recommendations?

Key findings

  • The model identified issues ranging from minor bugs to code smells and inefficiencies across multiple programming languages and AI domains.
  • In DeepDive, the model identified a Unicode parsing bug and suggested refactoring a monolithic function.
  • In NeuroStartUp, hard-coded parameters were flagged as code smells and recommended configurability.
  • In VisionQuest, outdated image segmentation algorithms were replaced with more modern, efficient options.
  • In LinguaKit, bottlenecks in large-text processing were mitigated by parallel processing and better data structures.
  • Other projects (AIFriendly, QuantumLeap, BioNexus, EcoSim, RoboTutor, SafeRoute) yielded detailed feedback on errors, refactoring, caching, and data handling to improve robustness and performance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.