[论文解读] MAGE: A Multi-Agent Engine for Automated RTL Code Generation
MAGE 是一个开源的多代理系统,它通过专门的代理、高温候选采样,以及 Verilog 状态检查点调试机制,从自然语言生成 Verilog RTL 代码,以实现高语法和功能正确性。在 VerilogEval 基准测试中,它在 Pass@1 上分别达到 94.8% 和 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.
研究动机与目标
- 通过将任务分解给专门的代理,模仿人类 RTL 设计团队的迭代、专业化协作。
- 通过探索高温采样以生成多样且高质量的候选 RTL 代码,从而提高 RTL 代码质量。
- 通过 Verilog-state checkpointing 实现对功能错误的及早发现,并为有针对性的修复提供精确反馈。
- 证明具备分离生成、测试、评判和调试角色的多代理架构,在正确性方面比单代理方法具有更高的表现。
提出的方法
- 引入四个专门的代理:测试基准(testbench)生成、RTL 代码生成、评判与调试代理。
- 使用高效的协作工作流,配备定制的上下文通信协议。
- 实现高温度的 RTL 候选生成与打分,用以对有前景的候选进行排名和选择。
- 应用 Verilog-state checkpointing 机制,提取文本波形窗口并为调试提供精确反馈。
- 将每个代理的迭代次数限制为最多 5 次,用管道中的迭代式改进替代单次修正。
实验结果
研究问题
- RQ1多代理 RTL 代码生成框架是否能够在 Verilog RTL 任务上超越单代理方法?
- RQ2在正确排名和调试后,高温采样是否提升 RTL 候选的质量与多样性?
- RQ3基于状态检查点的调试机制是否比最终输出反馈提供更精准、更高效的 RTL 错误修复?
- RQ4专门化代理之间的任务分配如何影响总体 RTL 生成的成功率?
主要发现
- MAGE 在 VerilogEval-Human 上达到 94.8% 的 Pass@1,以及在 VerilogEval-V2 上达到 95.7%,超越所有基线。
- 使用高温采样进行多候选生成在低温设置上提升了 RTL 代码质量。
- 多代理配置在消融研究中优于普通和单代理设置,Pass@1 为 93.6% 相较于 72.4% 与 83.9%。
- RTL 状态检查点机制使调试代理能够更准确地识别不匹配并更高效地修复问题。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。