Research map / Large language models / Agents, code and math
CraftRTL: High-quality Synthetic Data Generation for Verilog Code Models with Correct-by-Construction Non-Textual Representations and Targeted Code Repair
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Builds correct-by-construction Verilog data for Karnaugh maps, FSMs and waveforms plus error-report-driven targeted code repair data, and fine-tunes Starcoder2-15B to reach SOTA on VerilogEval and RTLLM.
Problem
LLM-generated synthetic Verilog data is noisy: models struggle with non-textual representations (Karnaugh maps, state diagrams, waveforms) and show unstable pass rates across training checkpoints due to minor errors that cannot be verified without testbenches.
Approach
Generate non-textual Verilog problems and solutions correct-by-construction from templates (with simulated VCD waveforms as testbench outputs), and create targeted repair data by having an LLM write error reports from failing completions, validating them, and injecting similar errors into open-source code.
Key results
- Starcoder2-15B fine-tuned on SDG-CC-Repair reaches 81.9% pass@1 on VerilogEval-Machine and 68.0% on VerilogEval-Human, versus prior SOTA gains of 3.8 and 10.9 points.
- On RTLLM v1.1, the SDG-CC-Repair Starcoder2-15B model achieves 65.8% functional pass@5, a 6.6-point improvement over prior SOTA as reported by the authors.
- Ablation: removing self-consistency validation drops VerilogEval-Human pass@1 from 68.0 to 63.3, and removing the error report drops it to 59.6.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| adding CC (correct-by-construction non-textual) data to SDG (ablation) | Starcoder2-15B · VerilogEval-Human | pass@1 (%): 47.4 to 58.5 at temp 0.8; 54.7 to 62.0 at temp 0.2 | Helped |
| adding targeted code repair data on top of SDG-CC (ablation) | Starcoder2-15B · VerilogEval-Machine and Human, RTLLM | pass@1 / pass@5: Machine 73.9 to 81.9; Human 62.0 to 68.0; RTLLM Func pass@5 62.8 to 65.8 | Helped |
| removing self-consistency check from error report validation (ablation) | Repair data pipeline · VerilogEval-Human | pass@1 (%): 68.0 to 63.3 | Hurt |
| removing error report (random LLM-injected errors instead) (ablation) | Repair data pipeline · VerilogEval-Human | pass@1 (%): 68.0 to 59.6 | Hurt |
| scaling Repair data from 1.4k to 7.8k samples (ablation) | Starcoder2-15B SDG-CC-Repair · VerilogEval-Human | pass@1 (%): 68.0 to 67.4 (Machine 81.9 to 82.2) | No clear effect |
| second iteration of code repair data generation (ablation) | Starcoder2-15B SDG-CC-Repair · VerilogEval-Human | pass@1 (%): 68.0 to 68.1 (Machine 81.9 to 81.3) | No clear effect |
| adding CC then Repair data (full SDG-CC-Repair) vs SDG-only | Starcoder2-15B · VerilogEval-Human | pass@1 (%): 54.7 to 68.0 | Helped |
| CC data (KMap, FSM, waveforms) effect on NonText problems | Starcoder2-15B · VerilogEval-NonText | pass@1 (%): NonText 22.2 (SDG) to higher with CC data; near-perfect on KMap and FSM, weaker on Waveforms | Helped |
Surprising findings
- Roughly 15% of VerilogEval-Human problems showed large pass-rate discrepancies between consecutive checkpoints, even though training loss decreased steadily.
- Directly prompting the LLM without the error report resolved only 13% of errors, versus much higher success with the report-guided hints.
Limitations
- Generated code diversity is low for non-textual problems, reflecting template-based CC data.
- Model performance remains weaker on waveform problems, which require reverse-engineering circuits from waveforms.
- RTLLM results use Icarus Verilog, which may not support all syntax, so numbers are not directly comparable to VCS-based prior work.
Experimental setup
Datasets: The Stack v2 (Verilog/SystemVerilog subset) Wikipedia textbooks VerilogEval-Human non-textual problems as templates
Benchmarks: VerilogEval-Machine VerilogEval-Human RTLLM v1.1 VerilogEval-NonText
Metrics: pass@1 pass@5 pass@10 syntax pass rate functional pass rate BLEU Jaccard TSED
Baselines: CodeV OriGen BetterV RTLCoder GPT-4o Llama-3.1 DeepSeek-Coder-V2 Starcoder2
Builds on: Self-Instruct OSS-Instruct VerilogEval RTLCoder CodeV
Closest papers by meaning
- VeriThoughts: Enabling Automated Verilog Code Generation using Reasoning and Formal Verification (NeurIPS 2025 · similarity 0.88)
- DeepRTL: Bridging Verilog Understanding and Generation with a Unified Representation Model (ICLR 2025 · similarity 0.87)
- QiMeng-CodeV-R1: Reasoning-Enhanced Verilog Generation (NeurIPS 2025 · similarity 0.87)
- BetterV: Controlled Verilog Generation with Discriminative Guidance (ICML 2024 · similarity 0.86)
- LLM-Assisted Code Cleaning For Training Accurate Code Generators (ICLR 2024 · similarity 0.86)
- Training Language Models to Generate Quality Code with Program Analysis Feedback (NeurIPS 2025 · similarity 0.86)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
