[Paper Review] VerilogEval: Evaluating Large Language Models for Verilog Code Generation
The paper introduces VerilogEval, a Verilog-focused benchmark (156 HDLBits problems) to evaluate LLMs on Verilog code generation, including an automated testing pipeline and synthetic supervised fine-tuning data to improve performance.
The increasing popularity of large language models (LLMs) has paved the way for their application in diverse domains. This paper proposes a benchmarking framework tailored specifically for evaluating LLM performance in the context of Verilog code generation for hardware design and verification. We present a comprehensive evaluation dataset consisting of 156 problems from the Verilog instructional website HDLBits. The evaluation set consists of a diverse set of Verilog code generation tasks, ranging from simple combinational circuits to complex finite state machines. The Verilog code completions can be automatically tested for functional correctness by comparing the transient simulation outputs of the generated design with a golden solution. We also demonstrate that the Verilog code generation capability of pretrained language models could be improved with supervised fine-tuning by bootstrapping with LLM generated synthetic problem-code pairs.
Motivation & Objective
- Motivate a domain-specific benchmark for Verilog code generation by leveraging HDLBits problems with clear correctness criteria.
- Provide an automated testing environment to assess functional correctness of generated Verilog code.
- Show that synthetic supervised fine-tuning data generated by LLMs can improve Verilog coding performance.
- Investigate how model size and base model affect Verilog coding capabilities and SFT effectiveness.
Proposed method
- Construct a sandboxed evaluation framework modeled after HumanEval for Verilog code generation.
- Assemble a 156-problem Verilog evaluation set from HDLBits with self-contained modules.
- Automatically test generated Verilog completions against golden solutions via functional simulation in ICARUS Verilog within a Docker sandbox.
- Create a synthetic SFT dataset by extracting self-contained Verilog modules from GitHub, generating descriptive texts with LLMs, and pairing descriptions with code.
- Fine-tune CodeGen-family models on the synthetic SFT data and evaluate using pass@k metrics (k in {1,5,10}).
- Compare performance across GPT-3.5/4 and Verilog-focused base models (codegen-nl, codegen-multi, codegen-Verilog) and analyze data quality effects.

Experimental results
Research questions
- RQ1Can LLMs reliably generate correct Verilog code from natural language descriptions for a diverse set of tasks?
- RQ2Does a sandboxed, automated testing workflow correlate with functional correctness of Verilog solutions?
- RQ3To what extent can synthetic SFT data improve Verilog code generation when fine-tuning LLMs?
- RQ4How do model size and base model selection impact VerilogEval performance?
- RQ5What is the impact of SFT data quality on downstream Verilog coding performance?
Key findings
- VerilogEval demonstrates that functional correctness can be measured via automated simulation against a golden solution.
- Larger and more capable models generally yield better Verilog coding performance.
- Synthetic SFT data improves downstream Verilog performance for Verilog-trained and some multi-language base models, with notable gains for VerilogEval-machine results.
- SFT data quality matters: introducing incorrect problem-code pairs degrades performance, highlighting the importance of high-quality synthetic data.
- GPT-4 achieves higher pass@1, pass@5, and pass@10 scores than GPT-3.5 in several configurations, and Verilog-focused SFT can approach the performance of GPT-3.5 on some baselines.
- There is a trade-off in SFT: increasing epochs can improve pass@1 but may degrade pass@5 and pass@10 due to overfitting to SFT data.
![Figure 7: Variance in estimating pass@ k with $n$ . Samples from codegen-16B-verilog [ 12 ] for VerilogEval-human .](https://ar5iv.labs.arxiv.org/html/2309.07544/assets/figs/variance.png)
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.