arXiv:2606.07925cs.CL2026-06

用强化学习优化硬件代码摘要,提升准确性和鲁棒性。

ROSUM-MCTS: Monte Carlo Tree Search-Inspired HDL Code Summarization with Structural Rewards

  • 借鉴蒙特卡洛树搜索,分层扩展候选摘要并优化结构。
  • 在VHDL-eval和Verilog-eval上优于基线方法,保持高质量摘要。
  • 对变量重命名等修改仍稳定,适合工业级硬件设计场景。

大语言模型(LLMs)在代码摘要任务中展现出潜力,但其在硬件描述语言(HDL)如VHDL和Verilog中的应用仍不充分。本文提出ROSUM-MCTS,一种受蒙特卡洛树搜索(MCTS)启发的LLM引导方法,通过结构化探索与强化驱动优化来改进摘要质量。该方法结合局部与全局上下文,采用分层候选扩展机制,并使用复合奖励函数平衡功能正确性(FC)、局部内容充分性(LCA)与流畅性。在VHDL-eval和Verilog-eval数据集上的评估表明,相比基线方法,该方法在结构化自底向上精炼与强化优化方面表现更优。消融实验验证了局部与全局扩展策略及FC与LCA平衡的重要性。此外,ROSUM-MCTS对变量重命名等表面修改具有鲁棒性,而基线方法性能下降。结果证明其为高效且稳健的HDL摘要框架,推动强化增强型代码摘要研究发展。

原文摘要 · Abstract (English)

Large language models (LLMs) have shown promise in code summarization, yet their effectiveness for Hardware Description Languages (HDLs) like VHDL and Verilog remains underexplored. We propose ROSUM-MCTS, an LLM-guided approach inspired by Monte Carlo Tree Search (MCTS) that refines summaries through structured exploration and reinforcement-driven optimization. Our method integrates both local and global context via a hierarchical candidate expansion mechanism and optimizes summaries using a composite reward function balancing functional correctness (FC), local content adequacy (LCA), and fluency. We evaluate ROSUM-MCTS on the VHDL-eval and Verilog-eval datasets, demonstrating its consistent outperformance over baseline methods by leveraging structured bottom-up refinement and reinforcement-based optimization. Ablation studies confirm the necessity of both local and global expansion strategies, as well as the importance of balancing FC and LCA for optimal performance. Furthermore, ROSUM-MCTS proves robust against superficial modifications, such as variable renaming, maintaining summary quality where baselines degrade. These results establish ROSUM-MCTS as an effective and robust HDL summarization framework, paving the way for further research into reinforcement-enhanced code summarization.

代码摘要硬件设计强化学习LLM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。