用分步奖励机制提升大模型生成硬件代码的正确性和推理能力
StepPRM-RTL: Stepwise Process-Reward Guided LLM Fine-Tuning for Enhanced RTL Synthesis

- 通过分步推理轨迹和过程奖励模型,引导大模型逐步生成正确代码
- 在基准数据集上功能正确率比之前方法高出10%以上
- 适合芯片设计自动化领域研究者与工程师使用
由于长周期推理、多步依赖关系以及Verilog和VHDL中的严格正确性约束,自动生成数字硬件设计的RTL代码仍具挑战。我们提出StepPRM-RTL框架,结合分步轨迹建模、过程奖励模型(PRM)和检索增强微调(RAFT),提升基于大模型的RTL代码生成在功能正确性和推理一致性上的表现。该框架从标准解构建分步推理轨迹,每一步包含推理理由和增量代码修改。过程奖励模型评估中间步骤,提供密集反馈,指导RAFT微调中的强化学习式更新。蒙特卡洛树搜索(MCTS)探索替代推理路径,丰富训练数据集中的高质量轨迹。这种分步与结果感知奖励的结合使模型不仅学会如何构造正确RTL,还理解其背后的逻辑,显著提升长周期推理能力,超越传统监督或仅基于结果的训练方式。在标准Verilog和VHDL数据集上的实验表明,StepPRM-RTL在功能正确率和推理一致性指标上优于最佳先前方法超过10%。消融实验证实,PRM引导的奖励与分步轨迹探索的结合是性能关键。该方法可泛化至不同RTL语言,为高保真、可解释的代码生成提供可扩展框架,确立了大模型辅助硬件设计自动化的新标准。
原文摘要 · Abstract (English)
Automatic generation of RTL code for digital hardware designs remains challenging due to long-horizon reasoning, multi-step dependencies, and strict correctness constraints in Verilog and VHDL. We present StepPRM-RTL, a novel framework that combines stepwise trajectory modeling, process-reward modeling (PRM), and retrieval-augmented fine-tuning (RAFT) to enhance both the functional correctness and reasoning fidelity of LLM-based RTL code generation. StepPRM-RTL constructs stepwise reasoning trajectories from canonical solutions, where each step contains a rationale and incremental code modification. A Process Reward Model (PRM) evaluates intermediate steps, providing dense feedback that guides reinforcement-style updates during RAFT fine-tuning. Monte Carlo Tree Search (MCTS) explores alternative reasoning paths, enriching the training dataset with high-quality trajectories. This integration of stepwise and outcome-aware rewards allows the model to learn both how and why to construct correct RTL, improving long-horizon reasoning beyond standard supervised or outcome-based training. Experimental evaluation on benchmark Verilog and VHDL datasets demonstrates that StepPRM-RTL outperforms the best prior methods by over 10\% in functional correctness and reasoning fidelity metrics. Ablation studies confirm that the combination of PRM-guided rewards and stepwise trajectory exploration is key to its performance. StepPRM-RTL generalizes across RTL languages and provides a scalable framework for high-fidelity, interpretable code generation, establishing a new standard for LLM-assisted hardware design automation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。