Source code generation support device, source code generation support method, and program

The source code generation support device enhances software development efficiency by automating specification and code generation, addressing inconsistencies and manual modifications in LLM-based development.

JP2026060181APending Publication Date: 2026-04-08NIPPON TELEGRAPH & TELEPHONE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2026-04-08

AI Technical Summary

Technical Problem

The quality of software development using large language models (LLMs) heavily depends on the developer's ability to write detailed instructions, leading to inconsistencies and frequent manual modifications, especially when integrating generated code with existing source code.

Method used

A source code generation support device that includes a specification generation unit to generate a specification document from pre-trained language models and a source code generation unit to create code based on modified specifications, reducing the need for manual coding and ensuring complete specification descriptions.

Benefits of technology

Improves software development efficiency by generating stable and high-quality code through automated specification and code generation, minimizing bugs and manual editing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026060181000001_ABST
    Figure 2026060181000001_ABST
Patent Text Reader

Abstract

To support the efficiency of software development. [Solution] The source code generation support device includes a specification generation unit configured to input a first source code and generate a first specification document showing the specifications of the first source code using a pre-trained language model, and a source code generation unit configured to input a second specification document in which a part of the first specification document has been modified and generate a second source code based on the second specification document using the language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a source code generation support device, a source code generation support method, and a program.

Background Art

[0002] In the field of software development, the use of large language models (LLMs) is spreading. LLMs have the ability to generate the source code of a program in response to instructions (prompts) described in natural language from developers, and as disclosed in Non-Patent Document 1, it is known that they can improve software development tasks and programming work efficiency.

Prior Art Documents

Non-Patent Documents

[0003]

Non-Patent Document 1

Non-Patent Document 2

Summary of the Invention

Problems to be Solved by the Invention

[0004] Traditionally, the quality of software development using LLMs has heavily depended on the developer's ability to write instructions, resulting in inconsistencies in the quality of executable and correct source code, and frequent manual modifications. In particular, when integrating LLM-generated code with existing source code, as reported in Non-Patent Document 2, a significant amount of manual coding work is added.

[0005] This invention has been made in view of the above points, and aims to support the efficiency of software development. [Means for solving the problem]

[0006] To solve the above problems, the source code generation support device includes a specification generation unit configured to input a first source code and generate a first specification document showing the specifications of the first source code using a pre-trained language model, and a source code generation unit configured to input a second specification document in which a part of the first specification document has been modified and generate a second source code based on the second specification document using the language model. [Effects of the Invention]

[0007] It can help improve the efficiency of software development. [Brief explanation of the drawing]

[0008] [Figure 1] This figure shows an example of the hardware configuration of the source code generation support device 10 in an embodiment of the present invention. [Figure 2] This figure shows an example of the functional configuration of the source code generation support device 10 in an embodiment of the present invention. [Figure 3] This figure shows an example of the source code of the program to be modified. [Figure 4] This figure shows an example of instructions for modifying the target code. [Figure 5] This figure shows an example of the revised source code. [Figure 6] This is a flowchart illustrating the processing steps performed by the source code generation support device 10. [Figure 7] This figure shows an example of an instruction document that indicates the instructions for generating a reverse code specification. [Figure 8] This figure shows an example of a reverse code specification. [Figure 9] This figure shows an example of a revised specification. [Figure 10] The second example of the corrected code is shown in the figure. [Modes for carrying out the invention]

[0009] Embodiments of the present invention will be described below with reference to the drawings. Figure 1 is a diagram showing an example of the hardware configuration of a source code generation support device 10 in an embodiment of the present invention. The source code generation support device 10 in Figure 1 includes a drive device 100, an auxiliary storage device 102, a memory device 103, a processor 104, and an interface device 105, etc., which are all interconnected by bus B.

[0010] The program that enables processing by the source code generation support device 10 is provided on a recording medium 101 such as a CD-ROM. When the recording medium 101 containing the program is set in the drive device 100, the program is installed from the recording medium 101 to the auxiliary storage device 102 via the drive device 100. However, the program does not necessarily have to be installed from the recording medium 101; it may also be downloaded from another computer via a network. The auxiliary storage device 102 stores the installed program as well as necessary files and data.

[0011] When there is an instruction to start a program, the memory device 103 reads and stores the program from the auxiliary storage device 102. The processor 104 is a CPU or a GPU (Graphics Processing Unit), or both a CPU and a GPU, and executes the functions related to the source code generation support device 10 according to the program stored in the memory device 103. The interface device 105 is used as an interface for connecting to a network.

[0012] FIG. 2 is a diagram showing a functional configuration example of the source code generation support device 10 in an embodiment of the present invention. In FIG. 2, the source code generation support device 10 includes a specification document generation unit 11, a source code generation unit 12, and a language model 13. Each of these units is realized by a process executed by the processor 104 for one or more programs installed in the source code generation support device 10.

[0013] The language model 13 is a machine learning model that has been pre-trained on natural language. It takes as input an instruction document (prompt) that is text described in natural language and outputs text corresponding to the prompt. Having been pre-trained on natural language means that the occurrence probabilities of words, sentences, etc. in natural language have been learned. As the language model 13, a known large language model (LLM (Large Language Model)) such as ChatGPT can be used.

[0014] The functions of the specification document generation unit 11 and the source code generation unit 12 will be described later.

[0015] For convenience of explanation, the following situation is assumed in the present embodiment.

[0016] Suppose there is source code as shown in FIG. 3 (hereinafter referred to as "target code"). The target code is the source code of a program that extracts a first name and a family name from an input string. The target code may be source code created by a user (such as a developer), or may be source code generated by the user using the language model 13. The target code assumes two patterns as input strings, such as "Tanaka Taro" or "Mr. Tanaka Taro". The former is a pattern in which the input string contains two strings separated by a space, namely the family name and the first name. The latter is a pattern in which the input string contains three strings separated by a space, namely a honorific (such as Mr.), the family name, and the first name. The target code has an algorithm such that when the input string contains two strings, the first string is extracted as the family name and the second string is extracted as the first name, and when the input string contains three strings, the second string is extracted as the family name and the third string is extracted as the first name.

[0017] The user wants to modify the target code so that the first name and the family name can be extracted even when the input string contains a middle name, such as "Tanaka James Taro". The specification corresponding to the pattern where the input string contains a middle name is hereinafter referred to as the "modification specification".

[0018] In this case, it is conceivable to instruct the language model 13 to modify the target code by inputting an instruction sheet as shown in FIG. 4 to the language model 13.

[0019] Suppose that in response to the input of the instruction sheet, the language model 13 outputs a modified version of the source code as shown in FIG. 5. The point of modification of the source code is that when the input string contains three strings, the first string is extracted as the family name and the third string is extracted as the first name. As a result, the program based on the source code can extract the family name and the first name when the input string contains a middle name.

[0020] However, the source code in question cannot handle input strings that include honorifics, such as "Mr. Tanaka Taro". When "Mr. Tanaka Taro" is entered into a program based on the source code (Figure 5), "Mr." "Taro" is output.

[0021] This is because only the modification details were requested from the language model 13, and the specifications of the target code's functionality were not communicated, causing the language model 13 to break the original functionality. One way to solve this problem is to write the instructions in more detail. However, making the instructions more detailed requires prompt engineering skills and a certain amount of effort. Therefore, the source code generation support device 10 executes the following processing procedure.

[0022] Figure 6 is a flowchart illustrating the processing steps performed by the source code generation support device 10.

[0023] In step S101, the specification generation unit 11 receives input of the target code (Figure 3) from the user (for example, a program).

[0024] Next, the specification generation unit 11 uses the language model 13 to perform processing to generate a specification (text indicating the functionality of the target code) (hereinafter referred to as the "reverse code specification") that has been reverse-generated or restored from the target code (S102-S104). The reverse code specification may include the interface of functions and methods (specifications of arguments and return values), examples of code execution (input / output, errors), an overview of algorithms and processing procedures, data structures used, and analysis reports of non-functional requirements such as execution performance and vulnerabilities.

[0025] Specifically, the specification generation unit 11 generates an instruction (prompt) indicating the instruction to generate a reverse code specification (S102).

[0026] Figure 7 shows an example of an instruction document indicating the instructions for generating a reverse code specification. In Figure 7, instruction document t1 begins with the sentence, "Please provide the specifications for the following program," and this sentence is followed by the entire target code.

[0027] For example, a text containing only the first sentence may be stored as a template in the auxiliary storage device 102 or the like. In this case, the specification generation unit 11 can generate an instruction sheet like the one shown in Figure 7 by adding the target code to the template.

[0028] Next, the specification generation unit 11 inputs the generated instruction document t1 (Figure 7) into the language model 13 and obtains the text that the language model 13 outputs based on the instruction document t1 (S103).

[0029] Next, the specification generation unit 11 outputs the text output by the language model 13 to the user as a reverse code specification (S104).

[0030] Figure 8 shows an example of a reverse code specification. Figure 8 shows an example where the reverse code specification t2 includes an overview of the program's functions related to the target code, the program's arguments, and return values. Note that the reverse code specification t2 is an example of a reverse code specification generated based on instruction t1.

[0031] Furthermore, the output format for the reverse code specification t2 to the user is not limited to a predetermined format. It may be saved as a file on the auxiliary storage device 102, or the contents of the file may be displayed on the display device.

[0032] The user creates a specification document that includes the modified specification (hereinafter referred to as the "modified specification") by modifying a portion of the reverse code specification document t2.

[0033] Figure 9 shows an example of a revised specification. The revised specification t3 shown in Figure 9 is a text in which description d1 has been added to the reverse code specification t2 (Figure 8). Description d1 indicates that strings in the format of "Mr. Tanaka James Taro" and "Mr. Tanaka James Taro" are also candidates for input strings.

[0034] Next, the source code generation unit 12 receives the revised specification t3 from the user (S105).

[0035] Next, the source code generation unit 12 executes a process to generate source code based on the revised specification t3 (hereinafter referred to as "revised code") using the language model 13 (S106-S108).

[0036] Specifically, the source code generation unit 12 generates an instruction (prompt) indicating the instruction to generate corrected code (S106). For example, the source code generation unit 12 generates an instruction that includes a corrected specification t3 (Figure 9), following a line such as "Please generate a program that satisfies the following specifications."

[0037] Next, the source code generation unit 12 inputs the generated instructions into the language model 13 and obtains the text that the language model 13 outputs based on those instructions (S107).

[0038] Next, the source code generation unit 12 outputs the text output by the language model 13 to the user as source code that satisfies the revision specification (hereinafter referred to as "revised code") (S108).

[0039] Figure 10 shows a second example of the modified code. The modified code t4 shown in Figure 10 includes an algorithm that removes "Mr." or "Ms." from the input string if they are present, and then extracts the surname and given name according to the number of space-separated characters in the input string in that state. Therefore, according to modified code t4, the surname and given name can be extracted regardless of whether a middle name is present or not.

[0040] If the corrected code is not in the desired state, the user may directly modify the corrected code. Alternatively, steps S101 onwards in Figure 6 may be re-executed with the corrected code as the target code. In this case, a reverse code specification is generated for the corrected code. The corrected code is then generated based on a corrected specification which is a modified version of the reverse code specification.

[0041] As described above, according to this embodiment, the user can obtain the desired modified code by inputting the target code into the source code generation support device 10, creating a modified specification by modifying a part of the reverse code specification output from the source code generation support device 10, and inputting the modified specification into the source code generation support device 10. Therefore, it is possible to support the efficiency of software development.

[0042] By having the language model 13 generate a reverse code specification based on the target code, it is possible to reduce the deficiencies in the specification description necessary for code generation compared to when the specification is written by an individual developer. As a result, it becomes possible to generate code of more stable quality based on a complete specification description. In addition, since new source code (corrected code) can be generated by modifying the reverse code specification, it is possible to suppress the introduction of bugs caused by developers directly editing the code.

[0043] In this embodiment, the target code is an example of the first source code. The reverse code specification is an example of the first and third specifications. The modification specification is an example of the second and fourth specifications. The modified code is an example of the second and third source code.

[0044] Although embodiments of the present invention have been described in detail above, the present invention is not limited to these specific embodiments, and various modifications and changes are possible within the scope of the gist of the present invention as described in the claims. [Explanation of Symbols]

[0045] 10. Source Code Generation Support Device 11. Specification Generation Department 12. Source Code Generation Unit 13 Language Models 100 drive unit 101 Recording media 102 Auxiliary storage 103 Memory device 104 Processors 105 Interface device B Bus

Claims

1. A specification generation unit is configured to take a first source code as input and generate a first specification document that shows the specifications of the first source code using a pre-trained language model, A source code generation unit is configured to take a second specification, which is a modified version of the first specification, as input, and to generate a second source code based on the second specification using the language model, A source code generation support device characterized by having the following features.

2. The specification generation unit is configured to take the second source code as input and generate a third specification that shows the specifications of the second source code using the language model. The source code generation unit is configured to receive a fourth specification, which is a modified version of the third specification, and to generate a third source code based on the fourth specification using the language model. The source code generation support device according to feature 1.

3. A specification generation procedure that takes a first source code as input and generates a first specification document that shows the specifications of the first source code using a pre-trained language model, A source code generation procedure that inputs a second specification in which a part of the first specification has been modified, and generates a second source code based on the second specification using the language model, A source code generation support method characterized by a computer executing the following.

4. A specification generation procedure that takes a first source code as input and generates a first specification document that shows the specifications of the first source code using a pre-trained language model, A source code generation procedure that inputs a second specification in which a part of the first specification has been modified, and generates a second source code based on the second specification using the language model, A program that causes a computer to execute something.