The invention discloses a
code generation and
restoration method and device based on multi-round feedback of a large
language model, and the method comprises the following steps: 1, converting
problem description into a structured tetrad (target, input, output and constraint) through a two-stage
task demand deconstruction mechanism, and generating a pseudo-code frame according to the structured tetrad; 2, generating a plurality of candidate code schemes in parallel based on different implementation strategies; 3, selecting an optimal code implementation scheme through multi-dimensional evaluation; 4, generating an extended
test case through boundary condition analysis and public test reasoning, and expanding a
verification range; 5, classifying error types in combination with
static analysis and dynamic execution information, and applying a special repair strategy; 6, providing detailed repair reasons and ideas by an interpretable repair mechanism; and 7, establishing a multi-round feedback repair
verification iteration mechanism composed of testing, analysis, repair and
verification. According to the method, the performance of an existing large
language model in
processing a complex
programming task is effectively improved.