T-LLM编译器:基于大语言模型的可信代码优化与验证框架
T-LLM Compiler: Trusted LLM-based Code Optimization and Verification Framework
- Huawei Technologies(华为技术有限公司)
机构由 AI 辅助整理,请以论文原文为准。
AI总结:
本文提出T-LLM编译器,结合LLM代码变换、传统编译器与验证工具,在PolyBench/C基准测试上实现最高83.3%优化准确率,变换后代码平均提速26.7%,并开源了项目代码。
AI中文摘要:
近年来,大语言模型(LLMs)的进展为将高级代码变换应用于代码优化领域创造了机会,代码优化也因此成为LLMs需完成的最基础任务之一;然而当前LLMs难以应用于广泛的代码优化任务,原因在于代码的复杂性以及无法独立验证变换的正确性。本文提出了可信大语言模型(T-LLM)编译器,该编译器通过高级LLM代码变换、传统编译器与验证工具的协同推进了编译器技术的发展。实验在一组PolyBench/C基准测试集上开展,结果显示它能显著提升代码正确性。该方法借助支持修正操作的验证策略,助力迭代式代码优化工作;在PolyBench/C基准测试集上,T-LLM编译器实现了最高83.3%的代码优化准确率,最高16.1%的加速比,变换后的代码较标准基准平均实现26.7%的加速比。此外,我们向开源社区发布了该项目的源代码。
英文摘要:
Recent advances in Large Language Models (LLMs) have opened opportunities to apply high-level code transformations to the field of code optimization, and it has since emerged as one of the most fundamental tasks for LLMs to perform; however, at present, LLMs struggle to apply wide-ranging code optimization tasks due to both the complexity of the code and the inability to independently verify the correctness of the transformations. In this paper, we present the Trusted LLM (T-LLM) Compiler, which proposes an advancement in compiler technology through a collaborative effort involving high-level LLM code transformations, traditional compilers, and verification tools. Experimental results reveal that it can significantly improve code correctness when tested on a set of PolyBench/C benchmarks. Our approach facilitates iterative code optimization efforts with verification strategies that enable corrective actions. Through this approach, T-LLM Compiler achieves code optimization accuracy of up to 83.3% and a speedup of up to 16.1\% on the PolyBench/C benchmarks, with the transformed code reaching an average of 26.7% speedup wrt standard baselines. Additionally, we release the project's source code to the open-source community.