Program defect automatic repair method, system and equipment based on retrieval enhancement and readable storage medium

Through a search enhancement method, combined with lexical and semantic similarity analysis, context-enhanced repair tips are constructed, which solves the problem of insufficient information utilization when processing long code fragments, and improves the accuracy and automation of automatic program defect repairs , enhances the reliability of the software.

CN119127154APending Publication Date: 2024-12-13HARBIN INST OF TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411123801.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

When the existing automatic program defect repair technology is processed with long code snippets, it is difficult for the language model to make full use of the context information in the original program code file, resulting in a low repair success rate and relying on a single information source, high computational complexity, and limited application scope. .

Method used

Using a search enhancement-based method, by collecting repair templates, calculating lexical and semantic similarity, generating a comprehensive similarity ranking list, extracting candidate identifiers, constructing context-enhanced repair prompts, and inputting them into the language model to generate candidate patches, combined with static Analytics and automated verification ensure patch validity.

Benefits of technology

It significantly improves the automation and accuracy of program error repair, enhances the accuracy and universality of repair prompts, reduces the workload of developers, and improves the reliability and stability of software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_2
    Figure QLYQS_2
  • Figure QLYQS_3
    Figure QLYQS_3
Patent Text Reader

Abstract

The invention relates to an automatic program defect repairing method based on retrieval enhancement, which comprises the following steps of: S1, collecting a repairing template, and constructing a repairing template database; step S2, retrieving a matched repair template from a repair template database; s3, calculating the lexical similarity and the semantic similarity of the context code line and the error code line; s4, based on a cross-correlation ranking fusion strategy, generating a comprehensive similarity ranking list of the code lines; s5, based on the comprehensive similarity ranking list, candidate identifiers are extracted from the similar code lines; s6, constructing a restoration prompt based on context enhancement; inputting the repair prompt into the language model to generate candidate patches; and S7, verifying the candidate patches. According to the method, historical repair template retrieval and local related code retrieval are creatively combined, the multi-dimensional similarity analysis and static analysis technologies are utilized, a context-enhanced repair prompt is generated, and the effectiveness of patches is ensured through an automatic verification mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer software and artificial intelligence technology, and specifically relates to a method, system, device and readable storage medium for automatically repairing program defects based on retrieval enhancement. Background Art

[0002] Automated Program Repair (APR) is a technology that aims to detect and repair software defects through automated means. As the complexity and scale of software systems increase, manual repair of program defects becomes more and more time-consuming and error-prone, so the application of APR in this field is particularly important. At present, APR technology has made significant progress in both academia and industry, mainly including repair methods based on predefined rules, repair methods based on machine translation, and repair methods based on language models.

[0003] Repair methods based on predefined rules use the semantic information of the program to repair defects. This type of method uses symbolic execution and constraint solving technology to generate semantically consistent patches. PyTER is a representative of this type of method. However, this type of method usually relies on the precise semantic information of the program, has a limited scope of application, and has high computational complexity.

[0004] Machine translation-based repair methods translate the input error code into the correct code by training a translation model, and CoCoNuT is a representative of this type of method. However, these models need to be trained with a large amount of data, and they have poor ability to generate correct patches when faced with new types of errors or unseen code snippets.

[0005] In recent years, repair methods based on language models have gradually become a research hotspot. By training large-scale pre-trained language models, these methods can learn the rules of patch generation from a large number of historical repair examples. For example, Codex has demonstrated strong capabilities in code generation and understanding, bringing new opportunities for APR technology. At present, the repair method based on language models is to input the defective program and its context into the language model and output the repaired code. AlphaRepair is a representative of this type of method. However, the context window of the language model is limited, which makes the maximum code length allowed to be input by the language model often smaller than the actual defective program code and its context code length, making it difficult for the model to fully utilize the contextual information related to the repair defect in the original program code file. Therefore, there is a low repair success rate when processing long code snippets. Summary of the invention

[0006] In order to solve the above technical problems, the present invention proposes a method, system, device and readable storage medium for automatically repairing program defects based on retrieval enhancement.

[0007] The present invention adopts the following technical solution:

[0008] A method for automatically repairing program defects based on retrieval enhancement comprises the following steps:

[0009] Step S1, collecting repair templates and building a repair template database;

[0010] Step S2, retrieving a matching repair template from a repair template database;

[0011] Step S3, calculating the lexical similarity and semantic similarity between the context code line and the error code line;

[0012] Step S4: Generate a comprehensive similarity ranking list of code lines based on the cross-correlation ranking fusion strategy; adopt the cross-correlation ranking fusion strategy to combine lexical similarity and semantic similarity to generate a comprehensive similarity ranking list; the specific calculation formula is as follows:

[0013]

[0014] Among them, score(x) represents the comprehensive similarity score of a specific code line x, and rank lex (x) represents the position of a particular line of code x in the lexical ranking list, rank sem (x) represents the position of a specific code line x in the semantic ranking list; p is a constant parameter, usually taking the value of 60.

[0015] Step S5, extracting candidate identifiers from similar code lines based on the comprehensive similarity ranking list;

[0016] Step S6: constructing a repair hint based on context enhancement; and inputting the repair hint into the language model to generate candidate patches;

[0017] Step S7, candidate patch verification; code syntax check is performed on the generated candidate patches, and candidate patches containing syntax errors are removed; the test suite is executed on the candidate patches without syntax errors, the correct patches that pass the test suite are identified, and the patches are output to complete the repair.

[0018] Furthermore, the step S1 is specifically as follows:

[0019] Automatically collect code snippets containing program defects and their corresponding repair code snippets from open source code repositories;

[0020] Repair templates are extracted from the collected code snippets. These templates are recorded by analyzing historical repair instances and organized into a repair template database.

[0021] Furthermore, the step S2 is specifically as follows:

[0022] Generate an abstract syntax tree for defective code and analyze the code structure and error location;

[0023] Retrieve the repair template matching the error code from the repair template database; match the templates in the repair template database by traversing all nodes of the abstract syntax tree, and prioritize the templates according to the frequency of occurrence of instances in the open source repository.

[0024] Furthermore, the step S3 is specifically as follows:

[0025] Step S31: extracting a program file containing defective code, and splitting the code in the program file into code lines as basic retrieval units;

[0026] Step S32: Calculate lexical similarity: Use the BM25 algorithm to calculate the lexical similarity between the error code line and other code lines. The specific formula is:

[0027]

[0028] Where q is the query, i.e., the defective code line; d is the program document, i.e., the other code lines in the program file except the defective code; q i is the i-th word in the query; f(q i ,d) is word q i The frequency of occurrence in document d; |d| is the length of document d; avgdl is the average length of all documents; k1 and b are adjustment parameters, k1=1.2, b=0.75; IDF(q i ) is the word q i The inverse document frequency of is defined as: Where N is the total number of documents, n(q i ) is a string containing the word q i The number of documents; using the BM25 algorithm, calculate the lexical similarity between the error code line and other code lines, and generate a relative ranking list rank based on the lexical retrieval module lex ;

[0029] Step S33: Calculate semantic similarity: use the code semantic search model to calculate the semantic similarity between the error code line and other code lines;

[0030] Step S331: Generate an embedding vector, ie, v, for each line of code through the BERT model encoder. i =EP(c i ), where EP(c i ) represents the code line c i The encoding vector of

[0031] Step S332: Encode the error code line through an independent BERT model network to generate a query vector v q ;

[0032] Step S333: Calculate the semantic similarity between the query vector and all code line vectors using the vector inner product: Among them, v q is the query vector of the error code line, v p is the embedding vector of the code line;

[0033] Step S334: According to the semantic similarity, retrieve the code line that is most similar to the error code line, and generate a relative ranking list rank based on the semantic retrieval module sem .

[0034] Furthermore, the step S5 is specifically as follows:

[0035] Extract identifiers from each line of code in the combined similarity ranking list;

[0036] Static analysis is applied to remove identifiers that are inaccessible in the context of the faulty method, generating a ranked list of candidate code identifiers extracted from the code lines.

[0037] Furthermore, the step S6 is specifically as follows:

[0038] Step S61: constructing a repair prompt based on the repair template information retrieved in step S2 and the candidate identifier information retrieved in step S5;

[0039] Step S611: The template retrieval information part indicates the result after the repair template retrieved in step S2 is applied to the given error code fragment; placeholder <infill>Indicate to the model the precise locations where new code should be generated based on the applied template;

[0040] Step S612: context retrieval information part, [DONOR] represents the candidate code identifier retrieved in step S5;

[0041] Step S62: Add the original error code line as a comment at the beginning of the input prompt, and include the context information before and after the defective code line in the repair prompt; start from the defective code line and gradually expand the context size until the maximum input length of the model;

[0042] Step S63: The repair prompt constructed in step S62 is put into the language model, and the output content of the language model is used to replace the placeholder in the repair prompt to generate a candidate patch.

[0043] The present invention also relates to a method system for automatically repairing program defects based on retrieval enhancement, which applies the above method.

[0044] The present invention also relates to a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0045] The present invention also relates to a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0046] Beneficial Effects

[0047] The present invention provides a method for automatically repairing program defects based on retrieval enhancement, which has significant beneficial effects in repairing program defects and has the following advantages over the prior art:

[0048] 1. Comprehensive use of repair templates and context information: Existing automatic program repair technologies usually rely on a single source of information. The present invention, through a retrieval enhancement strategy, comprehensively utilizes the repair templates in the open source code repository and the code context in the local program files, effectively improving the accuracy and universality of the repair prompts.

[0049] 2. Efficient repair template extraction and matching: By automatically extracting repair templates from the open source code repository and generating a repair template database, the present invention avoids the tedious process of manually collecting and organizing repair templates. At the same time, the abstract syntax tree is used for template matching, and the templates are prioritized according to the frequency of occurrence of instances in the open source repository, ensuring the efficiency and practicality of matching repair templates.

[0050] 3. Multi-dimensional similarity analysis: The present invention combines lexical similarity and semantic similarity in the stage of retrieving local context information, and generates a comprehensive similarity ranking list through a cross-correlation ranking fusion strategy. Compared with the method that only uses a single similarity indicator, the present invention can more accurately find code lines similar to the error code lines from the dual dimensions of programming language lexical and semantic, thereby extracting more relevant repair identifiers and improving the accuracy of repair.

[0051] 4. Context-enhanced repair hint generation: The repair hint generated by the present invention not only contains the abstract repair template retrieved from the historical repair submission code, but also combines the specific repair identifier retrieved from the local code file, and contains the contextual information before and after the error code line. This kind of repair hint based on context enhancement can better guide the language model to generate high-quality repair patches.

[0052] In summary, the present invention innovatively combines historical repair template retrieval and local related code retrieval, utilizes multi-dimensional similarity analysis and static analysis technology, generates context-enhanced repair prompts, and ensures the effectiveness of patches through an automated verification mechanism. The present invention can automatically generate high-quality code repair patches, significantly improves the automation and accuracy of program error repair, reduces the workload of developers, and improves the reliability and stability of software. Compared with the existing technology, it has significant advantages and practical value. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 The present invention is a flowchart of the method for automatically repairing program defects based on retrieval enhancement.

[0054] Figure 2 It is a structural diagram of the method for automatically repairing program defects based on retrieval enhancement of the present invention.

[0055] Figure 3 This is a code example diagram showing program defects in the present invention.

[0056] Figure 4 It is a repair prompt diagram corresponding to the example code in the present invention.

[0057] Figure 5 Schematic diagram of the principle of the language model in the present invention. DETAILED DESCRIPTION

[0058] The following combination Figures 1 to 5 This embodiment will be described in detail.

[0059] Figure 1 is a flow chart of the method of the present invention, Figure 2 The present invention is a schematic diagram of the structure of the method of the present invention, and the method of the present invention comprises the following steps:

[0060] Step S1: Collect repair templates and build a repair template database.

[0061] Automatically collect code snippets containing program defects and their corresponding repair code snippets from open source code repositories;

[0062] Repair templates are extracted from the collected code snippets. These templates are recorded by analyzing historical repair instances and organized into a repair template database.

[0063] Step S2: Retrieve a matching repair template from a repair template database.

[0064] Generate an abstract syntax tree for defective code and analyze the code structure and error location;

[0065] Retrieve the repair template matching the error code from the repair template database. By traversing all nodes of the abstract syntax tree, match the templates in the repair template database and prioritize them according to the frequency of occurrence of the template instances in the open source repository.

[0066] Step S3: Calculate the lexical similarity and semantic similarity between the context code line and the error code line.

[0067] Step S31: extracting a program file containing defective code, and splitting the code in the program file into code lines as basic retrieval units.

[0068] Step S32: Calculate lexical similarity: Use the BM25 algorithm to calculate the lexical similarity between the error code line and other code lines. The specific formula is:

[0069]

[0070] Where q is the query, i.e., the defective code line. d is the program document, i.e., the other code lines in the program file except the defective code. i is the i-th word in the query. f(q i ,d) is word q i The frequency of occurrence in document d. |d| is the length of document d. avgdl is the average length of all documents. k1 and b are adjustment parameters, usually k1 = 1.2 and b = 0.75. IDF(q i ) is the word q i The inverse document frequency of is defined as: Where N is the total number of documents, n(q i ) is a string containing the word q i The BM25 algorithm is used to calculate the lexical similarity between the error code line and other code lines, and a relative ranking list rank based on the lexical retrieval module is generated. lex .

[0071] Step S33: Calculate semantic similarity: Use the code semantic search model to calculate the semantic similarity between the erroneous code line and other code lines.

[0072] Step S331: Generate an embedding vector, ie, v, for each line of code through the BERT model encoder. i =EP(c i ), where EP(c i ) represents the code line c i The encoding vector of .

[0073] Step S332: Encode the error code line through an independent BERT model network to generate a query vector v q .

[0074] Step S333: Calculate the semantic similarity between the query vector and all code line vectors using the vector inner product: Among them, v q is the query vector of the error code line, v p is the embedding vector of the code line.

[0075] Step S334: According to the semantic similarity, retrieve the code line that is most similar to the error code line, and generate a relative ranking list rank based on the semantic retrieval module sem .

[0076] Step S4: Generate a comprehensive similarity ranking list of code lines based on the cross-correlation ranking fusion strategy. Adopt the cross-correlation ranking fusion strategy to combine lexical similarity and semantic similarity to generate a comprehensive similarity ranking list. The specific calculation formula is as follows:

[0077]

[0078] Among them, score(x) represents the comprehensive similarity score of a specific code line x, and rank lex (x) represents the position of a particular line of code x in the lexical ranking list, rank sem (x) represents the position of a specific line of code x in the semantic ranking list. p is a constant parameter, usually 60.

[0079] Step S5: Extract candidate identifiers from similar code lines based on the comprehensive similarity ranking list.

[0080] Step S51: extracting an identifier from each line of code in the comprehensive similarity ranking list.

[0081] Step S52: Apply static analysis to remove identifiers that are inaccessible in the context of the error method and generate a ranked list of candidate code identifiers extracted from the code lines.

[0082] Step S6: Constructing context-enhanced restoration hints. Figure 3 This is a sample code with a program defect, where line 3 is the location of the defective code, and lines 4 to 6 are the correct codes after the defect is fixed. Figure 4 It is a repair prompt schematic diagram constructed for the sample code using the present invention.

[0083] Step S61: construct a repair hint based on the repair template information retrieved in step 2 and the candidate identifier information retrieved in step S5, such as Figure 4 shown. Figure 4 Shows an example of a repair hint using Figure 3 The context-enhanced repair hint includes five parts: repair template retrieval information, context retrieval information, defective code line, code before the defective code line, and code after the defective code line.

[0084] Step S611: The repair template retrieval information part indicates the result after the repair template retrieved in step S2 is applied to the given error code segment. <infill>Indicates to the model the precise locations where new code should be generated based on the applied template.

[0085] Step S612: Context retrieval information part, [DONOR] represents the candidate code identifier retrieved in step 5. The present invention packages all the contents of the context retrieval information part in a comment format (in Figure 4 ) and placed before the template retrieval information section. Each repair hint contains only one candidate code identifier. The present invention constructs multiple different repair hints based on the ranked list of candidate identifiers, using the top 5 identifiers in total. By embedding these error-specific identifiers directly into the hints, the language model is able to utilize code identifiers that were initially out of its context window, thereby improving the success rate of generating patches.

[0086] Step S62: Add the original error code line as a comment at the beginning of the input hint, and include the context information before and after the defective code line in the repair hint. In order to make full use of the available context, start with the defective code line and gradually expand the context size (i.e., the number of lines around the defective code) until the maximum input length of the model.

[0087] Step S63: input the constructed repair prompt into the language model to generate a patch. Figure 5 The following is a schematic diagram of the principle of the language model. The language model consists of an encoder-decoder architecture and can be defined as a triple in Represents a vocabulary consisting of a set of tokens defined by the language model, encoder represents the encoder, and decoder represents the decoder. The encoder converts the input error code line and its context information into a vector representation in a low-dimensional continuous space, that is, mapping the input sequence to its encoded representation EncRep: The decoder converts the vector representation generated by the encoder into a specific code token to generate a code patch, that is, the encoded representation is stored in EncRep, receives a token sequence as input, and generates its decoded representation DecRep: In this definition, the decoder stores the encoded representation as a high-order function that returns a detailed decoding function given the encoded representation. The decoded representation DecRep essentially assigns a probability to each token in the vocabulary to indicate how likely it is to be the next token in the sequence. Therefore, DecRep can be defined as: DecRep = ∑ LM →[0,1]. The decoder uses the context information and repair hints received from the encoder to predict the generated code tokens. Placeholders in the repair hints <infill>Instruct the decoder where to insert new code. By including the original error code line and context information in the input prompt, the decoder can better understand the context of the error and thus generate a more accurate repair patch. Finally, the present invention uses the output of the language model to replace the placeholders in the repair prompt information to generate candidate patches.

[0088] Step S7: Candidate patch verification.

[0089] Step S71: Perform code syntax check on the generated candidate patches, and remove candidate patches containing syntax errors.

[0090] Step S72: Execute the test suite for each candidate patch without syntax errors, identify the correct patch that passes the test suite, output the patch, and complete the repair.

[0091] Example

[0092] In order to verify the performance of the retrieval-enhanced program defect automatic repair method proposed in the present invention, a comparative experiment was conducted between the proposed method and the existing method. The defect repair dataset used in the experiment was the BugsInPy dataset. The proposed method was experimented on the open source language model CodeT5. The results are shown in Table 1.

[0093] Table 1

[0094] method The present invention Codex PyTER CoCoNuT AlphaRepair Repair accuracy (%) 53.7 31.5 27.8 11.1 9.3

[0095] As can be seen from Table 1, the automatic program defect repair method based on retrieval enhancement proposed in the present invention has a higher repair accuracy result than the existing method. At the same time, after using the method of the present invention, the repair ability of the language model CodeT5 is significantly improved. This is because the repair prompt construction method based on retrieval enhancement proposed in the present invention can provide the language model with more repair templates and context information related to the repair, which alleviates the problem of repair information loss caused by the limited context window of the language model in the traditional method, thereby effectively improving the model's patch generation accuracy.

[0096] The above contents are only preferred embodiments of the present invention and are not intended to limit the implementation scheme of the present invention. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope required by the claims.< / infill> < / infill> < / infill>

Claims

1. A method for automatically repairing program defects based on retrieval enhancement, characterized in that: The following steps are involved: Step S1, collecting repair templates and building a repair template database; Step S2, retrieving a matching repair template from a repair template database; Step S3, calculating the lexical similarity and semantic similarity between the context code line and the error code line; Step S4: Generate a comprehensive similarity ranking list of code lines based on the cross-correlation ranking fusion strategy; The cross-correlation ranking fusion strategy is adopted to combine lexical similarity and semantic similarity to generate a comprehensive similarity ranking list; the specific calculation formula is as follows: Among them, score(x) represents the comprehensive similarity score of a specific code line x, and rank lex (x) represents the position of a particular line of code x in the lexical ranking list, rank sem (x) represents the position of a particular line of code x in the semantic ranking list; p is a constant parameter. Step S5, extracting candidate identifiers from similar code lines based on the comprehensive similarity ranking list; Step S6: constructing a repair hint based on context enhancement; and inputting the repair hint into the language model to generate candidate patches; Step S7, candidate patch verification; code syntax check is performed on the generated candidate patches, and candidate patches containing syntax errors are removed; the test suite is executed on the candidate patches without syntax errors, the correct patches that pass the test suite are identified, and the patches are output to complete the repair.

2. The method for automatically repairing program defects based on retrieval enhancement according to claim 1, characterized in that: The step S1 is specifically as follows: Automatically collect code snippets containing program defects and their corresponding repair code snippets from open source code repositories; Repair templates are extracted from the collected code snippets. These templates are recorded by analyzing historical repair instances and organized into a repair template database.

3. The method for automatically repairing program defects based on retrieval enhancement according to claim 2, characterized in that: The step S2 is specifically as follows: Generate an abstract syntax tree for defective code and analyze the code structure and error location; Retrieving a repair template matching the error code from a repair template database; By traversing all nodes of the abstract syntax tree, matching and repairing templates in the template database, and prioritizing the templates according to their instance appearance frequency in the open source repository.

4. The method for automatically repairing program defects based on retrieval enhancement according to claim 3, characterized in that: The step S3 is specifically as follows: Step S31: extracting a program file containing defective code, and splitting the code in the program file into code lines as basic retrieval units; Step S32: Calculate lexical similarity: Use the BM25 algorithm to calculate the lexical similarity between the error code line and other code lines. The specific formula is: Where q is the query, i.e., the defective code line; d is the program document, i.e., the other code lines in the program file except the defective code; q i is the i-th word in the query; f(q i ,d) is word q i The frequency of occurrence in document d; |d| is the length of document d; avgdl is the average length of all documents; k1 and b are adjustment parameters, k1=1.2, b=0.75; IDF(q i ) is the word q i The inverse document frequency of is defined as: Where N is the total number of documents, n(q i ) is a string containing the word q i The number of documents; using the BM25 algorithm, calculate the lexical similarity between the error code line and other code lines, and generate a relative ranking list rank based on the lexical retrieval module lex ; Step S33: Calculate semantic similarity: use the code semantic search model to calculate the semantic similarity between the error code line and other code lines; Step S331: Generate an embedding vector, ie, v, for each line of code through the BERT model encoder. i =EP(c i ), where EP(c i ) represents the code line c i The encoding vector of Step S332: Encode the error code line through an independent BERT model network to generate a query vector v q ; Step S333: Calculate the semantic similarity between the query vector and all code line vectors using the vector inner product: Among them, v q is the query vector of the error code line, v p is the embedding vector of the code line; Step S334: According to the semantic similarity, retrieve the code line that is most similar to the error code line, and generate a relative ranking list rank based on the semantic retrieval module sem .

5. The method for automatically repairing program defects based on retrieval enhancement according to claim 4, characterized in that: The step S5 is specifically as follows: Extract identifiers from each line of code in the combined similarity ranking list; Static analysis is applied to remove identifiers that are inaccessible in the context of the faulty method, generating a ranked list of candidate code identifiers extracted from the code lines.

6. The method for automatically repairing program defects based on retrieval enhancement according to claim 5, characterized in that: The step S6 is specifically as follows: Step S61: constructing a repair prompt based on the repair template information retrieved in step S2 and the candidate identifier information retrieved in step S5; Step S611: The template retrieval information part indicates the result after the repair template retrieved in step S2 is applied to the given error code fragment; placeholder <infill> Indicate to the model the precise locations where new code should be generated based on the applied template;< / infill> Step S612: context retrieval information part, [DONOR] represents the candidate code identifier retrieved in step S5; Step S62: adding the original error code line as a comment at the beginning of the input prompt, and including the context information before and after the defective code line in the repair prompt; Start with the defective code line and gradually expand the context size until the maximum input length of the model; Step S63: The repair prompt constructed in step S62 is put into the language model, and the output content of the language model is used to replace the placeholder in the repair prompt to generate a candidate patch.

7. A method system for automatically repairing program defects based on retrieval enhancement, characterized in that: The method according to any one of claims 1 to 6 is used.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Warehouse level code problem solving system based on large language model

    CN119576384A

  • Semantic exploration-based large language model code defect repair method and device

    CN122285053A

  • Defect repairing method, defect repairing device, electronic equipment and computer storage medium

    CN122594058A