Skip to main content
QUICK REVIEW

[论文解读] Make Every Move Count: LLM-based High-Quality RTL Code Generation Using MCTS

Matthew DeLorenzo, Animesh Basak Chowdhury|arXiv (Cornell University)|Feb 5, 2024
Advanced Wireless Communication Techniques被引用 6
一句话总结

本文提出一个基于蒙特卡罗树搜索引导解码的框架(VeriGen+MCTS),使用基于变换器的LLM生成可编译、功能正确且为PPA优化的Verilog RTL代码。它报告了相较于之前仅使用LLM的方法,在ADP方面的显著改进,对于一个16位加法器的提升高达31.8%。

ABSTRACT

Existing large language models (LLMs) for register transfer level code generation face challenges like compilation failures and suboptimal power, performance, and area (PPA) efficiency. This is due to the lack of PPA awareness in conventional transformer decoding algorithms. In response, we present an automated transformer decoding algorithm that integrates Monte Carlo tree-search for lookahead, guiding the transformer to produce compilable, functionally correct, and PPA-optimized code. Empirical evaluation with a fine-tuned language model on RTL codesets shows that our proposed technique consistently generates functionally correct code compared to prompting-only methods and effectively addresses the PPA-unawareness drawback of naive large language models. For the largest design generated by the state-of-the-art LLM (16-bit adder), our technique can achieve a 31.8% improvement in the area-delay product.

研究动机与目标

  • 解决LLM生成的RTL代码在编译和功能正确性方面的差距。
  • 通过搜索引导LLM解码,实现PPA感知的RTL生成。
  • 处理实用设计(加法器、乘法器、MAC)并对面积和时延进行优化。
  • 利用模块化来重用优化子模块以扩展到大型设计。
  • 在多种比特宽度下展示相对于仅提示策略的性能提升。

提出的方法

  • 将Verilog RTL生成形式化为在LLM令牌上的马尔可夫决策过程(MDP)。
  • 应用蒙特卡罗树搜索(MCTS),其策略将MCTS统计与LLM先验相结合(基于UCT的探索)。
  • 定义奖励函数,惩罚不可编译或不可功能的代码,并强调面积-时延积(ADP)。
  • 对非功能性令牌(例如注释)进行剪枝以降低搜索空间。
  • 通过重用优化子模块实现模块化,以扩展到大型设计(例如64位加法器)。
  • 在加法器、乘法器和MAC单元上使用VeriGen-2B作为基础LLM,并用标准综合工具来推导PPA进行评估。

实验结果

研究问题

  • RQ1在使用LLM时,基于MCTS引导的解码框架是否能够产生功能正确的Verilog RTL?
  • RQ2将PPA感知奖励纳入是否能产生优化后的RTL(更小的面积、时延或ADP),相比仅提示的方法?
  • RQ3令牌剪枝(例如删除非功能性令牌)如何影响搜索效率和代码质量?
  • RQ4子模块的模块化复用是否能实现对大比特宽度设计的可扩展生成?
  • RQ5VeriGen+MCTS与VeriGen结合束搜索或贪婪解码在各种模块和尺寸上的比较?

主要发现

  • VeriGen+MCTS为所有测试模块产生功能正确的Verilog代码,而VeriGen和VeriGen+Beam Search在很多模块上失败。
  • 使用VeriGen+MCTS在功能代码的模块中,相比VeriGen提升的ADP均值为5.69%,相比VeriGen+Beam为14.27%。
  • 对于最大设计(16位加法器),VeriGen+MCTS相对于基线(最先进的提示方法)实现了高达31.8%的ADP提升。
  • 模块化和子模块复用显著提高大型设计的MCTS迭代速率(例如64位加法器快3倍)。
  • 更高的基线奖励增加了开发利用和功能代码比例,而中间值在探索与开发之间取得平衡在MCTS过程中。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。