HaVen: Hallucination-Mitigated LLM for Verilog Code Generation Aligned with HDL Engineers

📅 2025-01-09
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Large language models (LLMs) suffer from severe hallucinations, substantial semantic deviations, and misalignment with hardware engineers’ domain-specific expression conventions when generating Verilog code. To address these challenges, this paper proposes an HDL-oriented code generation optimization framework. Its core contributions are threefold: (1) the first fine-grained Verilog hallucination taxonomy; (2) a symbolic-modality–to–natural-language chain-of-thought (CoT) translation mechanism—leveraging truth tables, state diagrams, and other formal representations—to enhance logical interpretability; and (3) an instruction-code co-augmentation paradigm grounded in real-world RTL engineering practices. Evaluated on VerilogEval and RTLLM benchmarks, our method significantly outperforms state-of-the-art approaches, achieving substantial gains in functional correctness. All code and datasets are publicly released.

Technology Category

Application Category

📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

Large Language Models
Verilog Code Generation
Accuracy and Usability Improvement
Innovation

Methods, ideas, or system contributions that make the work stand out.

HaVen
Verilog code generation
diagram interpretation
🔎 Similar Papers
No similar papers found.
Y
Yiyao Yang
School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University, Shanghai, China
F
Fu Teng
School of Software Technology, Zhejiang University, Ningbo, China
P
Pengju Liu
School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University, Shanghai, China
Mengnan Qi
Mengnan Qi
Unknown affiliation
Chenyang Lv
Chenyang Lv
Shanghai Jiao Tong University
machine learningreinforcement learningelectronic design automation
Ji Li
Ji Li
Principal Group Science Manager at Microsoft
AICAD
Xuhong Zhang
Xuhong Zhang
Zhejiang University
LLMVLMVLATrustworthy AI
Zhezhi He
Zhezhi He
Associate Professor, Shanghai Jiao Tong University
Intelligent ComputingNeuromorphic ComputingComputer ArchitectureEDA