用大模型实现GCC与LLVM中间代码互译,准确率超现有模型44个百分点。
LLM Translation of Compiler Intermediate Representation

- 用140亿参数大模型直接学习GIMPLE到LLVM IR的映射关系。
- 在真实代码和编程竞赛数据上准确率领先现有模型最高44个百分点。
- 可作为神经符号编译器的桥梁,无需修改原有编译流程。
GCC和LLVM支撑现代软件基础设施,依赖不同的中间表示(IR)进行优化和代码生成。但两者在语义和结构上的差异阻碍了跨工具链交互,限制了编译器前端、后端及优化流水线在不同语言和生态间的复用。传统基于规则的翻译器因复杂性和维护成本难以实用。本文提出首个专为IR-to-IR翻译训练的模型IRIS-14B,采用140亿参数Transformer架构,对齐由C源码提取的配对GIMPLE与LLVM IR进行微调。在真实世界C代码及编程竞赛题目的测试中,该模型准确率超越当前最大开放模型(13至10000亿参数),最高提升达44个百分点。其可作为混合神经符号编译架构中的互操作层,使不同工具链间无需修改原生编译步骤即可协作,同时保留传统编译器的确定性优势。
原文摘要 · Abstract (English)
GCC and LLVM underpin much of modern software infrastructure, relying on distinct Intermediate Representations (IRs) to drive optimizations and code generation. However, the semantic and structural differences between these IRs create significant barriers for cross-toolchain interaction, limiting the reuse of compiler frontends, backends, and optimization pipelines across programming languages and compilation ecosystems. Traditional rule-based translators have attempted to bridge this gap, but their complexity and maintenance cost have hindered practical adoption. In this context, Large Language Models (LLMs) appear to be an emerging technology that offers a data-driven alternative, capable of learning complex mappings between heterogeneous compiler IRs directly from sufficiently representative examples. To explore this approach, this paper presents IRIS-14B, a 14-billion-parameter transformer model fine-tuned to translate GIMPLE (as emitted by GCC) to LLVM IR (as emitted by LLVM). The model is trained on paired IRs extracted from C sources and evaluated on the GIMPLE-to-LLVM IR transformation applied to IRs derived from real-world C code and competitive programming problems. To the best of our knowledge, IRIS-14B is the first model trained explicitly for IR-to-IR translation. It outperforms the accuracy of widely used models, including the largest state-of-the-art open models available today, ranging from 13 to 1,000 billion parameters, by up to 44 percentage points. The proposed transformation supports the integration of LLMs as complementary components within hybrid neuro-symbolic compiler architectures, where models such as IRIS-14B act as interoperability layers enabling cross-toolchain workflows without modifying existing compiler passes, while traditional compiler infrastructure continues to perform deterministic compilation and optimization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。