arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2504.15804cs.ARcs.AI
收藏

来自验证的洞察:利用测试台反馈通过强化学习训练Verilog生成大语言模型

Insights from Verification: Training a Verilog Generation LLM with Reinforcement Learning with Testbench Feedback

City University of Hong Kong(香港城市大学);Southeast University(东南大学)

Ning Wang, Bingkun Yao, Jie Zhou, Yuchen Hu, Xi Wang, Nan Guan, Zhe Jiang

AI总结:

提出利用测试台反馈的强化学习(DPO)训练Verilog生成LLM,通过自动测试台生成与验证对齐功能正确性,在多个基准上超越最先进基线。

摘要:

大语言模型(LLMs)在从自然语言描述生成Verilog代码方面已展现出强大性能。然而,确保生成代码的功能正确性仍然是一个重大挑战。本文提出了一种方法,将来自测试台的验证洞察整合到Verilog生成LLM的训练中,使训练与硬件设计的基本目标——功能正确性——对齐。使用LLM进行Verilog代码生成的主要障碍是缺乏足够的功能验证数据,特别是与设计规范和代码配对的测试台。为解决此问题,我们引入了一个自动测试台生成流水线,该流水线分解过程并利用Verilog编译器模拟器(VCS)的反馈来减少幻觉并确保正确性。然后,我们使用测试台评估生成的代码,并收集它们用于进一步训练,其中引入了验证洞察。我们的方法应用强化学习(RL),特别是直接偏好优化(DPO),通过基于测试台结果训练偏好对,使Verilog代码生成与功能正确性对齐。在VerilogEval-Machine、VerilogEval-Human、RTLLM v1.1、RTLLM v2和VerilogEval v2上的评估中,我们的方法在生成功能正确的Verilog代码方面持续优于最先进的基线。我们在https://anonymous.4open.science/r/VeriPrefer-E88B开源所有训练代码、数据和模型。

英文摘要:

Large language models (LLMs) have shown strong performance in Verilog generation from natural language description. However, ensuring the functional correctness of the generated code remains a significant challenge. This paper introduces a method that integrates verification insights from testbench into the training of Verilog generation LLMs, aligning the training with the fundamental goal of hardware design: functional correctness. The main obstacle in using LLMs for Verilog code generation is the lack of sufficient functional verification data, particularly testbenches paired with design specifications and code. To address this problem, we introduce an automatic testbench generation pipeline that decomposes the process and uses feedback from the Verilog compiler simulator (VCS) to reduce hallucination and ensure correctness. We then use the testbench to evaluate the generated codes and collect them for further training, where verification insights are introduced. Our method applies reinforcement learning (RL), specifically direct preference optimization (DPO), to align Verilog code generation with functional correctness by training preference pairs based on testbench outcomes. In evaluations on VerilogEval-Machine, VerilogEval-Human, RTLLM v1.1, RTLLM v2, and VerilogEval v2, our approach consistently outperforms state-of-the-art baselines in generating functionally correct Verilog code. We open source all training code, data, and models at https://anonymous.4open.science/r/VeriPrefer-E88B.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑