Code generation method and system based on waterfall model and multi-agent cooperation
By using the waterfall model and multi-agent collaboration method, the problems of incomplete code generation logic and low error correction efficiency in existing technologies are solved, thereby improving the accuracy and reliability of code generation.
Patent Information
- Application Number
- CN202511557058.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-10-29
AI Technical Summary
Existing code generation technologies lack systematic problem analysis and solution design when dealing with complex business requirements, resulting in incomplete generated code logic and low efficiency in error correction.
Employing a waterfall model and a multi-agent collaborative approach, this method introduces a problem analysis agent, a solution design agent, a pseudocode design agent, and a repair agent. Through structured reasoning and feedback loop mechanisms, it ensures the logical integrity of the generation process and accurately locates and repairs errors.
It improves the accuracy and reliability of code generation, solves the problems of lack of structured reasoning and effective feedback repair in existing technologies, and significantly improves the level of automation in code generation.
Smart Images

Figure CN121029145A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of software development automation and intelligence, and relates to a code generation method and system based on the waterfall model and multi-agent collaboration. Background Technology
[0002] Code generation technology, an important research direction in software engineering, aims to significantly improve development efficiency and reduce human coding error rates by automatically converting natural language requirements into executable code. This technology requires establishing a correct mapping from unstructured natural language requirements to structured programming languages, while addressing key challenges such as syntactic correctness, logical completeness, and semantic consistency. Research shows that effective code generation technology can not only shorten development cycles but also improve software quality through standardized code structure, making it invaluable for promoting the automation of software development.
[0003] Existing automatic code generation methods largely rely on an end-to-end generation model based on large language models, directly outputting executable code based on natural language requirements. While this approach can quickly produce results in simple scenarios, the lack of intermediate reasoning and structured processing often leads to logical structural flaws in the generated code. For example, when dealing with complex business requirements, the model may skip key analysis steps and ignore dependencies between functions, ultimately resulting in incomplete logic or code that does not meet the requirements. Therefore, existing technologies lack a systematic support mechanism for the problem analysis and solution design phases.
[0004] Furthermore, existing technologies also have shortcomings in the code repair phase. When generated code contains syntax or logical errors, the model typically relies on human feedback or simple trial-and-error corrections. Due to the lack of an effective feedback loop mechanism, the model struggles to accurately pinpoint the source of the error, and is unable to understand the logical essence of the error in context, resulting in an inefficient repair process prone to repeated errors. Therefore, existing technologies lack an effective intelligent process in the error repair phase. Summary of the Invention
[0005] To address the aforementioned problems, this invention proposes a code generation method based on the waterfall model and multi-agent collaboration. This method draws upon the waterfall model concept in software engineering, introducing five specialized agents working collaboratively. The problem analysis agent and solution design agent are responsible for refining and logically decomposing natural language requirements, ensuring that the generation process does not skip critical reasoning steps. The pseudocode design agent provides intermediate-level structured representations, making the coding logic clearer and more traceable. The coding agent then generates executable code based on this. The repair agent, combined with feedback information, locates, explains, and repairs errors, fundamentally improving the accuracy and efficiency of correction. Through these improvements, this invention effectively solves the technical problems of lacking structured reasoning and effective feedback repair mechanisms in existing technologies, improving the accuracy and reliability of code generation.
[0006] This application provides a code generation method based on the waterfall model and multi-agent collaboration to address the technical problems of insufficient structured thinking and debugging capabilities, as well as low accuracy, in existing methods for generating code for large models.
[0007] A code generation method based on the waterfall model and multi-agent collaboration includes the following steps: S1: Initialize the system, which includes a problem analysis agent, a solution design agent, a pseudocode design agent, a coding agent, and a repair agent that communicate with each other; S2: The problem analysis agent retrieves the current programming problem specification file and task number from the code generation public database, parses the function signature, input / output examples and functional description in the specification file; based on the parsed function signature and functional description, it performs semantic retrieval using a large language model to generate several sets of similar task descriptions and their reference solutions. S3: The solution design agent constructs few-shot prompt templates based on several sets of similar task descriptions and their reference solutions, using each set of task descriptions and corresponding reference solutions as examples. Based on the few-shot prompt templates, the large language model is guided to generate candidate solutions for the current task from the reference examples. Then, the confidence scores of each candidate solution are evaluated through a problem verification mechanism. Finally, the candidate solutions are ranked according to the confidence scores, and the optimal solution is selected. S4: The pseudocode design agent generates structured pseudocode corresponding to the optimal solution of the current task using a large language model; it evaluates whether the generated structured pseudocode conforms to the program's sequence, selection, loop structure and task requirements through a problem verification mechanism, and simultaneously obtains the confidence score and evaluation explanation of the pseudocode; if the confidence score is lower than the preset threshold, it iteratively optimizes the pseudocode based on the task description and evaluation explanation feedback until the pseudocode confidence score reaches the preset threshold. S5: The coding agent inputs the optimized pseudocode into the large language model, which then converts the pseudocode into the corresponding target programming language code. S6: The repair agent first extracts example input and output information from the programming problem specification file obtained in S2 and uses it as a common test case; it then uses the common test cases to test the target programming language code generated by the coding agent; if the code fails all the test cases, it extracts the error information output by the compiler and implements a layered repair strategy based on the error type to complete the code repair.
[0008] Furthermore, the specific process of semantic retrieval performed by the problem analysis agent is as follows: a requirement analysis agent is constructed based on the template and role prompt words preset by the large language model. The requirement analysis agent performs self-retrieval on the written function names and task descriptions. The retrieval results are deduplicated, and finally k groups of similar task descriptions and their reference solutions are obtained.
[0009] Furthermore, the problem verification mechanism in S3 specifically includes the following steps: S31: A predefined set of structured verification questions, including functional correctness verification, rationality verification, and requirement fit verification, wherein: Functional correctness verification: The code input and output behavior corresponding to the candidate solution is initially verified by unit test cases or symbolic execution to determine whether the generated candidate solution can logically solve the original programming problem proposed by the user. Reasonableness verification: Evaluate the practical feasibility of candidate solutions, including syntactic correctness, runtime complexity, resource usage, and compatibility with existing development environments. Demand fit verification: Determine whether the candidate solution meets the constraints explicitly or implicitly proposed by the user. The constraints include programming language version, dependency library requirements, performance indicators and specific architectural style. S32: Input the generated candidate solutions and related context into the problem verification module. The large language model analyzes the predefined structured verification questions in S31 one by one and generates answers, and outputs a verification report in sync. S33: The system scores each candidate solution based on the analysis results in the verification report and sorts them according to the scores.
[0010] Furthermore, the specific execution steps of the layered repair strategy in S6 are as follows: S61: Extract error messages from the compiler output and identify the error type; S62: If the error type is a syntax / runtime error, directly locate the error code and perform the correction operation; if the error type is a semantic error, first analyze the original programming problem requirements and the actual functions implemented by the code, identify the logical deviation points, and then refactor the code implementation logic.
[0011] Furthermore, S6 also includes using the compiler to verify code correctness, specifically: Extract example input / output use cases from the task requirements, and design each example input / output use case into the form of an assertion statement; For each example input / output use case in the form of an assertion statement, the target programming language code generated by the coding agent is concatenated with the assertion statement, and the assertion statement corresponding to the example input / output is placed after the code; The assembled code is then input into the compiler, which verifies its correctness.
[0012] Furthermore, the specific steps for implementing a layered repair strategy based on error type to complete code repair in S6 are as follows: Extract the error type from the backtrace stack and perform fine-grained repair based on the error type; If the error type is an assertion error, capture the output value of each failed test case from the encoder, and extract the expected output values of the example input-output test cases to construct test case pairs. Using the error code and test case pairs as input, guide the large language model to analyze the process by which the current code obtains the actual output when input data is entered into the test case pairs. Then, using the task description and test case pairs as input, guide the large language model to analyze the logic of obtaining the expected output when input data is entered into the test case pairs under the current problem scenario, from the perspective of problem requirements. Correct the errors in the program based on the expected output logic. If the error type is other, capture the error line and detailed error information of each failed test case from the backtrace stack; locate the error position in the code based on the error line, and determine the cause of the error based on the detailed error information; guide the large language model to accurately fix the code based on the error position and cause.
[0013] Furthermore, the specific steps for constructing test case pairs are as follows: Determine if any test cases passed in the current test results. If so, extract the inputs of the passed test cases and the inputs of the failed test cases, and calculate the similarity between the inputs of the passed test cases and the inputs of each failed test case, expressed as: ; in, It is the Damer-Levinstein distance between the failed test cases and the inputs of the successful test cases. It is the length of the string input for the failed test case. It is the length of the string input through the test cases; like If the value is greater than or equal to the preset value, the passed test case and the failed test case will be combined into a test case pair; if there is no suitable test case pair or no test case in the code passes, all test case information will be directly input as auxiliary data; otherwise, only the information of the two test cases that make up the test case pair will be input.
[0014] A code generation system based on the waterfall model and multi-agent collaboration, used to implement the above-mentioned code generation method based on the waterfall model and multi-agent collaboration, includes: Problem Analysis Agent: Receives a problem specification document as input, performs a self-retrieval operation on a large model, and outputs several sub-problems related to the problem document and their corresponding solutions; Solution Agent: Receives several sub-problems and corresponding solutions from the problem analysis agent; generates candidate solutions to the problem to be solved with each sub-problem and its solution as a reference; performs an adaptability review on each candidate solution by invoking the requirements in the problem specification file, and generates the confidence score of each candidate solution; sorts the candidate solutions from high to low confidence scores and outputs the sorting results. Pseudocode Agent: Receives the sorted candidate solutions output by the solution agent, selects the best candidate solution, generates the corresponding pseudocode, and outputs the pseudocode; The coding agent receives the pseudocode output by the pseudocode agent, generates the corresponding target programming language code based on the pseudocode, obtains test cases, tests the generated target programming language code using the test cases, and outputs the test results and the target programming language code. Repair Agent: Receives the test results and target programming language code output by the coded agent. If the test results show that the code failed the test, it extracts the error type of the code, performs fine-grained repair operations on the error type, and outputs the repaired target programming language code.
[0015] The beneficial effects of this invention are as follows:
[0016] This invention effectively addresses the technical problem of logical defects in code generation under complex requirements by introducing a structured reasoning process through the division of labor and collaboration between a problem analysis agent and a solution design agent. This avoids skipping key steps in end-to-end methods. Furthermore, by introducing an intermediate structured representation through a pseudocode design agent, the invention ensures the integrity of the logical chain in the generation process, improving code understandability and maintainability. Finally, by establishing a feedback loop mechanism through a repair agent, the model can accurately locate and understand the cause of errors, fundamentally improving the accuracy and efficiency of repair and solving the problem of insufficient precise debugging capabilities in existing technologies. In summary, this invention establishes a systematic agent collaboration process that significantly improves the accuracy, reliability, and automation level of code generation, and is of great significance for promoting the automation of software development. Attached Figure Description
[0017] Figure 1 This is a generation framework diagram of the code generation method based on the waterfall model and multi-agent collaboration of the present invention. Detailed Implementation
[0018] The present invention will be further explained in detail below with reference to the accompanying drawings and specific embodiments.
[0019] It should be noted that the intelligent agent mentioned in this application refers to an AI agent, which includes at least an environment perception module, an information analysis module, a response instruction module, and a verification module to achieve a specific goal.
[0020] The environment perception module involves processing input information. Information analysis includes analyzing the input information, extracting user commands and auxiliary data, and analyzing the auxiliary data based on the commands to make corresponding decisions. Response commands involve generating the final decision result as output. Verification commands involve evaluating the quality of the output result; if it meets the requirements, it proceeds to the next stage; otherwise, it is re-executed. Analysis, response, and verification may rely on a large model; the specific model selection is not limited.
[0021] Reference Figure 1 A code generation method based on the waterfall model and multi-agent collaboration includes the following steps: S1: Initialize the system, which includes a problem analysis agent, a solution design agent, a pseudocode design agent, a coding agent, and a repair agent that communicate with each other; S2: The problem analysis agent retrieves the current programming problem specification file and task number from the code generation public database, parses the function signature, input / output examples and functional description in the specification file; based on the parsed function signature and functional description, it performs semantic retrieval using a large language model to generate several sets of similar task descriptions and their reference solutions. S3: The solution design agent constructs few-shot prompt templates based on several sets of similar task descriptions and their reference solutions, using each set of task descriptions and corresponding reference solutions as examples. Based on the few-shot prompt templates, the large language model is guided to generate candidate solutions for the current task from the reference examples. Then, the confidence scores of each candidate solution are evaluated through a problem verification mechanism. Finally, the candidate solutions are ranked according to the confidence scores, and the optimal solution is selected. S4: The pseudocode design agent generates structured pseudocode corresponding to the optimal solution of the current task using a large language model; it evaluates whether the generated structured pseudocode conforms to the program's sequence, selection, loop structure and task requirements through a problem verification mechanism, and simultaneously obtains the confidence score and evaluation explanation of the pseudocode; if the confidence score is lower than the preset threshold, it iteratively optimizes the pseudocode based on the task description and evaluation explanation feedback until the pseudocode confidence score reaches the preset threshold. S5: The coding agent inputs the optimized pseudocode into the large language model, which then converts the pseudocode into the corresponding target programming language code. S6: The repair agent first extracts example input and output information from the programming problem specification file obtained in S2 and uses it as a common test case; it then uses the common test cases to test the target programming language code generated by the coding agent; if the code fails all the test cases, it extracts the error information output by the compiler and implements a layered repair strategy based on the error type to complete the code repair.
[0022] Furthermore, the specific process of semantic retrieval performed by the problem analysis agent is as follows: a requirement analysis agent is constructed based on the template and role prompt words preset by the large language model. The requirement analysis agent performs self-retrieval on the written function names and task descriptions. The retrieval results are deduplicated, and finally k groups of similar task descriptions and their reference solutions are obtained.
[0023] Furthermore, the problem verification mechanism in S3 specifically includes the following steps: S31: A predefined set of structured verification questions, including functional correctness verification, rationality verification, and requirement fit verification, wherein: Functional correctness verification: The code input and output behavior corresponding to the candidate solution is initially verified by unit test cases or symbolic execution to determine whether the generated candidate solution can logically solve the original programming problem proposed by the user. Reasonableness verification: Evaluate the practical feasibility of candidate solutions, including syntactic correctness, runtime complexity, resource usage, and compatibility with existing development environments. Demand fit verification: Determine whether the candidate solution meets the constraints explicitly or implicitly proposed by the user. The constraints include programming language version, dependency library requirements, performance indicators and specific architectural style. S32: Input the generated candidate solutions and related context into the problem verification module. The large language model analyzes the predefined structured verification questions in S31 one by one and generates answers, and outputs a verification report in sync. S33: The system scores each candidate solution based on the analysis results in the verification report and sorts them according to the scores.
[0024] Furthermore, the specific execution steps of the layered repair strategy in S6 are as follows: S61: Extract error messages from the compiler output and identify the error type; S62: If the error type is a syntax / runtime error, directly locate the error code and perform the correction operation; if the error type is a semantic error, first analyze the original programming problem requirements and the actual functions implemented by the code, identify the logical deviation points, and then refactor the code implementation logic.
[0025] Furthermore, S6 also includes using the compiler to verify code correctness, specifically: Extract example input / output use cases from the task requirements, and design each example input / output use case into the form of an assertion statement; For each example input / output use case in the form of an assertion statement, the target programming language code generated by the coding agent is concatenated with the assertion statement, and the assertion statement corresponding to the example input / output is placed after the code; The assembled code is then input into the compiler, which verifies its correctness.
[0026] Furthermore, the specific steps for implementing a layered repair strategy based on error type to complete code repair in S6 are as follows: Extract the error type from the backtrace stack and perform fine-grained repair based on the error type; If the error type is an assertion error, capture the output value of each failed test case from the encoder, and extract the expected output values of the example input-output test cases to construct test case pairs. Using the error code and test case pairs as input, guide the large language model to analyze the process by which the current code obtains the actual output when input data is entered into the test case pairs. Then, using the task description and test case pairs as input, guide the large language model to analyze the logic of obtaining the expected output when input data is entered into the test case pairs under the current problem scenario, from the perspective of problem requirements. Correct the errors in the program based on the expected output logic. If the error type is other, capture the error line and detailed error information of each failed test case from the backtrace stack; locate the error position in the code based on the error line, and determine the cause of the error based on the detailed error information; guide the large language model to accurately fix the code based on the error position and cause.
[0027] Furthermore, the specific steps for constructing test case pairs are as follows: Determine if any test cases passed in the current test results. If so, extract the inputs of the passed test cases and the inputs of the failed test cases, and calculate the similarity between the inputs of the passed test cases and the inputs of each failed test case, expressed as: ; in, It is the Damer-Levinstein distance between the failed test cases and the inputs of the successful test cases. It is the length of the string input for the failed test case. It is the length of the string input through the test cases; like If the value is greater than or equal to the preset value, the passed test case and the failed test case will be combined into a test case pair; if there is no suitable test case pair or no test case in the code passes, all test case information will be directly input as auxiliary data; otherwise, only the information of the two test cases that make up the test case pair will be input.
[0028] A code generation system based on the waterfall model and multi-agent collaboration, used to implement the above-mentioned code generation method based on the waterfall model and multi-agent collaboration, includes: Problem Analysis Agent: Receives a problem specification document as input, performs a self-retrieval operation on a large model, and outputs several sub-problems related to the problem document and their corresponding solutions; Solution Agent: Receives several sub-problems and corresponding solutions from the problem analysis agent; generates candidate solutions to the problem to be solved with each sub-problem and its solution as a reference; performs an adaptability review on each candidate solution by invoking the requirements in the problem specification file, and generates the confidence score of each candidate solution; sorts the candidate solutions from high to low confidence scores and outputs the sorting results. Pseudocode Agent: Receives the sorted candidate solutions output by the solution agent, selects the best candidate solution, generates the corresponding pseudocode, and outputs the pseudocode; The coding agent receives the pseudocode output by the pseudocode agent, generates the corresponding target programming language code based on the pseudocode, obtains test cases, tests the generated target programming language code using the test cases, and outputs the test results and the target programming language code. Repair Agent: Receives the test results and target programming language code output by the coded agent. If the test results show that the code failed the test, it extracts the error type of the code, performs fine-grained repair operations on the error type, and outputs the repaired target programming language code.
[0029] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A code generation method based on the waterfall model and multi-agent collaboration, characterized in that, Includes the following steps: S1: Initialize the system, which includes a problem analysis agent, a solution design agent, a pseudocode design agent, a coding agent, and a repair agent that communicate with each other; S2: The problem analysis agent retrieves the current programming problem specification file and task number from the code generation public database, parses the function signature, input / output examples and functional description in the specification file; based on the parsed function signature and functional description, it performs semantic retrieval using a large language model to generate several sets of similar task descriptions and their reference solutions. S3: The solution design agent constructs a few-shot prompt template based on several sets of similar task descriptions and their reference solutions, using each set of task descriptions and corresponding reference solutions as examples. Based on the few-shot prompt template, the large language model is guided to generate candidate solutions for the current task from the reference examples. Then, the confidence score of each candidate solution is evaluated through a problem verification mechanism. Finally, the candidate solutions are ranked according to their confidence scores, and the optimal solution is selected. S4: The pseudocode design agent generates structured pseudocode corresponding to the optimal solution based on the current task using a large language model; The generated structured pseudocode is evaluated through a problem verification mechanism to determine whether it conforms to the program's sequence, selection, loop structure, and task requirements. The confidence score and evaluation explanation of the pseudocode are obtained simultaneously. If the confidence score is lower than a preset threshold, the pseudocode is iteratively optimized based on the task description and evaluation explanation feedback until the confidence score of the pseudocode reaches the preset threshold. S5: The coding agent inputs the optimized pseudocode into the large language model, which then converts the pseudocode into the corresponding target programming language code. S6: The repair agent first extracts example input and output information from the programming problem specification file obtained in S2 and uses it as a common test case; The target programming language code generated by the coded intelligent agent is tested using common test cases; If the code fails all test cases, extract the error messages output by the compiler and implement a layered repair strategy based on the error type to complete the code repair.
2. The code generation method based on the waterfall model and multi-agent collaboration according to claim 1, characterized in that, The specific process of semantic retrieval performed by the problem analysis agent is as follows: a requirement analysis agent is constructed based on the template and role prompt words preset by the large language model. The requirement analysis agent performs self-retrieval on the written function names and task descriptions, performs deduplication on the retrieved results, and finally obtains k groups of similar task descriptions and their reference solutions.
3. The code generation method based on the waterfall model and multi-agent collaboration according to claim 1, characterized in that, The problem verification mechanism in S3 specifically includes the following steps: S31: A predefined set of structured verification questions, including functional correctness verification, rationality verification, and requirement fit verification, wherein: Functional correctness verification: The code input and output behavior corresponding to the candidate solution is initially verified by unit test cases or symbolic execution to determine whether the generated candidate solution can logically solve the original programming problem proposed by the user. Reasonableness verification: Evaluate the practical feasibility of candidate solutions, including syntactic correctness, runtime complexity, resource usage, and compatibility with existing development environments. Demand fit verification: Determine whether the candidate solution meets the constraints explicitly or implicitly proposed by the user. The constraints include programming language version, dependency library requirements, performance indicators, and specific architectural style. S32: Input the generated candidate solutions and related context into the problem verification module. The large language model analyzes the predefined structured verification questions in S31 one by one and generates answers, and outputs a verification report in sync. S33: The system scores each candidate solution based on the analysis results in the verification report and sorts them according to the scores.
4. The code generation method based on the waterfall model and multi-agent collaboration according to claim 3, characterized in that, The specific steps for implementing the layered repair strategy in S6 are as follows: S61: Extract error messages from the compiler output and identify the error type; S62: If the error type is a syntax / runtime error, directly locate the error code and perform the correction operation; if the error type is a semantic error, first analyze the original programming problem requirements and the actual functions implemented by the code, identify the logical deviation points, and then refactor the code implementation logic.
5. The code generation method based on the waterfall model and multi-agent collaboration according to claim 4, characterized in that, S6 also includes using the compiler to verify code correctness, specifically: Extract example input / output use cases from the task requirements, and design each example input / output use case into the form of an assertion statement; For each example input / output use case in the form of an assertion statement, the target programming language code generated by the coding agent is concatenated with the assertion statement, and the assertion statement corresponding to the example input / output is placed after the code; The assembled code is then input into the compiler, which verifies its correctness.
6. The code generation method based on the waterfall model and multi-agent collaboration according to claim 5, characterized in that, The specific steps for implementing a layered repair strategy based on error type to complete code repair in S6 are as follows: Extract the error type from the backtrace stack and perform fine-grained repair based on the error type; If the error type is an assertion error, capture the output value of each failed test case from the encoder, and extract the expected output value of the example input-output test case to construct a test case pair; Using error codes and test case pairs as input, the large language model is guided to analyze the process by which the current code obtains the actual output when input data is entered into the test case pairs. Then, taking the task description and test case pair as input, the large language model is guided to analyze the logic of obtaining the expected output from the input data in the test case pair under the current problem scenario from the perspective of problem requirements; Correct errors in the program based on the expected output logic; If the error type is other, capture the error line and detailed error information of each failed test case from the backtrace stack; locate the error position in the code based on the error line, and determine the cause of the error based on the detailed error information; guide the large language model to accurately fix the code based on the error position and cause.
7. The code generation method based on the waterfall model and multi-agent collaboration according to claim 6, characterized in that, The specific steps for constructing test case pairs are as follows: Determine if any test cases passed in the current test results. If so, extract the inputs of the passed test cases and the inputs of the failed test cases, and calculate the similarity between the inputs of the passed test cases and the inputs of each failed test case, expressed as: ; in, It is the Damer-Levinstein distance between the failed test cases and the inputs of the successful test cases. It is the length of the string input for the failed test case. It is the length of the string input through the test cases; like If the value is greater than or equal to the preset value, the passed test case and the failed test case will be combined into a test case pair; if there is no suitable test case pair or no test case in the code passes, all test case information will be directly input as auxiliary data; otherwise, only the information of the two test cases that make up the test case pair will be input.
8. A code generation system based on the waterfall model and multi-agent collaboration, used to implement the code generation method based on the waterfall model and multi-agent collaboration as described in any one of claims 1-7, characterized in that, include: Problem Analysis Agent: Receives a problem specification document as input, performs a self-retrieval operation on a large model, and outputs several sub-problems related to the problem document and their corresponding solutions; Solution agent: Receives several sub-problems and corresponding solutions from the problem analysis agent, and generates candidate solutions to the problem to be solved with reference to each sub-problem and its solution; The system performs a suitability review on each candidate solution based on the requirements in the problem specification file, generates a confidence score for each candidate solution, sorts the candidate solutions from highest to lowest confidence score, and outputs the sorting results. Pseudocode Agent: Receives the sorted candidate solutions output by the solution agent, selects the best candidate solution, generates the corresponding pseudocode, and outputs the pseudocode; Encoding agent: Receives pseudocode output from the pseudocode agent and generates corresponding target programming language code based on the pseudocode; Obtain test cases, use the test cases to test the generated target programming language code, and output the test results and target programming language code; Repair Agent: Receives the test results and target programming language code output by the coded agent. If the test results show that the code failed the test, it extracts the error type of the code, performs fine-grained repair operations on the error type, and outputs the repaired target programming language code.
Citation Information
Patent Citations
Code generation method based on multi-agent self-reflection framework
CN119668580A
Code error repairing method and device based on compiler
CN120743278A
System and methods for semiautomatic generation and tuning of natural language interaction applications
US20130268260A1
Cited By
Operator code generation method and system based on large model driving and multi-agent cooperation mechanism
CN121255173A
Code generation method, power line loss abnormality diagnosis method, electronic device, storage medium and program product
CN121541863A
Design manuscript code generation and visual error iterative correction method and system based on multi-agent cooperation
CN121979556A
Simulation error correction method, device and system based on multi-agent cooperation
CN122152585A
Intelligent generation system and method of unit test case
CN122285534A