TL;DR
StepPRM-RTL introduces a step-level process reward model and Monte Carlo Tree Search (MCTS) framework tailored specifically to hardware semantics for LLM-based RTL generation. By evaluating meaningful design steps (rationale + code edit) rather than flat tokens, it improves functional correctness and reasoning fidelity by over 10% on Verilog and VHDL benchmarks.
What Problem Does This Paper Address?
Generating Register-Transfer Level (RTL) code like Verilog or VHDL is notoriously difficult for Large Language Models (LLMs). Unlike general software programming, hardware description languages require strict temporal, concurrent, and structural accuracy. A single misplaced signal or poorly aligned reset path can propagate across modules, breaking the entire datapath while remaining syntactically valid.
Existing approaches rely heavily on supervised learning (which captures surface-level patterns but misses underlying design reasoning) or outcome-based rewards (which only check the final compiled code, providing sparse feedback for long-horizon tasks). Furthermore, standard token-level Process Reward Models (PRMs) fail because hardware design decisions span entire statements or modules, making token-level credit assignment noisy and unstable.
Methods
The authors propose StepPRM-RTL, an iterative framework that models RTL generation as a sequence of semantically meaningful design steps. The framework consists of four tightly coupled components:
- Stepwise Trajectory Construction: Decomposes canonical RTL code into a sequence of steps. Each step pairs a natural language rationale (e.g., "Add always block triggered by clock and reset") with a specific code edit.
- Step-level Process Reward Model (StepPRM): Scores intermediate steps based on structural correctness and alignment with design intent. It uses preference learning combined with a consistency-based shaping term derived from Abstract Syntax Tree (AST) tree-edit similarity to the canonical solution.
- PRM-Guided Monte Carlo Tree Search (MCTS): Explores alternative design paths. It prunes syntactically invalid branches early (e.g., combinational cycles, undeclared signals) and uses StepPRM to guide tree expansion, generating a diverse dataset of high-quality trajectories.
- Retrieval-Augmented Fine-Tuning (RAFT): Fine-tunes the LLM policy using repository-level context (similar templates or design idioms) and reward-weighted trajectories collected during MCTS.
The overall workflow is illustrated below:
Datasets
- Training: An in-house RTL-IR corpus containing combinations of specifications, code, summaries, and derived stepwise trajectories used to bootstrap the policy and reward models.
- Evaluation: Two strictly held-out benchmarks used to test generalization: Verilog-Eval (156 tasks from HDLBits) and VHDL-Eval (202 translated VHDL tasks). Both were augmented with LLM-generated, verified stepwise rationales to evaluate reasoning fidelity.
Key Insights and Ideas
- Step-level > Token-level: Evaluating hardware design at the level of semantic steps matches hardware semantics much better than token-level scoring, stabilizing reinforcement learning and credit assignment.
- Early Pruning via Structural Checks: Integrating lightweight feasibility checks into MCTS drastically tightens the search space and improves sample efficiency by discarding structurally invalid branches immediately.
- Reward Shaping with ASTs: Since intermediate code cannot be simulated, using AST similarity to canonical code provides a smooth, continuous proxy for correctness before the design is complete.
Key Results
StepPRM-RTL achieved state-of-the-art results, outperforming strong baselines (including GPT-4o with RAG, RTLCoder, and VeriThoughts):
- Pass@1 Accuracy: Reached 0.857 on Verilog-Eval and 0.786 on VHDL-Eval, beating the best prior methods by over 10%.
- Reasoning Fidelity: Exceeded 80% on both benchmarks, showing that the model's internal rationales closely match human-like canonical design steps.
- Ablation Studies: Removing MCTS dropped Pass@1 by ~5 percentage points, and removing the PRM entirely (relying only on outcome verification) dropped it by ~7.6 percentage points, proving the necessity of both dense rewards and structured search.
The authors also provided a hyperparameter sensitivity analysis, showing that performance peaks around 15 MCTS simulations and a reward shaping weight ($\lambda_{sh}$) of 0.3:
Limitations and Future Work
- Single-File Focus: The current framework focuses primarily on single-file module generation; extending it to multi-file hierarchical designs remains an open challenge.
- Formal Verification: The authors suggest that integrating formal verification tools more tightly into the reward model loop could provide even stronger guarantees.
- Cross-Architecture Transfer: Exploring how reasoning trajectories can transfer across different chip architectures is highlighted as a promising future direction.
Summary updated