Learning Performance-Improving Code Edits

要約

ムーアの法則の衰退に伴い、プログラムのパフォーマンスの最適化がソフトウェア研究の主要な焦点となっています。
ただし、コードのセマンティクスを理解することが難しいため、API やアルゴリズムの変更などの高レベルの最適化は依然として困難です。
同時に、事前トレーニングされた大規模言語モデル (LLM) は、幅広いプログラミング タスクを解決する強力な機能を実証しました。
そのために、LLM を高レベルのプログラム最適化に適応させるためのフレームワークを導入します。
まず、77,000 を超える競合 C++ プログラミングの提出ペアに対して、人間のプログラマーが広範な単体テストを伴って行った、パフォーマンスを向上させる編集のデータセットを厳選します。
大きな課題は、汎用ハードウェアでのパフォーマンスの測定に大きなばらつきがあり、それが偽の「改善」につながる可能性があることです。
プログラム最適化の影響を分離して確実に評価するために、学術界や産業界で使用されている事実上のシミュレーターである gem5 フル システム シミュレーターに基づいた環境を設計します。
次に、コード最適化のための幅広い適応戦略を提案します。
プロンプトの場合、検索ベースの少数ショット プロンプトと思考の連鎖が含まれ、微調整の場合、パフォーマンス条件付き生成とセルフプレイに基づく合成データの拡張が含まれます。
これらの技術を組み合わせることで、CodeLlama-13B では 5.65 倍、GPT-3.5 では 6.86 倍の平均速度向上が達成され、人間の最高パフォーマンス (4.06 倍) を上回ります。
私たちが提案するパフォーマンス条件付き生成は、パフォーマンスを向上させ、最適化されたプログラムの割合を増やすのに特に効果的であることがわかりました。

要約(オリジナル)

With the waning of Moore’s law, optimizing program performance has become a major focus of software research. However, high-level optimizations such as API and algorithm changes remain elusive due to the difficulty of understanding the semantics of code. Simultaneously, pretrained large language models (LLMs) have demonstrated strong capabilities at solving a wide range of programming tasks. To that end, we introduce a framework for adapting LLMs to high-level program optimization. First, we curate a dataset of performance-improving edits made by human programmers of over 77K competitive C++ programming submission pairs, accompanied by extensive unit tests. A major challenge is the significant variability of measuring performance on commodity hardware, which can lead to spurious ‘improvements’. To isolate and reliably evaluate the impact of program optimizations, we design an environment based on the gem5 full system simulator, the de facto simulator used in academia and industry. Next, we propose a broad range of adaptation strategies for code optimization; for prompting, these include retrieval-based few-shot prompting and chain-of-thought, and for finetuning, these include performance-conditioned generation and synthetic data augmentation based on self-play. A combination of these techniques achieves an average speedup of 5.65X on CodeLlama-13B and 6.86X on GPT-3.5, surpassing the best human performance (4.06X). We find our proposed performance-conditioned generation is particularly effective at improving performance as well as increasing the fraction of optimized programs.

arxiv情報

著者 Alexander Shypula,Aman Madaan,Yimeng Zeng,Uri Alon,Jacob Gardner,Milad Hashemi,Graham Neubig,Parthasarathy Ranganathan,Osbert Bastani,Amir Yazdanbakhsh
発行日 2023-11-08 18:21:44+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.LG, cs.PF, cs.SE パーマリンク