Skip to main content
QUICK REVIEW

[论文解读] CorrectBench: Automatic Testbench Generation with Functional Self-Correction using LLMs for HDL Design

Ruidi Qiu, Grace Li Zhang|arXiv (Cornell University)|Nov 13, 2024
Real-time simulation and control systems被引用 4
一句话总结

CorrectBench 是一种基于大语言模型(LLM)的新型框架,用于自动生成硬件描述语言(HDL)测试平台,通过集成功能自验证与自校正机制以提升可靠性。通过使用基于场景的验证器将测试平台与自然语言规格进行对比验证,并通过基于 LLM 的校正器修复错误,其测试通过率达到 70.13%,显著优于先前方法的 52.18% 和直接 LLM 生成的 33.33%。

ABSTRACT

Functional simulation is an essential step in digital hardware design. Recently, there has been a growing interest in leveraging Large Language Models (LLMs) for hardware testbench generation tasks. However, the inherent instability associated with LLMs often leads to functional errors in the generated testbenches. Previous methods do not incorporate automatic functional correction mechanisms without human intervention and still suffer from low success rates, especially for sequential tasks. To address this issue, we propose CorrectBench, an automatic testbench generation framework with functional self-validation and self-correction. Utilizing only the RTL specification in natural language, the proposed approach can validate the correctness of the generated testbenches with a success rate of 88.85%. Furthermore, the proposed LLM-based corrector employs bug information obtained during the self-validation process to perform functional self-correction on the generated testbenches. The comparative analysis demonstrates that our method achieves a pass ratio of 70.13% across all evaluated tasks, compared with the previous LLM-based testbench generation framework's 52.18% and a direct LLM-based generation method's 33.33%. Specifically in sequential circuits, our work's performance is 62.18% higher than previous work in sequential tasks and almost 5 times the pass ratio of the direct method. The codes and experimental results are open-sourced at the link: https://github.com/AutoBench/CorrectBench

研究动机与目标

  • 解决大语言模型在生成硬件设计测试平台时的不稳定性,特别是在时序电路中的问题。
  • 克服先前基于大语言模型的测试平台框架缺乏功能验证与校正机制的局限。
  • 仅使用自然语言 RTL 规格作为输入,实现完全自动化的测试平台生成。
  • 通过引入由大语言模型驱动的自验证与自校正循环,提升功能仿真中的通过率。
  • 在无需人工干预的情况下,实现更高可靠性与可扩展性的测试平台生成。

提出的方法

  • 仅使用自然语言 RTL 规格作为测试平台生成的唯一输入。
  • 采用基于场景的自验证器,利用 70%-错误阈值评估测试平台正确性,实现 88.85% 的验证准确率。
  • 引入功能自验证机制,检查测试平台输出是否符合从规格中推导出的预期行为。
  • 应用基于大语言模型的校正器,利用验证器提供的错误报告,迭代式地优化并修正测试平台代码。
  • 将自验证与自校正循环整合进反馈驱动的工作流中,以增强可靠性。
  • 采用混合测试平台结构,结合 Verilog 驱动与 Python 检查器,实现端到端的功能验证。

实验结果

研究问题

  • RQ1功能自验证能否显著提升大语言模型生成的 HDL 测试平台的可靠性?
  • RQ2基于大语言模型的自校正机制在减少自动生成功能错误方面有多高效?
  • RQ3何种验证阈值(如 50%-错误、70%-错误)能最大化测试平台验证的准确率与收敛性?
  • RQ4CorrectBench 框架在组合电路与时序电路中,相较于现有基于大语言模型的测试平台生成方法,优势有多大?
  • RQ5该框架是否可在不同大语言模型上泛化,而无需牺牲性能或进行人工调优?

主要发现

  • CorrectBench 在全部 156 个评估的 Verilog 任务中实现了 70.13% 的通过率,相较于先前最先进方法 AutoBench 的 52.18% 提升了 17.95 个百分点。
  • 在时序电路中,CorrectBench 相较于 AutoBench 提升了 62.18 个百分点,通过率接近直接基于 LLM 生成方法(33.33%)的五倍。
  • 基于场景的验证器在采用 70%-错误标准时,实现了 88.85% 的全局验证准确率,该阈值因在精确率与召回率之间达到最佳平衡而被选为最优。
  • 基于大语言模型的校正器对总性能提升贡献了 34.33%,凸显其在错误修复中的关键作用。
  • 该框架在不同大语言模型(包括 GPT-4o、GPT-4o-mini 和 Claude-3.5-Sonnet)上均保持一致性能,表明其具备良好的泛化能力。
  • 70%-错误验证阈值在验证准确率与整体系统性能方面均优于 50%-错误与 90%-错误,具有更低的 token 消耗与更高的收敛率。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。