HaVen:与 HDL 工程师对齐的、用于 Verilog 代码生成的幻觉缓解型 LLM
HaVen: Hallucination-Mitigated LLM for Verilog Code Generation Aligned with HDL Engineers
AI总结:
本文提出 HaVen 框架,通过幻觉分类、CoT 符号转译和面向 HDL 工程实践的数据增强,提升 LLM 的 Verilog 生成正确性,并在 VerilogEval 与 RTLLM 上超过现有方法。
摘要:
近年来,使用大型语言模型(LLM)进行 Verilog 代码生成引起了广泛研究兴趣,以实现硬件设计自动化。然而,已有工作表明,LLM 的能力与硬件描述语言(HDL)工程的实际需求之间存在差距。这一差距包括工程师表述问题的方式差异,以及所生成代码中的幻觉。为应对这些挑战,我们提出 HaVen,这是一种新颖的 LLM 框架,旨在缓解幻觉,并使 Verilog 代码生成与 HDL 工程师的实践保持一致。HaVen 通过提出一套全面的分类体系,并采用思维链(CoT)机制将符号模态(例如真值表、状态图等)转换为准确的自然语言描述,来解决幻觉问题。此外,HaVen 通过使用数据增强策略弥合这一差距。它合成符合真实 HDL 工程实践的高质量指令-代码对。我们的实验表明,HaVen 显著提高了 Verilog 代码生成的正确性,在 VerilogEval 和 RTLLM 基准上优于基于 LLM 的最先进 Verilog 生成方法。HaVen 已公开发布于 https://github.com/Intelligent-Computing-Research-Group/HaVen。
英文摘要:
Recently, the use of large language models (LLMs) for Verilog code generation has attracted great research interest to enable hardware design automation. However, previous works have shown a gap between the ability of LLMs and the practical demands of hardware description language (HDL) engineering. This gap includes differences in how engineers phrase questions and hallucinations in the code generated. To address these challenges, we introduce HaVen, a novel LLM framework designed to mitigate hallucinations and align Verilog code generation with the practices of HDL engineers. HaVen tackles hallucination issues by proposing a comprehensive taxonomy and employing a chain-of-thought (CoT) mechanism to translate symbolic modalities (e.g. truth tables, state diagrams, etc.) into accurate natural language descriptions. Furthermore, HaVen bridges this gap by using a data augmentation strategy. It synthesizes high-quality instruction-code pairs that match real HDL engineering practices. Our experiments demonstrate that HaVen significantly improves the correctness of Verilog code generation, outperforming state-of-the-art LLM-based Verilog generation methods on VerilogEval and RTLLM benchmark. HaVen is publicly available at https://github.com/Intelligent-Computing-Research-Group/HaVen.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。