NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AutoVCoder: A Systematic Framework for Automated Verilog Code Generation using LLMs

Mingzhe Gao, Jieru Zhao, Zhe Lin, Wenchao Ding, Xiaofeng Hou, Yu Feng, Chao Li, Minyi GuoICCD 2024 · DOI

Introduction

While Large Language Models (LLMs) have demonstrated transformative capabilities in software engineering tasks—particularly in languages like Python and C++—their performance in hardware description languages (HDLs) remains significantly lagged. The generation of Verilog code presents unique challenges that general-purpose models often fail to navigate. These challenges include the strict timing and concurrency semantics of Register-Transfer Level (RTL) design, a chronic scarcity of high-quality open-source HDL data, and the tendency of models to "hallucinate" sequential software logic into parallel hardware structures.

AutoVCoder is a systematic framework designed to address these bottlenecks. By integrating an automated data-filtering pipeline, a two-stage curriculum fine-tuning strategy, and a dual-purpose Retrieval-Augmented Generation (RAG) system, AutoVCoder establishes a new state-of-the-art (SOTA) for automated Verilog generation, outperforming both general-purpose industrial models like GPT-4 and specialized academic models.

The Three Pillars of AutoVCoder

The framework is built upon three core methodological innovations designed to improve the quality, diversity, and domain-specificity of generated RTL code.

1. Automated Dataset Generation and Filtering

To overcome the data scarcity and quality issues inherent in GitHub-scraped code, the authors developed a scalable filtering pipeline. Starting with a corpus of 1 million Verilog modules, the team used ChatGPT-3.5 to score a representative subset based on "educational value"—defined by readability, modularity, and design efficiency.

Rather than relying on expensive LLM calls for the entire corpus, they trained a lightweight MLP-based Code Scorer to replicate this evaluation across the full million-module dataset. This process revealed that only approximately 21.7% of open-source Verilog code met the high-quality threshold (a score above 6.5/10), highlighting the necessity of rigorous data curation.

2. Two-Round Curriculum Fine-Tuning

AutoVCoder employs a two-stage training approach to progressively build the model's expertise:

  • Round 1 (Syntax Mastery): The model is fine-tuned on the high-quality filtered open-source code to internalize standard Verilog syntax, structural patterns, and common hardware modules.
  • Round 2 (Instruction Following): The model is further refined using a synthetic dataset of approximately 50,000 problem-code pairs. These pairs were generated by ChatGPT-3.5 and rigorously verified through a "Verification-in-the-Loop" process using Icarus Verilog for syntax checking and Python-based equivalence checking for functional logic. This stage ensures the model can translate natural language requirements into functionally correct hardware designs.

3. Domain-Specific Retrieval-Augmented Generation (RAG)

During the inference phase, AutoVCoder utilizes a dual-retriever system to provide the LLM with relevant context and guardrails:

  • Example Retriever: Identifies and fetches similar code snippets from a curated database to provide the model with structural templates.
  • Knowledge Retriever: Fetches RTL design principles and textbook definitions. This serves as a critical "guardrail" against "software hallucinations," reminding the model to utilize concurrent RTL structures instead of sequential software-style loops (e.g., C-style for loops).

Evaluation and Results

The framework was evaluated using two primary benchmarks: VerilogEval (comprising the automated EvalMachine and the human-curated EvalHuman) and RTLLM V1.1 (consisting of 29 complex RTL design tasks).

Using base models such as DeepSeek-Coder 6.7B and CodeQwen 7B, AutoVCoder achieved remarkable results:

  • Superiority over GPT-4: On the EvalMachine benchmark, AutoVCoder-DeepSeek achieved a 69.0% pass@1 score, significantly higher than GPT-4’s 60.0%.
  • New SOTA: The framework outperformed existing specialized models like BetterV and RTLCoder, showing a 3.4% improvement in both syntax and functional correctness on the RTLLM benchmark.
  • Ablation Insights: The two-round fine-tuning strategy proved essential; while Round 1 established a foundation, Round 2 provided the most significant leap in functional correctness and instruction-following capability.

Key Insights

The development of AutoVCoder yielded several critical insights for the field of AI-assisted hardware design:

  1. Quality Over Quantity: Training on a smaller, high-quality dataset filtered for educational value is more effective than training on a larger, noisy corpus.
  2. Addressing Software Bias: The Knowledge Retriever is a vital component for correcting the inherent software bias of LLMs, ensuring that generated code adheres to hardware-specific logic.
  3. Verification is Essential: Synthetic data is only as good as its verification. By using compilers and equivalence checkers in the training loop, AutoVCoder ensures that the model learns from correct logic rather than hallucinated errors.

Conclusion and Future Work

AutoVCoder demonstrates that a systematic approach—combining smart data filtering, curriculum learning, and domain-specific retrieval—can bridge the gap between software-centric LLMs and the specialized needs of hardware engineering. While the framework excels on standard benchmarks, challenges remain in generating highly complex, large-scale industrial designs. Future research will focus on expanding the retrieval database with more complex, industry-grade design instances to further enhance the model's performance on large-scale architectural tasks.

Summary updated

BibTeX
@misc{gao2024autovcoder,
  author = {Mingzhe Gao and Jieru Zhao and Zhe Lin and Wenchao Ding and Xiaofeng Hou and Yu Feng and Chao Li and Minyi Guo},
  title = {{AutoVCoder: A Systematic Framework for Automated Verilog Code Generation using LLMs}},
  year = {2024},
  eprint = {2407.18333},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.18333},
}
Figure