Enhancing Large Language Models for Hardware Verification: A Novel SystemVerilog Assertion Dataset

Anand Menon, Samit S Miftah, Shamik Kundu, Souvik Kundu, Amisha Srivastava, Arnab Raha, Gabriel Theodor Sonnenschein, Suvadeep Banerjee, Deepak Mathaikutty, Kanad Basu

TL;DR

The authors introduce VERT, a new open-source dataset containing 20,000 Verilog/SystemVerilog code snippets paired with functionally correct verification assertions. By fine-tuning compact, open-source models like DeepSeek Coder 6.7B and Llama 3.1 8B on this dataset, the researchers managed to outperform proprietary giants like GPT-4o in generating accurate hardware verification code, all while keeping sensitive design data local and secure.

What Problem Does This Paper Address?

In modern System-on-Chip (SoC) design, hardware verification is a massive bottleneck, often devouring up to 70% of total development time. Engineers rely on SystemVerilog Assertions (SVAs) to mathematically prove or simulate that a piece of hardware behaves exactly as intended. However, writing these assertions manually is tedious, slow, and highly prone to human error.

While Large Language Models (LLMs) show promise in automating code generation, state-of-the-art proprietary models like GPT-4o struggle with hardware description languages (HDLs). They frequently misinterpret clock cycle delays, botch complex nested if-else structures, and oversimplify long logical conditions. Furthermore, sending proprietary chip designs to external cloud APIs raises severe data privacy and intellectual property concerns for hardware companies. Smaller, open-source models could solve the privacy issue, but they lack high-quality, domain-specific datasets to learn how to write complex SVAs.

Methods

The authors developed a systematic pipeline to create the VERT dataset and evaluate fine-tuned models:

  1. Variable Extraction & Clean-up: The authors extracted variable names from prominent open-source RISC-V and SoC projects. To prevent the models from overfitting to specific naming conventions, they algorithmically generated synthetic variables by blending common hardware prefixes (e.g., reg, ctrl) with alphanumeric suffixes.
  2. Synthetic Assertion Generation: Using the cleaned variable pool, they dynamically constructed structured code blocks representing common hardware logic patterns (if-else hierarchies, case statements, and combined structures) and paired them with mathematically precise SVAs.
  3. Standardizing Temporal Logic: To fix the common LLM bias of misinterpreting clock cycles, the dataset standardizes assertions using the overlapping implication symbol (|->) combined with explicit delay counts, rather than relying on the ambiguous non-overlapping symbol (|=>).
  4. Fine-Tuning: They fine-tuned Llama 3.1 8B and DeepSeek Coder 6.7B using Low-Rank Adaptation (LoRA) with a large context window (4096 tokens) to handle long logic chains.
  5. Rigorous Verification Pipeline: To ensure the generated assertions were actually correct, the authors used a two-step verification process: mutation testing combined with formal verification (via Cadence JasperGold) and simulation (via Xilinx Vivado) to handle asynchronous reset behaviors.

Datasets

  • VERT (New): A curated dataset of 20,000 samples of SystemVerilog code segments paired with syntactically and functionally valid assertions.
  • Source Repositories: Variables were harvested from diverse open-source HDL projects, including BOOM-core, rocket-chip, XiangShan, mor1kx, AutoSoC, Riscy-SoC, OpenPiton, lizard, HERO, and darkriscv.
  • Evaluation Benchmarks: The models were tested against real-world, industry-standard SoC platforms: OpenTitan, CVA6, Pulpissimo, and OpenPiton.

Key Insights and Ideas

  • Data Hygiene is Paramount: One of the paper's most striking findings is how much "dirty" data hurts hardware generation. The authors conducted an ablation study comparing models trained on uncleaned data (with duplicates or inconsistencies) versus cleaned data. Cleaning the variable names caused the average functional correctness of the models to skyrocket from ~21% to over 93%.
  • Small and Local Beats Large and Cloud-Based: With targeted domain-specific data, a 7B or 8B parameter model running locally can comfortably beat a closed-source model that is orders of magnitude larger.
  • Structural Framing Guides Reasoning: By reframing how clock cycle delays are represented in the training data (using |-> with explicit delays), the authors successfully mitigated the inherent architectural bias LLMs have toward checking assignments only in subsequent clock cycles.

Key Results

  • Outperforming GPT-4o: Fine-tuned open-source models outperformed GPT-4o by up to 24.14% in functional correctness and 20.69% in syntactic correctness across the evaluation benchmarks.
  • Massive Gains Over Base Models: Fine-tuned models demonstrated up to a 96.88% improvement in generating precise assertions compared to their non-fine-tuned base counterparts.
  • Maximum Coverage: The verification strategy achieved up to 100% Complete Path Coverage (CPC) for both the fine-tuned Llama 3.1 and DeepSeek Coder models, proving that the generated assertions thoroughly covered all functional paths within the design blocks.
Model Performance Comparison (Averaged Across Benchmarks)
===========================================================
Model                  | Syntactic Accuracy | Functional Accuracy
-----------------------------------------------------------
Llama 3.1 8B (Base)    | 34.65%             | 22.50%
Llama 3.1 8B (VERT)    | 94.21%             | 93.89%
DeepSeek 6.7B (Base)   | 23.62%             | 19.91%
DeepSeek 6.7B (VERT)   | 96.52%             | 96.25%

Limitations and Future Work

The authors observed that "contamination" in design files—specifically the presence of extraneous HDL components like module instantiations and compiler directives (ifdef commands)—can confuse smaller models. When these components are heavily introduced, assertion accuracy drops by roughly 3%, as the models occasionally misinterpret ifdef blocks as standard runtime if-else statements.

Future Directions: * Expanding the VERT dataset to cover more intricate hardware design patterns and complex, non-RISC-V architectures. * Improving how models handle highly nuanced asynchronous vs. synchronous boundary conditions. * Directly integrating this automated LLM pipeline into industry-standard functional verification toolchains to create a seamless, push-button verification experience.

Summary updated

BibTeX
@article{menon2025enhancing,
  author = {Anand Menon and Samit S Miftah and Shamik Kundu and Souvik Kundu and Amisha Srivastava and Arnab Raha and Gabriel Theodor Sonnenschein and Suvadeep Banerjee and Deepak Mathaikutty and Kanad Basu},
  title = {{Enhancing Large Language Models for Hardware Verification: A Novel SystemVerilog Assertion Dataset}},
  journal = {ACM Transactions on Design Automation of Electronic Systems},
  year = {2025},
  doi = {10.1145/3764934},
}
Figure