arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2309.14846cs.SEcs.AIcs.LG
收藏

Supersonic:学习生成 C/C++ 源代码优化

Supersonic: Learning to Generate Source Code Optimizations in C/C++

KTH Royal Institute of Technology(瑞典皇家理工学院)

Zimin Chen, Sen Fang, Martin Monperrus

AI总结:

本文提出 Supersonic,一种基于 seq2seq 的神经方法,通过生成源代码 diff 实现 C/C++ 自动优化,在竞争性编程任务上以远小于 GPT 系列模型的规模超越 GPT-3.5-Turbo 和 GPT-4。

摘要:

软件优化在保持功能不变的同时提升程序的资源效率。传统上,这一过程由开发者和编译器完成。本文引入第三种选择,即在源代码层面进行自动化优化。我们提出 Supersonic,一种针对源代码微小修改以实现优化的神经方法。Supersonic 使用 seq2seq 模型,在 C/C++ 程序对($x_{t}$,$x_{t+1}$)上进行训练,其中 $x_{t+1}$ 是 $x_{t}$ 的优化版本,并输出一个 diff。Supersonic 的性能在竞争性编程任务上与 OpenAI 的 GPT-3.5-Turbo 和 GPT-4 进行了基准对比。实验表明,Supersonic 不仅在代码优化任务上优于这两个模型,而且以比 GPT-3.5-Turbo 小 600 倍以上、比 GPT-4 小 3700 倍的模型规模,最小化了修改的范围。

英文摘要:

Software optimization refines programs for resource efficiency while preserving functionality. Traditionally, it is a process done by developers and compilers. This paper introduces a third option, automated optimization at the source code level. We present Supersonic, a neural approach targeting minor source code modifications for optimization. Using a seq2seq model, Supersonic is trained on C/C++ program pairs ($x_{t}$, $x_{t+1}$), where $x_{t+1}$ is an optimized version of $x_{t}$, and outputs a diff. Supersonic's performance is benchmarked against OpenAI's GPT-3.5-Turbo and GPT-4 on competitive programming tasks. The experiments show that Supersonic not only outperforms both models on the code optimization task but also minimizes the extent of the change with a model more than 600x smaller than GPT-3.5-Turbo and 3700x smaller than GPT-4.

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

↑