Multi-Agent Code Generation for Compile-Correct Program Output
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 to correct errors, while the syntax correction agent verifies and corrects the generated code.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
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 separate stages: initial code generation by a language model, followed by independent syntax verification and error correction phases. This segmentation allows each component to focus on specific aspects, improving overall reliability without requiring the entire system to be overly complex
Solution Approach 2:
The system implements feedback mechanisms where syntax verification results are fed back into the code generation process. Errors detected during verification are used to correct subsequent generation attempts, creating an iterative improvement loop that enhances code correctness while maintaining manageable system complexity through structured feedback handling
2Reliability
If conventional language models generate code without verification, then the generation process is fast and simple, but the code contains errors that prevent successful compilation
Solution Approach 1:
The system performs syntax verification as a preliminary check before final code output. By conducting verification in advance and identifying errors early in the process, the system can correct issues before they cause compilation failures, improving code compilability while minimizing time loss through efficient verification timing
Solution Approach 2:
The verification and correction process is integrated continuously into the code generation workflow rather than being a separate batch operation. The system maintains continuous feedback loops where verification results immediately influence subsequent generation attempts, ensuring useful action continues without significant time interruption
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.


