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

Automatic High-quality Verilog Assertion Generation through Subtask-Focused Fine-Tuned LLMs and Iterative Prompting

Mohammad Shahidzadeh, Behnam Ghavami, Steve Wilton, Lesley ShannonarXiv 2024 · DOI

Introduction

Formal Property Verification (FPV) stands as the "gold standard" for ensuring hardware designs adhere strictly to their intended behavior. Central to FPV are SystemVerilog Assertions (SVA), mathematical descriptions of design properties. However, crafting high-quality SVAs is a specialized, labor-intensive, and error-prone task. While Large Language Models (LLMs) have shown promise in general software engineering, they often falter in hardware verification due to the significant reasoning gap between high-level natural language specifications and low-level hardware logic, frequently resulting in syntax errors or "hallucinated" signal names.

The AssertCraft Framework

To address these challenges, we present AssertCraft, a framework designed to automate the generation of high-quality SVAs from natural language specifications. AssertCraft employs two core strategies: subtask-focused fine-tuning and an iterative bug-fixing paradigm.

The AssertCraft framework overview, showing the assertion generation flow from specification and the evaluation flow.

Subtask-Focused Fine-Tuning

Rather than attempting a "zero-shot" jump from specification to code, AssertCraft decomposes the process. First, an LLM extracts intermediate structured data—such as Finite State Machine (FSM) states or variable ranges—and converts them into detailed comments. Subsequently, a fine-tuned GPT-3.5 model translates these comments into SVA code. This "divide and conquer" approach reduces the complexity of individual reasoning steps, significantly improving the model's accuracy.

Iterative Bug-Fixing

Recognizing that initial outputs may contain errors, AssertCraft incorporates a "compiler-in-the-loop" repair cycle. A specialized compiler analyzes the generated assertions and provides human-readable feedback regarding syntax or semantic failures. A dedicated "debugger LLM" then utilizes this feedback to iteratively refine and patch the code until it is syntactically correct.

Dataset and Benchmarking

A significant hurdle in training hardware-specific LLMs is the scarcity of high-quality spec-to-assertion data. AssertCraft overcomes this by utilizing a hybrid dataset:

  • Real-world Data: 500 examples of assertions paired with comments scraped from GitHub.
  • Synthetic Data: 500 examples generated via automated scripts to cover diverse logic patterns.
  • HDLBits Benchmark: For evaluation, the framework uses a curated subset of the HDLBits dataset, comprising 892 potential assertions across categories like FSMs, counters, and shift registers.

Key Results and Evaluation

AssertCraft demonstrates a substantial improvement over standard LLM baselines. The framework achieved a 7.3-fold increase in functionally correct assertions compared to a baseline GPT-3.5 model.

Comparison of assertion counts and proportions across different LLM prompting strategies.

Key performance metrics include:

  • Syntax Repair: The iterative prompting method successfully corrected 26% of assertions that initially failed due to syntax or semantic bugs.
  • Functional Accuracy: Out of 892 potential assertions, AssertCraft generated 528 with correct syntax and 294 that were both syntactically and functionally perfect without human intervention.
  • Coverage: On several designs, the generated assertions achieved 100% stimuli coverage, indicating they were comprehensive enough to monitor all relevant design activities.

Discussion and Future Work

AssertCraft represents a major advancement in automated hardware verification. By shifting the LLM's role from complex reasoning to structured translation and providing it with a "compiler-teacher," the framework bridges the gap between natural language and formal logic.

Future research will focus on improving the handling of complex combinational logic and reducing the system's dependency on the quality of the input specification. Additionally, the authors suggest extending this sub-tasking approach to more advanced verification tasks, such as automated theorem proving and formal proof generation.

Reference: Shahidzadeh, M., et al. "Automatic High-quality Verilog Assertion Generation through Subtask-Focused Fine-Tuned LLMs and Iterative Prompting." arXiv:2411.15442v1, 2024.

Summary updated

BibTeX
@misc{shahidzadeh2024automatic,
  author = {Mohammad Shahidzadeh and Behnam Ghavami and Steve Wilton and Lesley Shannon},
  title = {{Automatic High-quality Verilog Assertion Generation through Subtask-Focused Fine-Tuned LLMs and Iterative Prompting}},
  year = {2024},
  eprint = {2411.15442},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.15442},
}
Figure