TL;DR
Existing datasets for training Large Language Models (LLMs) on hardware design (Verilog/RTL) typically filter code only with syntax checkers—meaning designs compile cleanly, but often compute the wrong thing. VeriCoder fixes this by introducing an automated teacher-guided test-generation and simulation pipeline that produces over 125,000 functionally validated (specification, RTL design, test) triplets. Fine-tuning on this validated data yields a new state-of-the-art open-source RTL model, achieving relative gains of up to 71.7% on VerilogEval and 27.4% on RTLLM.
What Problem Does This Paper Address?
Automating Register Transfer Level (RTL) code generation from natural language specifications can radically accelerate hardware engineering. While open-source, locally runnable models are vital for protecting proprietary chip designs, existing open-source RTL models lag significantly behind proprietary giants like GPT-4o and o3-mini.
The core bottleneck is data quality. Previous efforts (such as RTLCoder, VeriGen, and OriGen) constructed large training corpora by relying on compilers and syntax linters to filter out bad code. However, syntactic validity does not imply functional correctness. In digital hardware, a module can compile without warnings while harboring subtle semantic bugs—such as race conditions, misused non-blocking assignments (<=), or combinational loops that hang simulation entirely. Training models on unverified code teaches them to write plausible-looking, compilable, but ultimately broken circuits.
Methods
The authors introduce an automated dataset augmentation pipeline that couples unit test synthesis with simulation feedback:
- Teacher-Driven Test Generation: Given a natural language hardware specification and an initial RTL implementation from an existing unvalidated dataset (OriGen), a teacher LLM (
GPT-4o-mini) generates a self-checking SystemVerilog testbench. - Simulation & Feedback Loop: The design and testbench are compiled and simulated using standard EDA tools. If a simulation error occurs (e.g., failed assertions, timing out due to zero-delay combinational feedback loops, or runtime errors), the pipeline extracts the error logs.
- Iterative Refinement: A refinement prompt containing the specification, current design, testbench, and simulator error message is fed back to the teacher model. The model iteratively revises the RTL code or refines the testbench (up to $T=5$ attempts) until the design passes simulation.
- Fine-Tuning: The resulting cleaned corpus of verified specification–code pairs is used to fine-tune Qwen2.5-14B-Instruct using Low-Rank Adaptation (LoRA, rank 16).
Datasets
- Training Data (VeriCoder Dataset): 125,777 validated triples consisting of a natural language specification (average 247 words), an RTL module (average 35 lines of code), and a passing self-checking unit test (average 55 lines). It is built by augmenting the 217,462-example OriGen dataset.
- Evaluation Benchmarks:
- VerilogEval v1.0: Assesses Pass@$k$ performance on both synthetic specifications (
Eval-Machine) and human-written specifications (Eval-Human). - RTLLM v1.1: Evaluates both syntax correctness and functional correctness via Pass@5 with testbenches.
Key Insights and Ideas
- Prior Datasets Have Alarming Failure Rates: When the authors randomly sampled 1,000 examples from prior popular datasets and generated simulation tests for them, only 24.4% of RTLCoder designs and 53.5% of OriGen designs passed. Nearly half or more of existing training corpora contain semantic errors.
- Data Quality Beats Pure Model Scale: In an apples-to-apples ablation holding the base model (Qwen2.5-14B-Instruct) and hyperparameters constant, training on functionally validated data consistently beat training on unvalidated data across every metric (e.g., RTLLM functional Pass@5 rose from 41.4% base $\rightarrow$ 44.8% unvalidated $\rightarrow$ 48.3% validated).
- Bridging the Syntax-Function Gap: Commercial models like GPT-4o attain 100% syntax validity on RTLLM but only 69.0% functional correctness. Eliminating non-functional examples from training data teaches the model true behavioral compliance rather than superficial syntax matching.
Key Results
- New Open-Source SOTA: VeriCoder surpasses all previous open-source fine-tuned models on RTL generation:
- VerilogEval-Machine: VeriCoder attains 55.7% Pass@1 (a 19.8 percentage-point absolute boost over OriGen’s 35.9%).
- VerilogEval-Human: Scores 38.3% Pass@1 vs. OriGen’s 22.3%.
- RTLLM: Reaches 79.3% syntax validity and 48.3% functional Pass@5 (compared to OriGen’s 51.7% and 37.9%, representing a 27.4% relative gain).
- Beating Commercial Baselines: VeriCoder marginally outperforms Google's Gemini-2.0-Flash on VerilogEval Pass@5 (62.9% vs. 62.6%) and RTLLM functional correctness (48.3% vs. 34.5%).
Limitations and Future Work
- Imperfect Unit Tests: LLM-generated unit tests are heuristic and may not exercise every subtle corner case; passing a unit test does not mathematically guarantee 100% correctness.
- Small-Module Scope: The generated modules average 35 lines of code. Real-world ASIC/FPGA designs involve complex multi-file hierarchies, clock domain crossings, and deep repository dependencies.
- Future Directions: The authors highlight integrating formal verification (e.g., automated property-directed proofs via SVA) into the refinement loop, expanding test generation to repository-level RTL code, and using the accompanying test suites as reward signals for Reinforcement Learning (RL).
Summary updated