arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.18864cs.DCcs.AIcs.SE
收藏

用于生成快速代码的性能对齐LLMs

Performance-Aligned LLMs for Generating Fast Code

University of Maryland(马里兰大学);Lawrence Livermore National Laboratory(劳伦斯利弗莫尔国家实验室)

Daniel Nichols, Pranav Polasam, Harshitha Menon, Aniruddha Marathe, Todd Gamblin, Abhinav Bhatele

AI总结:

该研究提出一种基于强化学习的方法,将代码LLMs的输出与性能对齐,使模型能生成更高效的代码,并在基准任务中显著提升了串行和OpenMP代码的预期加速比。

摘要:

优化科学软件是一项困难的任务,因为代码库通常庞大且复杂,且性能可能取决于多种因素,包括算法、其实现以及硬件等。性能低下的原因可能源自不同的来源,且难以诊断。近年来出现了大量使用大型语言模型(LLMs)来辅助软件开发任务的工作。然而,这些工具被训练为将代码的分布建模为文本,并未专门设计用于理解代码的性能方面。在这项工作中,我们引入了一种基于强化学习的方法,将代码LLMs的输出与性能对齐。这使我们能够建立在LLMs当前的代码建模能力之上,并扩展它们以生成性能更好的代码。我们证明,对于一组基准任务,我们微调后的模型将生成代码相对于基础模型的预期加速比从0.9提升至1.6(串行代码),从1.9提升至4.5(OpenMP代码)。

英文摘要:

Optimizing scientific software is a difficult task because codebases are often large and complex, and performance can depend upon several factors including the algorithm, its implementation, and hardware among others. Causes of poor performance can originate from disparate sources and be difficult to diagnose. Recent years have seen a multitude of work that use large language models (LLMs) to assist in software development tasks. However, these tools are trained to model the distribution of code as text, and are not specifically designed to understand performance aspects of code. In this work, we introduce a reinforcement learning based methodology to align the outputs of code LLMs with performance. This allows us to build upon the current code modeling capabilities of LLMs and extend them to generate better performing code. We demonstrate that our fine-tuned model improves the expected speedup of generated code over base models for a set of benchmark tasks from 0.9 to 1.6 for serial code and 1.9 to 4.5 for OpenMP code.

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

↑