Automated review device, automated review method, and computer program for automated review

The automated review system addresses the labor-intensive and error-prone manual review of software source code by adding supplementary information and generating review results, enhancing the efficiency and accuracy of code analysis.

JP2026111005APending Publication Date: 2026-07-03TOYOTA JIDOSHA KK

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
TOYOTA JIDOSHA KK
Filing Date
2024-12-23
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

The manual review of large and complex software source code is labor-intensive and prone to overlooking critical issues, necessitating an automated and appropriate review solution.

Method used

An automated review system utilizing two generative models to add supplementary information to the source code, including comments and supplementary syntax, followed by generating review results based on the modified code.

Benefits of technology

Enables efficient and accurate automated review of source code, facilitating easier identification of necessary modifications and improvements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026111005000001_ABST
    Figure 2026111005000001_ABST
Patent Text Reader

Abstract

We provide an automated review device that can automatically and appropriately review source code. [Solution] The automatic review device includes a first generation unit 11 that generates a modified source code to which supplementary information has been added to the target source code by inputting the target source code, which is written in a predetermined computer language, into a first generation model that has been pre-trained to add supplementary information to one or more syntaxes written in that computer language, and a second generation unit 12 that generates a review result for the target source code by inputting the modified source code into a second generation model that has been pre-trained to generate a review result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an automatic review device, an automatic review method, and an automatic review computer program for automatically reviewing source code described in a predetermined computer language.

Background Art

[0002] Techniques have been proposed for generating code insights of target source code using a machine learning model trained with training source code associated with one of a specified code labeling type software development tool or a code transformation type software development tool (see Patent Document 1).

Prior Art Documents

Patent Documents

[0003]

Patent Document 1

Summary of the Invention

Problems to be Solved by the Invention

[0004] The source code of software often becomes extremely large. Therefore, when manually reviewing the source code, the man-hours may become extremely large. Also, matters that should originally be checked may be overlooked. Thus, there is a demand for automatically and appropriately reviewing the source code of software not limited to the case of generating code insights.

[0005] Therefore, an object of the present invention is to provide an automatic review device capable of automatically and appropriately reviewing source code.

Means for Solving the Problems

[0006] According to one embodiment, an automated review device is provided. This automated review device includes a first generation unit that generates a modified source code to which supplementary information has been added to the target source code by inputting a target source code written in a predetermined computer language into a first generation model that has been pre-trained to add supplementary information to one or more syntaxes written in that computer language, and a second generation unit that generates a review result for the target source code by inputting the modified source code into a second generation model that has been pre-trained to generate a review result.

[0007] In one embodiment, the supplementary information is a comment explaining the content of a process for a syntax or function that describes a predetermined process.

[0008] In one embodiment, the first generation unit deletes a predetermined syntax contained in the target source code and then inputs the target source code into the first generation model. The first generation model then adds, as supplementary information, supplementary syntax describing the processing to be implemented by the predetermined syntax to the location in the target source code where the predetermined syntax was deleted.

[0009] In one embodiment, the first generation unit generates a first modified source code in which a supplementary syntax describing a process to be implemented using a predetermined syntax is added as supplementary information to the location where the predetermined syntax in the target source code has been deleted, and a second modified source code in which a comment explaining the content of the process is added as supplementary information to the syntax or function describing the predetermined process. The second generation unit generates a review result by inputting the first modified source code and the second modified source code into a second generation model.

[0010] According to another embodiment, an automated review method is provided. This automated review method includes a computer inputting target source code written in a predetermined computer language into a first generative model pre-trained to add supplementary information to one or more syntaxes written in that computer language, thereby generating a modified source code to which the supplementary information has been added to the target source code, and the computer inputting the modified source code into a second generative model pre-trained to generate review results, thereby generating a review result for the target source code.

[0011] In yet another embodiment, an automated review computer program is provided. This automated review computer program includes instructions for causing a computer to perform the following actions: input a target source code written in a predetermined computer language into a first generative model that has been pre-trained to add supplementary information to one or more syntaxes written in that computer language, thereby generating a modified source code to which the supplementary information has been added to the target source code; and input the modified source code into a second generative model that has been pre-trained to generate review results, thereby generating a review result for the target source code. [Effects of the Invention]

[0012] The automated review device described herein has the effect of being able to automatically and appropriately review source code. [Brief explanation of the drawing]

[0013] [Figure 1] This is a hardware configuration diagram of an automated review system. [Figure 2] This is a functional block diagram of the processor in the automated review device. [Figure 3] This figure shows an example of the corrected source code. [Figure 4] This figure shows another example of the corrected source code. [Figure 5] This is a flowchart illustrating the operation of the automated review process. [Modes for carrying out the invention]

[0014] The following describes the automated review device, the automated review method executed on the automated review device, and the computer program for automated review, with reference to the diagram. This automated review device generates a modified source code to which supplementary information has been added to the target source code by inputting the source code to be reviewed (hereinafter sometimes simply referred to as the target source code), which is written in a predetermined computer language, into a first generative model that has been pre-trained to add supplementary information to one or more syntax elements written in that computer language. Then, this automated review device generates a review result for the target source code by inputting the generated modified source code into a second generative model that has been pre-trained to generate review results.

[0015] The specified computer language is not particularly limited as long as it is a language that can write source code that can be executed by a computer, such as C, C++, C#, COBOL, HTML, Java®, Perl, PHP, Python®, Ruby, Swift, etc.

[0016] Figure 1 is a hardware configuration diagram of the automated review device. As shown in Figure 1, the automated review device 1 includes a communication interface 2, an input device 3, a display device 4, a storage device 5, a memory 6, and a processor 7.

[0017] Communication interface 2 has a communication interface for connecting to a communication network conforming to a predetermined communication standard and a circuit for performing communication in accordance with that communication standard. Communication interface 2 receives data, including the target source code, from other devices (not shown) connected via the communication network and passes it to processor 7.

[0018] In addition, the communication interface 2 may transmit data including the review result for the reviewed target source code received from the processor 7 to other devices.

[0019] The input device 3 includes, for example, a keyboard and a pointing device such as a mouse. Then, the input device 3 generates an operation signal according to an operation by the user, for example, an operation of inputting or editing the target source code, an operation of instructing the start of review, or an operation of instructing to display the review result on the display device 4, and outputs the operation signal to the processor 7.

[0020] The display device 4 includes, for example, a liquid crystal display or an organic EL display. Then, the display device 4 displays display data received from the processor 7, for example, the reviewed target source code.

[0021] Note that the input device 3 and the display device 4 may be an integrated device such as a touch panel display.

[0022] The storage device 5 is an example of a storage unit, and is, for example, a solid state drive, a magnetic recording device, or an optical recording device. The storage device 5 stores a computer program for automatic review processing executed on the processor 7 and various parameters defining the first generation model and the second generation model. Further, the storage device 5 may store data representing the target source code and the review result.

[0023] [[ID=2)]The memory 6 is another example of a storage unit, and is, for example, a readable and writable semiconductor memory and a read-only semiconductor memory. Then, the memory 6 stores, for example, various data used for automatic review processing and various data generated during the execution of automatic review processing.

[0024] The processor 7, for example, has one or more CPUs and their peripheral circuits. Furthermore, the processor 7 may have arithmetic circuits for numerical calculations and arithmetic circuits for graphics processing. The processor 7 then performs an automated review process.

[0025] Figure 2 is a functional block diagram of the processor 7. As shown in Figure 2, the processor 7 has a first generation unit 11 and a second generation unit 12. Each of these parts of the processor 7 is, for example, a functional module realized by a computer program executed on the processor 7. Alternatively, each of these parts of the processor 7 may be a dedicated arithmetic circuit provided on the processor 7.

[0026] The first generation unit 11 inputs the target source code into the first generation model to generate a modified source code to which supplementary information has been added to the target source code.

[0027] The first generative model can be a so-called large-scale language model (LLM) that generates a response as text data to input text data. The first generative model configured as an LLM can be configured as a stack of multiple blocks, each implementing a sublayer with an attention mechanism and a feed-forward sublayer. The first generative model is pre-trained according to a predetermined learning method corresponding to the LLM so that when target source code is input, it generates modified source code that adds supplementary information to one or more syntax elements written in the computer language used to write the target source code. By using such an LLM as the first generative model, appropriate supplementary information is added to the target source code.

[0028] Supplementary information is, for example, a comment explaining the content of a given process in a syntax or function that describes that process. In this case, the supplementary information is added, for example, immediately before or after the syntax or function that describes the given process.

[0029] Alternatively, the first generation unit 11 may delete a predetermined syntax contained in the target source code before inputting the target code into the first generation model. In this case, the first generation model generates a modified source code in which, as supplementary information, a supplementary syntax describing the processing to be implemented by the deleted predetermined syntax is added to the location where the predetermined syntax was deleted in the target source code. The supplementary syntax can be a standard syntax describing the processing to be implemented. In this case, the first generation unit 11 divides the target source code into syntaxes by applying a predetermined syntactic analysis method. The first generation unit 11 then determines one of the divided syntaxes to be deleted. In this case, the first generation unit 11 can determine the syntax to be deleted randomly. The predetermined syntax to be deleted can be any syntax that defines any processing, for example, a variable or function definition, conditional branching, looping, one or more function calls, or a combination thereof. The number of syntaxes deleted from a single target source code may be one or multiple.

[0030] The first generation unit 11 may generate both a modified source code (second modified source code) with comment statements added as supplementary information, and a modified source code (first modified source code) with supplementary syntax added as supplementary information. Alternatively, the first generation model may be input to the target source code after some syntax has been deleted from it, thereby generating a modified source code in which supplementary syntax has been added for the deleted syntax and comment statements have been added for syntax or functions that have not been deleted.

[0031] Figure 3 shows an example of modified source code. In the example shown in Figure 3, the target source code 300 itself is input to the first generation model 310. Therefore, the modified source code 320 generated by the first generation model 310 is the target source code 300 with comments 321 and 322 added.

[0032] Figure 4 shows another example of the modified source code. In the example shown in Figure 4, the target source code 400 with syntax 401 removed is input to the first generating model 410. Therefore, the modified source code 420 generated by the first generating model 410 is the target source code 400 with supplemental syntax 421, which corresponds to the deleted syntax 401, added.

[0033] The first generation unit 11 passes the modified source code to the second generation unit 12.

[0034] The second generation unit 12 generates a review result for the target source code by inputting the modified source code into the second generation model. In this embodiment, the second generation model generates a reviewed source code as the review result, to which a review comment statement representing the review content is added.

[0035] The second generative model can be an LLM having a similar structure to the first generative model. The second generative model is pre-trained according to a predetermined learning method corresponding to the LLM so that when a modified source code is input, it generates a reviewed source code with review comments added to the modified source code. The first and second generative models may be separate models, or they may be the same model. In this case, one generative model is pre-trained to generate a modified source code with supplementary information added for the input of the target source code, and to generate a reviewed source code for the input of the modified source code.

[0036] Review comments may include, for example, comments pointing out areas for improvement in a particular syntax or function, comments suggesting alternative syntax or functions, comments indicating syntax, functions, or comments that should be added to a specific location in the source code, or comments indicating that no modifications are necessary. This makes it easier for users to determine whether or not the source code should be modified by referring to the review comments. Furthermore, it makes it easier for users to determine what needs to be modified in the source code and what those modifications should entail.

[0037] When modified source code with added supplementary comments is input to the second generative model, the second generative model can generate review results that refer to the explanation of the processing content indicated in those comments. As a result, the second generative model can generate more appropriate review results compared to when the target source code itself, without the added supplementary information, is input.

[0038] Furthermore, when modified source code with supplemental syntax added as supplemental information is input to a second generative model, the second generative model can generate more appropriate review results for the parts related to that supplemental syntax.

[0039] Furthermore, if both a first modified source code with added supplementary syntax as supplementary information and a second modified source code with added comment text as supplementary information are generated, the second generation unit 12 may input both as a single text data into the second generation model. In this way, by inputting multiple modified source codes with different supplementary information into the second generation model, the second generation model can refer to these different supplementary information, thereby enabling the generation of more appropriate review results. Also, if a modified source code with added supplementary syntax as supplementary information is generated, the second generation unit 12 may input the modified source code and the original target source code as a single text data into the second generation model. This allows the second generation model to refer to both the original syntax and the corresponding supplementary syntax, thereby enabling the generation of more appropriate review results for the original syntax.

[0040] The second generation unit 12 saves the reviewed source code to the storage device 5 or displays it on the display device 4. The second generation unit 12 may also output the reviewed source code to other devices via the communication interface 2.

[0041] According to the modified example, the second generative model may be pre-trained to generate text data containing review comments representing the review content, instead of the reviewed source code, as a review result.

[0042] Figure 5 is an operation flowchart of the automated review process according to this embodiment. The processor 7 executes the automated review process according to this operation flowchart.

[0043] The first generation unit 11 inputs the target source code into the first generation model to generate a modified source code with supplementary information added to the target source code (step S101). The second generation unit 12 inputs the modified source code into the second generation model to generate a reviewed source code with review comments added (step S102). The processor 7 then terminates the automatic review process. As shown in the modified example above, the second generation model may be pre-trained to generate text data including review comments. In this case, inputting the modified source code into the second generation model generates text data including review comments instead of a reviewed source code.

[0044] As explained above, this automated review system generates review results using a generative model that adds supplementary information to the target source code before generating the review results. In this way, because this automated review system can utilize supplementary information when generating review results, it can automatically and appropriately review the target source code.

[0045] Furthermore, the computer program that realizes the functions of each part of the processor 7 of the automatic review device according to the above embodiment or modification may be provided as a computer program product, for example, in the form of being recorded on a computer-readable portable recording medium. Such a recording medium may be, for example, a semiconductor memory, a magnetic recording medium, or an optical recording medium.

[0046] As described above, those skilled in the art can make various modifications within the scope of the present invention to suit the implemented form. [Explanation of symbols]

[0047] 1 Automatic review device, 2 Communication interface, 3 Input device, 4 Display device, 5 Storage device, 6 Memory, 7 Processor, 11 First generation unit, 12 Second generation unit

Claims

1. A first generation unit generates a modified source code to which the supplementary information has been added to the target source code, by inputting the target source code written in a predetermined computer language into a first generation model that has been pre-trained to add supplementary information to one or more syntaxes written in the computer language; A second generation unit generates the review results for the target source code by inputting the modified source code into a second generation model that has been pre-trained to generate review results, An automated review device having the following features.

2. The automatic review device according to claim 1, wherein the supplementary information is a comment explaining the content of a predetermined process for a syntax or function that describes said process.

3. The automatic review device according to claim 1, wherein the first generation unit deletes a predetermined syntax contained in the target source code and then inputs the target source code into a first generation model, and the first generation model adds, as supplementary information, a supplementary syntax that describes the processing to be implemented by the predetermined syntax to the position in the target source code where the predetermined syntax was deleted.

4. The first generation unit generates a first modified source code in which a supplementary syntax describing the processing to be implemented using the predetermined syntax is added as supplementary information to the location in the target source code where the predetermined syntax has been deleted, and a second modified source code in which a comment explaining the content of the processing is added to the syntax or function describing the predetermined processing as supplementary information. The automatic review device according to claim 1, wherein the second generation unit generates the review result by inputting the first modified source code and the second modified source code into the second generation model.

5. By inputting the target source code, written in a predetermined computer language, into a first generative model that has been pre-trained to add supplementary information to one or more syntaxes written in the computer language, a modified source code is generated to which the supplementary information has been added to the target source code. The aforementioned modified source code is input into a second generative model that has been pre-trained to generate review results, thereby generating the review results for the target source code. An automated review method that includes this.

6. By inputting the target source code, written in a predetermined computer language, into a first generative model that has been pre-trained to add supplementary information to one or more syntaxes written in the computer language, a modified source code is generated to which the supplementary information has been added to the target source code. The aforementioned modified source code is input into a second generative model that has been pre-trained to generate review results, thereby generating the review results for the target source code. An automated computer program for reviewing tasks, designed to be performed by a computer.