Skip to main content
QUICK REVIEW

[Paper Review] MetRex: A Benchmark for Verilog Code Metric Reasoning Using LLMs

Manar Abdelatty, Jingxiao Ma|arXiv (Cornell University)|Nov 5, 2024
Natural Language Processing TechniquesComputer Science3 citations
TL;DR

MetRex introduces a large-scale benchmark with 25,868 Verilog designs and post-synthesis metrics (area, delay, static power), enhanced with Chain-of-Thought prompting and fine-tuned LLMs to improve reasoning about hardware metrics. Supervised fine-tuning boosts performance by 25–37%, achieving 17.4% higher accuracy than regression models within 5% error margin and offering 1.7x faster inference by eliminating preprocessing.

ABSTRACT

Large Language Models (LLMs) have been applied to various hardware design tasks, including Verilog code generation, EDA tool scripting, and RTL bug fixing. Despite this extensive exploration, LLMs are yet to be used for the task of post-synthesis metric reasoning and estimation of HDL designs. In this paper, we assess the ability of LLMs to reason about post-synthesis metrics of Verilog designs. We introduce MetRex, a large-scale dataset comprising 25,868 Verilog HDL designs and their corresponding post-synthesis metrics, namely area, delay, and static power. MetRex incorporates a Chain of Thought (CoT) template to enhance LLMs' reasoning about these metrics. Extensive experiments show that Supervised Fine-Tuning (SFT) boosts the LLM's reasoning capabilities on average by 37.0\%, 25.3\%, and 25.7\% on the area, delay, and static power, respectively. While SFT improves performance on our benchmark, it remains far from achieving optimal results, especially on complex problems. Comparing to state-of-the-art regression models, our approach delivers accurate post-synthesis predictions for 17.4\% more designs (within a 5\% error margin), in addition to offering a 1.7x speedup by eliminating the need for pre-processing. This work lays the groundwork for advancing LLM-based Verilog code metric reasoning.

Motivation & Objective

  • To address the lack of LLM-based reasoning for post-synthesis hardware metrics in Verilog designs.
  • To build a large-scale, clean dataset of synthesizable Verilog designs with annotated area, delay, and static power metrics.
  • To enhance LLM reasoning through Chain-of-Thought (CoT) prompting and Supervised Fine-Tuning (SFT).
  • To compare LLM-based metric estimation against regression models in accuracy and efficiency.
  • To enable interpretable, end-to-end metric estimation directly from HDL code without intermediate feature extraction.

Proposed method

  • An automated pipeline uses a Verilog compiler and synthesis tool to generate post-synthesis metrics, ensuring design correctness and eliminating syntax errors.
  • A Chain-of-Thought (CoT) prompting template is designed to guide LLMs through logical reasoning steps for estimating area, delay, and power metrics.
  • Supervised Fine-Tuning (SFT) is applied to Llama3-MetRex-8b using the MetRex dataset to improve metric reasoning performance.
  • The framework enables direct inference on Verilog code, bypassing the need for gate-level netlist or feature extraction, reducing preprocessing overhead.
  • Performance is evaluated using Mean Relative Error (MRE) and compared against the state-of-the-art regression model MasterRTL.
  • Runtime analysis compares LLM inference and preprocessing times against MasterRTL’s SOG generation and feature extraction pipeline.

Experimental results

Research questions

  • RQ1Can LLMs effectively reason about post-synthesis metrics (area, delay, static power) from raw Verilog code?
  • RQ2To what extent does Chain-of-Thought prompting improve LLM reasoning on hardware metric estimation?
  • RQ3How does Supervised Fine-Tuning enhance LLM performance on metric reasoning compared to few-shot prompting?
  • RQ4How does LLM-based estimation compare to regression-based models in accuracy and inference speed?
  • RQ5What is the impact of design complexity on LLM estimation performance, and how does it vary across metric types?

Key findings

  • Supervised Fine-Tuning (SFT) improved LLM performance on area, delay, and static power estimation by 37.0%, 25.3%, and 25.7%, respectively, compared to few-shot prompting.
  • The Llama3-MetRex-8b model achieved 73.2% accuracy in estimating area within a 20% error margin, 61.6% for delay, and 52.2% for static power.
  • LLM-based estimation outperformed the MasterRTL regression model by 17.4% in the number of designs predicted within 5% error margin.
  • Despite higher sensitivity to design variations, LLMs achieved 1.7x faster inference than MasterRTL by eliminating preprocessing steps.
  • The LLM model reduced runtime overhead by avoiding gate-level netlist generation and feature extraction, which consumed 505.3 seconds in MasterRTL.
  • Performance degradation was observed in complex designs (level-3), where LLMs struggled with reasoning complexity, though they outperformed regression models in simpler cases (level-1 and level-2).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.