arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.20527cs.DCcs.AIcs.LGcs.PFcs.PLcs.SE
收藏

CodeRosetta:推进面向并行编程的无监督代码翻译边界

CodeRosetta: Pushing the Boundaries of Unsupervised Code Translation for Parallel Programming

Cisco Outshift(思科Outshift);Google DeepMind(谷歌DeepMind);Iowa State University(爱荷华州立大学)

Ali TehraniJamsaz, Arijit Bhattacharjee, Le Chen, Nesreen K. Ahmed, Amir Yazdanbakhsh, Ali Jannesari

AI总结:

本文提出 CodeRosetta 编码器-解码器模型,利用定制预训练与训练目标实现编程语言及其 HPC 扩展的双向无监督翻译,在 C++-CUDA 和 Fortran-并行 C++ 任务上显著优于现有 LLM。

摘要:

大型语言模型(LLM)的最新进展重新激发了人们对自动编程语言翻译的兴趣。尤其是编码器-解码器 transformer 模型,已在不同编程语言之间的翻译中展现出潜力。然而,由于复杂并行语义等挑战,一种编程语言与其高性能计算(HPC)扩展之间的翻译仍未得到充分研究。本文提出 CodeRosetta,这是一种专门为编程语言及其 HPC 扩展之间的翻译而设计的编码器-解码器 transformer 模型。CodeRosetta 在 C++ 到 CUDA 以及 Fortran 到 C++ 的翻译任务上接受评估。它采用定制化学习框架,并配有针对性的预训练和训练目标,以有效捕捉代码语义和并行结构上的细微差别,从而实现双向翻译。结果表明,在 C++ 到 CUDA 翻译中,CodeRosetta 比最先进基线高出 2.9 BLEU 和 1.72 CodeBLEU 分,同时编译准确率提高 6.05%。与通用闭源 LLM 相比,我们的方法在 C++ 到 CUDA 翻译上提升 22.08 BLEU 和 14.39 CodeBLEU,编译准确率提高 2.75%。最后,CodeRosetta 在 Fortran 到并行 C++ 翻译方面表现出熟练能力;据我们所知,这使其成为首个面向这一复杂任务的编码器-解码器模型,并且相较闭源和开放代码 LLM,CodeBLEU 至少提高 4.63 分。

英文摘要:

Recent advancements in Large Language Models (LLMs) have renewed interest in automatic programming language translation. Encoder-decoder transformer models, in particular, have shown promise in translating between different programming languages. However, translating between a language and its high-performance computing (HPC) extensions remains underexplored due to challenges such as complex parallel semantics. In this paper, we introduce CodeRosetta, an encoder-decoder transformer model designed specifically for translating between programming languages and their HPC extensions. CodeRosetta is evaluated on C++ to CUDA and Fortran to C++ translation tasks. It uses a customized learning framework with tailored pretraining and training objectives to effectively capture both code semantics and parallel structural nuances, enabling bidirectional translation. Our results show that CodeRosetta outperforms state-of-the-art baselines in C++ to CUDA translation by 2.9 BLEU and 1.72 CodeBLEU points while improving compilation accuracy by 6.05%. Compared to general closed-source LLMs, our method improves C++ to CUDA translation by 22.08 BLEU and 14.39 CodeBLEU, with 2.75% higher compilation accuracy. Finally, CodeRosetta exhibits proficiency in Fortran to parallel C++ translation, marking it, to our knowledge, as the first encoder-decoder model for this complex task, improving CodeBLEU by at least 4.63 points compared to closed-source and open-code LLMs.

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

↑