arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.14153cs.LGcs.ARcs.CL
收藏

面向Verilog的推测解码:速度与质量兼得

Speculative Decoding for Verilog: Speed and Quality, All in One

The Chinese University of Hong Kong(香港中文大学);Shanghai Jiao Tong University(上海交通大学);National Technology Innovation Center for EDA(国家EDA技术创新中心)

Changran Xu, Yi Liu, Yunhao Zhou, Shan Huang, Ningyi Xu, Qiang Xu

AI总结:

针对Verilog等专用编程语言代码生成的分词与质量难题,提出将推测解码应用于Verilog代码生成,通过对齐解码停止位与语法词元,同时实现最高5.05倍生成加速与17.19%的pass@10准确率提升。

摘要:

大语言模型(LLM)的快速发展革新了各类编程语言的代码生成任务。然而,编程语言的独特特性,尤其是像Verilog这类语法特殊且在训练数据集中占比较低的语言,给传统的分词和解码方法带来了重大挑战。本文提出了推测解码在Verilog代码生成中的创新应用,证明该方法可同时提升推理速度和输出质量,真正实现速度与质量兼得。与常将有意义代码结构碎片化的标准LLM分词方案不同,我们的方法将解码停止位置与具有语法意义的词元对齐,使模型更易学习词元分布。这一改进解决了固有的分词问题,增强了模型更有效捕捉Verilog逻辑结构的能力。实验结果表明,与传统训练策略相比,我们的方法在Verilog代码生成中实现了最高5.05倍的加速,且在RTLLM基准上的pass@10功能准确率提升了最高17.19%。这些发现表明,推测解码是弥补专用编程语言代码生成质量差距的一种极具前景的方法。

英文摘要:

The rapid advancement of large language models (LLMs) has revolutionized code generation tasks across various programming languages. However, the unique characteristics of programming languages, particularly those like Verilog with specific syntax and lower representation in training datasets, pose significant challenges for conventional tokenization and decoding approaches. In this paper, we introduce a novel application of speculative decoding for Verilog code generation, showing that it can improve both inference speed and output quality, effectively achieving speed and quality all in one. Unlike standard LLM tokenization schemes, which often fragment meaningful code structures, our approach aligns decoding stops with syntactically significant tokens, making it easier for models to learn the token distribution. This refinement addresses inherent tokenization issues and enhances the model's ability to capture Verilog's logical constructs more effectively. Our experimental results show that our method achieves up to a 5.05x speedup in Verilog code generation and increases pass@10 functional accuracy on RTLLM by up to 17.19% compared to conventional training strategies. These findings highlight speculative decoding as a promising approach to bridge the quality gap in code generation for specialized programming languages.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑