Data is all you need: Finetuning LLMs for Chip Design via an Automated design-data augmentation framework

📄 arXiv: 2403.11202v2 📥 PDF

作者: Kaiyan Chang, Kun Wang, Nan Yang, Ying Wang, Dantong Jin, Wenlong Zhu, Zhirong Chen, Cangyuan Li, Hao Yan, Yunhao Zhou, Zhuoliang Zhao, Yuan Cheng, Yudong Pan, Yiqi Liu, Mengdi Wang, Shengwen Liang, Yinhe Han, Huawei Li, Xiaowei Li

分类: cs.AR, cs.AI, cs.PL

发布日期: 2024-03-17 (更新: 2024-07-10)

备注: DAC 2024

DOI: 10.1145/3649329.3657356


💡 一句话要点

提出自动化设计数据增强框架以提升芯片设计中的LLM性能

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 芯片设计 数据增强 Verilog生成 电子设计自动化 自动化工具 自然语言处理

📋 核心要点

  1. 现有方法在芯片设计中面临Verilog数据不足的问题,限制了LLMs生成高质量Verilog代码的能力。
  2. 论文提出了一种自动化设计数据增强框架,通过生成与Verilog和EDA脚本对齐的自然语言数据来解决数据匮乏问题。
  3. 实验结果显示,微调后的Llama2模型在Verilog生成任务上准确率显著提升,超越了当前最先进的开源模型。

📝 摘要(中文)

近年来,大型语言模型在从高层提示自动生成硬件描述语言(HDL)代码方面展现出潜力。研究者们利用微调技术增强这些大型语言模型(LLMs)在芯片设计领域的能力。然而,Verilog数据的匮乏限制了LLMs在Verilog生成质量上的进一步提升。此外,缺乏Verilog和电子设计自动化(EDA)脚本的数据增强框架显著增加了准备训练数据集的时间。本文提出了一种自动化设计数据增强框架,生成与Verilog和EDA脚本对齐的高质量自然语言。通过对Verilog文件进行抽象语法树转换,并使用预定义模板将节点映射到自然语言,来实现Verilog生成。实验结果表明,使用该数据增强方法微调的Llama2模型在Verilog生成任务上显著提升,准确率从58.8%提高到70.6%。

🔬 方法详解

问题定义:本文旨在解决芯片设计中LLMs生成Verilog代码的质量不足问题,尤其是由于缺乏足够的Verilog数据而导致的性能瓶颈。现有方法未能有效利用现有数据,导致训练效率低下。

核心思路:论文提出的自动化设计数据增强框架通过生成高质量的自然语言数据,来补充Verilog和EDA脚本的数据不足,从而提升LLMs的生成能力。该框架通过将Verilog文件转换为抽象语法树并映射到自然语言,来实现数据的有效增强。

技术框架:该框架主要包括三个模块:1) Verilog生成模块,通过抽象语法树转换生成自然语言;2) Verilog修复模块,利用预定义规则生成错误的Verilog文件,并结合EDA工具反馈进行修复;3) EDA脚本生成模块,使用现有的LLM(如GPT-3.5)生成脚本描述。

关键创新:本研究的关键创新在于提出了一个系统化的数据增强框架,能够自动生成与Verilog和EDA脚本对齐的高质量自然语言数据,显著提高了LLMs在芯片设计中的应用效果。与现有方法相比,该框架在数据生成的效率和质量上具有明显优势。

关键设计:在框架设计中,使用了预定义模板进行自然语言映射,并设定了特定的规则用于Verilog修复。同时,微调过程中采用了Llama2-13B和Llama2-7B模型,优化了训练参数和损失函数,以确保生成结果的准确性和一致性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,使用该数据增强框架微调的Llama2模型在Verilog生成任务中的准确率从58.8%提升至70.6%,超越了当前最先进的开源Verilog生成模型。此外,ChipGPT-FT模型在Verilog生成和EDA脚本生成方面均表现出色,显示出显著的性能提升。

🎯 应用场景

该研究的自动化设计数据增强框架在芯片设计领域具有广泛的应用潜力,能够显著提升LLMs在Verilog代码生成和EDA脚本生成中的性能。未来,该框架可扩展到其他硬件设计领域,推动自动化设计工具的发展,提高设计效率和准确性。

📄 摘要(原文)

Recent advances in large language models have demonstrated their potential for automated generation of hardware description language (HDL) code from high-level prompts. Researchers have utilized fine-tuning to enhance the ability of these large language models (LLMs) in the field of Chip Design. However, the lack of Verilog data hinders further improvement in the quality of Verilog generation by LLMs. Additionally, the absence of a Verilog and Electronic Design Automation (EDA) script data augmentation framework significantly increases the time required to prepare the training dataset for LLM trainers. This paper proposes an automated design-data augmentation framework, which generates high-volume and high-quality natural language aligned with Verilog and EDA scripts. For Verilog generation, it translates Verilog files to an abstract syntax tree and then maps nodes to natural language with a predefined template. For Verilog repair, it uses predefined rules to generate the wrong verilog file and then pairs EDA Tool feedback with the right and wrong verilog file. For EDA Script generation, it uses existing LLM(GPT-3.5) to obtain the description of the Script. To evaluate the effectiveness of our data augmentation method, we finetune Llama2-13B and Llama2-7B models using the dataset generated by our augmentation framework. The results demonstrate a significant improvement in the Verilog generation tasks with LLMs. Moreover, the accuracy of Verilog generation surpasses that of the current state-of-the-art open-source Verilog generation model, increasing from 58.8% to 70.6% with the same benchmark. Our 13B model (ChipGPT-FT) has a pass rate improvement compared with GPT-3.5 in Verilog generation and outperforms in EDA script (i.e., SiliconCompiler) generation with only 200 EDA script data.