CodeV:通过多层级摘要生成赋能大语言模型进行 HDL 生成
CodeV: Empowering LLMs with HDL Generation through Multi-Level Summarization
AI总结:
针对高质量 HDL 数据稀缺问题,本文提出结合多层级摘要合成与 Chat-FIM-Tag 微调的流程,构建支持 Verilog、Chisel 及聊天、代码补全的 CodeV 系列模型。
摘要:
处理器的设计流程,尤其是在使用 Verilog 和 Chisel 等硬件描述语言(HDL)时,既复杂又昂贵。尽管大语言模型(LLM)的最新进展显著提升了 Python 等软件语言的编码任务表现,但由于高质量 HDL 数据稀缺,它们在 HDL 生成中的应用仍然有限。使 LLM 适应硬件设计的传统方法依赖合成 HDL 数据集,而这些数据集往往质量较低,因为即使是 GPT 等先进 LLM 在 HDL 领域也表现不佳。此外,这些方法仅关注聊天任务和 Verilog 语言,限制了其应用场景。在本文中,我们观察到:(1)从真实世界收集的 HDL 代码质量高于 LLM 生成的代码;(2)GPT-3.5 等 LLM 擅长总结 HDL 代码,而不是生成代码;(3)当数据不足时,显式语言标签可以帮助 LLM 更好地适应目标语言。基于这些观察,我们提出了一种用于 HDL 生成的高效 LLM 微调流程,该流程将多层级摘要数据合成过程与新颖的 Chat-FIM-Tag 监督微调方法相结合。该流程增强了从自然语言描述生成 HDL 代码的能力,并能够处理聊天和补全不完整代码等多种任务。利用这一流程,我们推出了 CodeV,这是一系列用于 HDL 生成的 LLM。其中,CodeV-All 不仅具备更多样的语言能力,即 Verilog 和 Chisel,以及更广泛的任务范围,即 Chat 和中间填充(FIM),而且在 VerilogEval 上取得了与仅使用 Verilog 微调的 CodeV-Verilog 相当甚至更优的性能,使其成为首个面向多场景 HDL 生成的开源 LLM 系列。
英文摘要:
The design flow of processors, particularly in hardware description languages (HDL) like Verilog and Chisel, is complex and costly. While recent advances in large language models (LLMs) have significantly improved coding tasks in software languages such as Python, their application in HDL generation remains limited due to the scarcity of high-quality HDL data. Traditional methods of adapting LLMs for hardware design rely on synthetic HDL datasets, which often suffer from low quality because even advanced LLMs like GPT perform poorly in the HDL domain. Moreover, these methods focus solely on chat tasks and the Verilog language, limiting their application scenarios. In this paper, we observe that: (1) HDL code collected from the real world is of higher quality than code generated by LLMs. (2) LLMs like GPT-3.5 excel in summarizing HDL code rather than generating it. (3) An explicit language tag can help LLMs better adapt to the target language when there is insufficient data. Based on these observations, we propose an efficient LLM fine-tuning pipeline for HDL generation that integrates a multi-level summarization data synthesis process with a novel Chat-FIM-Tag supervised fine-tuning method. The pipeline enhances the generation of HDL code from natural language descriptions and enables the handling of various tasks such as chat and infilling incomplete code. Utilizing this pipeline, we introduce CodeV, a series of HDL generation LLMs. Among them, CodeV-All not only possesses a more diverse range of language abilities, i.e. Verilog and Chisel, and a broader scope of tasks, i.e. Chat and fill-in-middle (FIM), but it also achieves performance on VerilogEval that is comparable to or even surpasses that of CodeV-Verilog fine-tuned on Verilog only, making them the first series of open-source LLMs designed for multi-scenario HDL generation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。