TL;DR
RTLLM is a new open-source benchmark designed to evaluate how effectively Large Language Models (LLMs) can generate hardware design code (RTL) from natural language instructions. The researchers also introduced a "self-planning" prompt engineering technique that significantly boosts the performance of models like GPT-3.5, occasionally producing hardware that rivals or beats human-crafted designs in efficiency.
What Problem Does This Paper Address?
As LLMs revolutionize software engineering, researchers are eager to apply them to hardware design (Electronic Design Automation or EDA). However, generating Register Transfer Level (RTL) code—the "source code" of hardware—is much more unforgiving than writing Python or C++.
Until now, the field lacked a standardized way to measure progress. Previous studies used small, proprietary datasets, making it impossible to compare different LLMs fairly. Furthermore, most prior work only checked if the code looked right or compiled, ignoring whether the resulting hardware was actually efficient in terms of PPA: Power, Performance, and Area. RTLLM fills this gap by providing a rigorous, automated framework for testing both the correctness and the quality of AI-generated hardware.
Methods
The authors propose a systematic evaluation pipeline that moves through three progressive goals:
- Syntax Goal: Does the generated code pass through a logic synthesis tool without errors?
- Functionality Goal: Does the design pass a comprehensive suite of testbenches (simulations)?
- Design Quality Goal: How do the Power, Performance (timing), and Area (PPA) of the AI's design compare to a human-written "ground truth" reference?
To improve LLM performance, they introduced Self-Planning. Instead of asking an LLM to generate code in one go, the process is split:
- Step 1: The LLM is asked to "plan" the design, providing reasoning steps in natural language and identifying potential syntax pitfalls to avoid.
- Step 2: The LLM generates the actual Verilog code based on its own plan.
Datasets
The paper introduces the RTLLM Benchmark, which consists of:
- 30 Digital Designs: Ranging from simple arithmetic (adders, multipliers) to complex logic (FSMs, an asynchronous FIFO, and even a simplified RISC-V CPU).
- Standardized Inputs: Each design includes a natural language description, a testbench for verification, and a human-crafted reference RTL file.
- Scale: With designs reaching up to 2.5K lines of code and 11.8K cells, it is significantly more comprehensive than previous datasets like those from Thakur et al. or Chip-Chat.
The benchmark is open-sourced at: https://github.com/hkust-zhiyao/RTLLM
Key Insights and Ideas
- Planning is Half the Battle: The "Self-Planning" technique mimics how human engineers work. By forcing the model to think through the logic before writing code, syntax errors dropped significantly. For GPT-3.5, this simple prompt change boosted syntax success from 55% to 73%.
- LLMs vs. Humans: In a surprising "aha" moment, the researchers found that LLMs sometimes produced better PPA results than human experts. For example, an LLM might choose a more area-efficient implementation for an adder that a human designer, prioritizing readability or standard patterns, might overlook.
- The Gap in Open Source: While GPT-4 is the clear leader, specialized academic models (like those fine-tuned on Verilog) and general open-source models (like StarCoder) still struggle significantly with complex functional logic compared to top-tier commercial models.
Key Results
- GPT-4 is the State-of-the-Art: It achieved an 81% syntax success rate and passed functional tests for 15 out of 30 designs.
- Self-Planning Works: Adding self-planning to GPT-3.5 allowed it to surpass the base version of GPT-4 in some metrics, achieving 14/30 functional successes (up from 10/30).
- PPA Benchmarking: GPT-4 achieved the "best quality" (lowest power/area or best timing) in more categories than any other model, though the human-crafted designs remained the most consistent across all 30 tests.
- Success Rates: The performance rank was established as: GPT-4 + Self-planning > GPT-4 > GPT-3.5 + Self-planning > GPT-3.5 > Thakur et al. >= StarCoder.
Limitations and Future Work
- Stochasticity: LLM outputs are non-deterministic. The authors had to run each query five times to get a representative sample, suggesting that "reliability" is still a major hurdle for production-grade hardware generation.
- Complexity Ceiling: While 30 designs is a leap forward, modern chips contain billions of transistors. Moving from individual modules to full-system-on-chip (SoC) generation remains a massive challenge.
- Future Directions: The authors plan to expand the benchmark and use the collected data to fine-tune open-source models, aiming to close the performance gap between open-source and commercial LLMs in the hardware domain.
Summary updated