ExeCoder:以可执行性表示增强大型语言模型的代码翻译能力
ExeCoder: Empowering Large Language Models with Executability Representation for Code Translation
AI总结:
本文提出 ExeCoder,通过融合功能语义、语法结构和变量依赖等可执行性表示增强 LLM,并构建 TransCoder-test-X,显著提升代码翻译性能。
摘要:
代码翻译是软件开发与维护过程中的一项关键活动,研究人员近来已开始关注利用预训练大型语言模型(LLM)进行代码翻译。然而,现有 LLM 在预训练期间仅学习代码的上下文语义,忽视了与代码执行状态密切相关的可执行性信息,这导致代码可执行性无法得到保证,并使自动化代码翻译不可靠。为解决该问题,我们提出 ExeCoder,这是一种专为代码翻译设计的 LLM,旨在利用功能语义、语法结构和变量依赖等可执行性表示来增强 LLM 的代码翻译能力。为评估 ExeCoder 的有效性,我们对广泛使用的基准 TransCoder-test 进行人工增强,得到一个名为 TransCoder-test-X、服务于 LLM 的基准。在 TransCoder-test-X 上的评估表明,ExeCoder 在代码翻译中取得了最先进性能,在两项指标上分别超过现有开源代码 LLM 10.88%至38.78%以上以及27.44%至42.97%以上,甚至优于著名的闭源 LLM GPT-4o。代码可在 https://aka.ms/execoder 获取。
英文摘要:
Code translation is a crucial activity in the software development and maintenance process, and researchers have recently begun to focus on using pre-trained large language models (LLMs) for code translation. However, existing LLMs only learn the contextual semantics of code during pre-training, neglecting executability information closely related to the execution state of the code, which results in unguaranteed code executability and unreliable automated code translation. To address this issue, we propose ExeCoder, an LLM specifically designed for code translation, aimed at utilizing executability representations such as functional semantics, syntax structures, and variable dependencies to enhance the capabilities of LLMs in code translation. To evaluate the effectiveness of ExeCoder, we manually enhanced the widely used benchmark TransCoder-test, resulting in a benchmark called TransCoder-test-X that serves LLMs. Evaluation of TransCoder-test-X indicates that ExeCoder achieves state-of-the-art performance in code translation, surpassing existing open-source code LLMs by over 10.88% to 38.78% and over 27.44% to 42.97% on two metrics, and even outperforms the renowned closed-source LLM GPT-4o. Code is available at https://aka.ms/execoder
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。