Multi-Agent Code Generation With Syntax Correction Feedback
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional language models, particularly large language models (LLMs), often generate incorrect program code that cannot be successfully compiled and executed, such as SystemVerilog Assertions (SVAs) for integrated circuit verification.
Innovation Solution
A multi-agent framework comprising an experience retrieval agent, an adaptive learning agent, and a syntax correction agent is used to generate program code. The adaptive learning agent iteratively generates and learns improvement knowledge by comparing generated code with reference code, correcting errors, and storing this knowledge for future use, while the syntax correction agent verifies and corrects syntax errors.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If conventional language models are used for code generation, then the model can generate code quickly, but the code often contains syntax errors and cannot be successfully compiled
Solution Approach 1:
The system divides the code generation task into multiple stages: initial code generation by a language model, followed by separate syntax verification and correction stages. This segmentation allows each component to focus on specific aspects, with the verification agent专门 checking for syntax errors and the correction agent fixing them, thereby improving overall reliability while maintaining generation speed.
Solution Approach 2:
The system implements feedback mechanisms where the verification agent checks generated code for syntax errors and provides feedback to the correction agent, which then modifies the code. This iterative feedback loop ensures that code not only generates quickly but also achieves high correctness by continuously refining the output based on verification results.
2Reliability
If a multi-agent framework with iterative correction is used, then code accuracy improves, but the process complexity increases
Solution Approach 1:
The verification agent and correction agent are designed as multi-functional components that can handle various types of syntax errors and code issues. Rather than creating separate specialized agents for each error type, these universal agents perform multiple verification and correction functions, reducing the overall number of components needed while maintaining high code accuracy through comprehensive checking and fixing capabilities.
Data Source
AI summary
A computer-implemented technique for generating program code includes receiving a first natural language instruction; extracting, from an improvement knowledge data set based on the first natural language instruction, one or more first improvement knowledge examples, where each improvement knowledge example included in the one or more first improvement knowledge examples comprises one or more learned rules for generating program code; and generating, via a trained language model, first program code based on the first natural language instruction and the first one or more improvement knowledge examples.


