大規模言語モデルのためのコンパイラ生成フィードバック
Compiler generated feedback for Large Language Models
March 18, 2024
著者: Dejan Grubisic, Chris Cummins, Volker Seeker, Hugh Leather
cs.AI
要旨
我々は、大規模言語モデル(LLM)とコンパイラフィードバックを活用した新しいコンパイラ最適化パラダイムを提案する。このモデルは、最適化されていないLLVM中間表現(IR)を入力として受け取り、最適化されたIR、最適な最適化パス、および最適化前後のIRの命令数を出力する。次に、生成された最適化パスを用いて入力コードをコンパイルし、予測された命令数が正しいか、生成されたIRがコンパイル可能か、そしてコンパイルされたコードに対応しているかを評価する。このフィードバックをLLMに返し、コードを再度最適化する機会を与える。このアプローチにより、元のモデルに対して-Ozを上回る0.53%の改善が追加された。フィードバックによりより多くの情報を追加することは直感的に思えるが、10回以上のサンプルを考慮した単純なサンプリング手法の方がはるかに高い性能を達成することがわかった。
English
We introduce a novel paradigm in compiler optimization powered by Large
Language Models with compiler feedback to optimize the code size of LLVM
assembly. The model takes unoptimized LLVM IR as input and produces optimized
IR, the best optimization passes, and instruction counts of both unoptimized
and optimized IRs. Then we compile the input with generated optimization passes
and evaluate if the predicted instruction count is correct, generated IR is
compilable, and corresponds to compiled code. We provide this feedback back to
LLM and give it another chance to optimize code. This approach adds an extra
0.53% improvement over -Oz to the original model. Even though, adding more
information with feedback seems intuitive, simple sampling techniques achieve
much higher performance given 10 or more samples.Summary
AI-Generated Summary