[Paper Review] MAGE: A Multi-Agent Engine for Automated RTL Code Generation
MAGE is an open-source multi-agent system that generates Verilog RTL code from natural language, using specialized agents, high-temperature candidate sampling, and a Verilog-state checkpointing debugging mechanism to achieve high syntactic and functional correctness. It outperforms baselines on VerilogEval benchmarks with a Pass@1 of 94.8% and 95.7%.
The automatic generation of RTL code (e.g., Verilog) through natural language instructions has emerged as a promising direction with the advancement of large language models (LLMs). However, producing RTL code that is both syntactically and functionally correct remains a significant challenge. Existing single-LLM-agent approaches face substantial limitations because they must navigate between various programming languages and handle intricate generation, verification, and modification tasks. To address these challenges, this paper introduces MAGE, the first open-source multi-agent AI system designed for robust and accurate Verilog RTL code generation. We propose a novel high-temperature RTL candidate sampling and debugging system that effectively explores the space of code candidates and significantly improves the quality of the candidates. Furthermore, we design a novel Verilog-state checkpoint checking mechanism that enables early detection of functional errors and delivers precise feedback for targeted fixes, significantly enhancing the functional correctness of the generated RTL code. MAGE achieves a 95.7% rate of syntactic and functional correctness code generation on VerilogEval-Human 2 benchmark, surpassing the state-of-the-art Claude-3.5-sonnet by 23.3 %, demonstrating a robust and reliable approach for AI-driven RTL design workflows.
Motivation & Objective
- Mimic the iterative, specialized collaboration of human RTL design teams by decomposing tasks among dedicated agents.
- Improve RTL code quality by exploring high-temperature sampling to generate diverse yet high-quality candidates.
- Enable early detection of functional errors via Verilog-state checkpointing and provide precise feedback for targeted fixes.
- Demonstrate that a multi-agent architecture with separate generation, testing, judging, and debugging roles yields higher correctness than single-agent approaches.
Proposed method
- Introduce four specialized agents: testbench generation, RTL code generation, judge, and debug agents.
- Use a high-efficiency collaboration workflow with a tailored context communication protocol.
- Implement high-temperature RTL candidate sampling and scoring to rank and select promising candidates.
- Apply a Verilog-state checkpointing mechanism to extract textual waveform windows and provide precise feedback for debugging.
- Limit each agent to at most 5 iterations for syntax error fixes and rely on iterative refinement through the pipeline.
Experimental results
Research questions
- RQ1Can a multi-agent RTL code generation framework outperform single-agent approaches on Verilog RTL tasks?
- RQ2Does high-temperature sampling improve the quality and diversity of RTL candidates when properly ranked and debugged?
- RQ3Does a state-checkpoint based debugging mechanism enable more precise and efficient RTL bug fixing compared to final-output feedback?
- RQ4How does task distribution across specialized agents affect overall RTL generation success rates?
Key findings
- MAGE achieves 94.8% Pass@1 on VerilogEval-Human and 95.7% on VerilogEval-V2, outperforming all baselines.
- High-temperature sampling with multiple candidate generation improves RTL code quality over low-temperature settings.
- Multi-agent configurations outperform vanilla and single-agent setups, with Pass@1 of 93.6% vs. 72.4% and 83.9% in ablation studies.
- The RTL state checkpoint mechanism enables the debug agent to identify mismatches more accurately and fix issues more efficiently.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.