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

探索端到端大语言模型作为编译器的可行性

Exploring the Feasibility of End-to-End Large Language Model as a Compiler

Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学)

Hongbin Zhang, Shihao Gao, Yang Liu, Mingjie Xing, Yanjun Wu, Chen Zhao

AI总结:

本文通过 CompilerEval 数据集评估大语言模型作为端到端编译器的可行性,发现其具备基本编译能力但成功率较低,并提出优化提示、扩大模型规模和引入推理方法等改进方向。

摘要:

近年来,端到端大语言模型(LLM)技术在各个领域展现出显著优势。作为关键的系统软件和基础设施,编译器负责将源代码转换为目标代码。虽然 LLM 已被用于辅助编译器开发和维护,但其作为端到端编译器的潜力在很大程度上仍未得到探索。本文探讨了 LLM 作为编译器(LaaC)的可行性及其未来方向。我们设计了 CompilerEval 数据集和框架,专门用于评估主流 LLM 在源代码理解和汇编代码生成方面的能力。在评估中,我们分析了各种错误,探索了多种改进 LLM 生成代码的方法,并评估了跨平台编译能力。实验结果表明,LLM 具备作为编译器的基本能力,但目前编译成功率较低。通过优化提示、扩大模型规模以及引入推理方法,LLM 生成的汇编代码质量可以显著提升。基于这些发现,我们对 LaaC 保持乐观展望,并提出了实用的架构设计和未来研究方向。我们相信,通过有针对性的训练、知识丰富的提示和专用基础设施,LaaC 有潜力生成高质量汇编代码,并推动编译领域的范式转变。

英文摘要:

In recent years, end-to-end Large Language Model (LLM) technology has shown substantial advantages across various domains. As critical system software and infrastructure, compilers are responsible for transforming source code into target code. While LLMs have been leveraged to assist in compiler development and maintenance, their potential as an end-to-end compiler remains largely unexplored. This paper explores the feasibility of LLM as a Compiler (LaaC) and its future directions. We designed the CompilerEval dataset and framework specifically to evaluate the capabilities of mainstream LLMs in source code comprehension and assembly code generation. In the evaluation, we analyzed various errors, explored multiple methods to improve LLM-generated code, and evaluated cross-platform compilation capabilities. Experimental results demonstrate that LLMs exhibit basic capabilities as compilers but currently achieve low compilation success rates. By optimizing prompts, scaling up the model, and incorporating reasoning methods, the quality of assembly code generated by LLMs can be significantly enhanced. Based on these findings, we maintain an optimistic outlook for LaaC and propose practical architectural designs and future research directions. We believe that with targeted training, knowledge-rich prompts, and specialized infrastructure, LaaC has the potential to generate high-quality assembly code and drive a paradigm shift in the field of compilation.

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

↑