Automated Code Review via Intent-Prompted LLM

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Manual code review is time-consuming and prone to human errors, as it requires peers to thoroughly understand and inspect source code for errors, best practices, and vulnerabilities.

Innovation Solution

A system that uses a large language model to predict code review comments by analyzing code changes, intent classification, and context, thereby automating the code review process.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If manual code review is performed by peers, then code quality and error detection improve, but time consumption and human errors increase

Engineering Contradiction:
Improvecode review accuracyVSAvoidcode review time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent replaces the manual mechanical review process with an automated system using large language models and code analysis algorithms. The system automatically analyzes code changes, generates review comments, and identifies issues without human intervention, thereby reducing time consumption while maintaining review quality through consistent algorithmic application.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The code review system performs self-analysis by automatically examining code changes, identifying potential errors, and generating review comments. The system serves itself by using pre-trained models and analysis algorithms to conduct reviews without requiring human reviewers to manually examine each code change, thus eliminating time loss while preserving detection accuracy.

Inventive Principle:
Principle #25Self-service

2Measurement precision

If manual code review is performed, then comprehensive code inspection is achieved, but human errors and inconsistency increase

Engineering Contradiction:
Improveerror detection precisionVSAvoidreview consistency
Core Design Contradiction:
Measurement precisionVSReliability

Solution Approach 1:

The patent replaces human reviewers with automated analysis systems that apply consistent algorithms and criteria to all code reviews. This substitution eliminates human variability and inconsistency while maintaining high detection precision through sophisticated code analysis models that systematically evaluate code against established standards and patterns.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The system changes the parameters of code review from human judgment to algorithmic analysis with defined thresholds and criteria. By transforming subjective human evaluation into objective parameter-based assessment, the system achieves both high precision in error detection and consistent application across all reviews, eliminating the inconsistency inherent in manual processes.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If automated code review is implemented, then time efficiency improves, but understanding of complex code logic may deteriorate

Engineering Contradiction:
Improvecode review throughputVSAvoidcode context understanding
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The system performs preliminary analysis by pre-processing code changes and extracting relevant context before generating review comments. This preliminary action includes identifying code patterns, understanding data flow, and contextualizing changes within the broader codebase, enabling the automated system to maintain deep code understanding while operating at high speed.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces an intermediary layer of code analysis models that bridge the gap between raw code changes and review comments. This intermediary systematically processes code through multiple analysis stages, preserving contextual understanding while enabling high-throughput automated review, thus maintaining code comprehension without sacrificing productivity.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS20250103325A1Code review comment generation via instruction prompting with intent
Publication Date: 2025.03.27 MICROSOFT TECHNOLOGY LICENSING LLC
  • US20250103325A1 patent drawing
  • US20250103325A1 patent drawing
  • US20250103325A1 patent drawing

AI summary

A code review is automatically generated by a large language model given a prompt that includes code changes made to a source code program, an associated intent, and an extended context. The intent represents an issue with the code changes from a code reviewer's perspective and is predicted from a neural classifier given the code changes in a code diff format. The neural classifier is a neural encoder transformer model pre-trained on various code review datasets and fine-tuned on code diff hunks of code changes labeled with an intent.