Lune

ICLR2023顶会

Code Translation with Compiler Representations

Marc Szafraniec, Baptiste Rozière, Hugh Leather, Patrick Labatut, François Charton, Gabriel Synnaeve

摘要

In this paper, we leverage low-level compiler intermediate representations (IR) to improve code translation. Traditional transpilers rely on syntactic information and handcrafted rules, which limits their applicability and produces unnatural-looking code. Applying neural machine translation (NMT) approaches to code has successfully broadened the set of programs on which one can get a natural-looking translation. However, they treat the code as sequences of text tokens, and still do not differentiate well enough between similar pieces of code which have different semantics in different languages. The consequence is low quality translation, reducing the practicality of NMT, and stressing the need for an approach significantly increasing its accuracy. Here we propose to augment code translation with IRs, specifically LLVM IR, with results on the C++, Java, Rust, and Go languages. Our method improves upon the state of the art for unsupervised code translation, increasing the number of correct translations by 11% on average, and up to 79% for the Java -> Rust pair with greedy decoding. We extend previous test sets for code translation, by adding hundreds of Go and Rust functions. Additionally, we train models with high performance on the problem of IR decompilation, generating programming source code from IR, and study using IRs as intermediary pivot for translation.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 28 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code 引用了 Unsupervised Translation of Programming Languages
  • Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code 引用了 Leveraging Automated Unit Tests for Unsupervised Code Translation
  • Multi-lingual Evaluation of Code Generation Models 引用了 Unsupervised Translation of Programming Languages
  • Multi-lingual Evaluation of Code Generation Models 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Multi-lingual Evaluation of Code Generation Models 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • Exploring and Unleashing the Power of Large Language Models in Automated Code Translation 引用了 Unsupervised Translation of Programming Languages
  • Exploring and Unleashing the Power of Large Language Models in Automated Code Translation 引用了 Leveraging Automated Unit Tests for Unsupervised Code Translation
  • CodeBERT: A Pre-Trained Model for Programming and Natural Languages 引用了 Learning and Evaluating Contextual Embedding of Source Code
  • Learning and Evaluating Contextual Embedding of Source Code 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Scalable, Validated Code Translation of Entire Projects using Large Language Models 引用了 Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code
  • Scalable, Validated Code Translation of Entire Projects using Large Language Models 引用了 Unsupervised Translation of Programming Languages
  • Scalable, Validated Code Translation of Entire Projects using Large Language Models 引用了 Leveraging Automated Unit Tests for Unsupervised Code Translation
  • Leveraging Automated Unit Tests for Unsupervised Code Translation 引用了 Unsupervised Translation of Programming Languages
  • Leveraging Automated Unit Tests for Unsupervised Code Translation 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Leveraging Automated Unit Tests for Unsupervised Code Translation 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • Leveraging Automated Unit Tests for Unsupervised Code Translation 引用了 Learning and Evaluating Contextual Embedding of Source Code
  • GALLa: Graph Aligned Large Language Models for Improved Source Code Understanding 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • GALLa: Graph Aligned Large Language Models for Improved Source Code Understanding 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper28

  1. Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating CodeRangeet Pan, Ali Reza Ibrahimzada, Rahul Krishna, Divya Sankar 等ICSE 2024 · 96 次引用
  2. Exploring and Unleashing the Power of Large Language Models in Automated Code TranslationZhen Yang, Fang Liu, Zhongxing Yu, Jacky Wai Keung 等FSE 2024 · 72 次引用
  3. Multi-lingual Evaluation of Code Generation ModelsBen Athiwaratkun, Sanjay Krishna Gouda, Zijian Wang, Xiaopeng Li 等ICLR 2023 · 28 次引用
  4. Scalable, Validated Code Translation of Entire Projects using Large Language ModelsHanliang Zhang, Cristina David, Meng Wang, Brandon Paulsen 等PLDI 2025 · 15 次引用
  5. GALLa: Graph Aligned Large Language Models for Improved Source Code UnderstandingZiyin Zhang, Hang Yu, Sage Lee, Peng Di 等ACL 2025 · 11 次引用

它引用的 Paper5

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
  2. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng 等ICLR 2021 · 1,644 次引用
  3. Unsupervised Translation of Programming LanguagesBaptiste Rozière, Marie-Anne Lachaux, Lowik Chanussot, Guillaume LampleNeurIPS 2020 · 606 次引用
  4. Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 次引用
  5. Leveraging Automated Unit Tests for Unsupervised Code TranslationBaptiste Rozière, Jie Zhang, François Charton, Mark Harman 等ICLR 2022 · 161 次引用

相关 Paper

  1. Program Translation via Code DistillationYufan Huang, Mengnan Qi, Yongqiang Yao, Maoquan Wang 等EMNLP 2023 · 7 次引用
  2. VERT: Polyglot Verified Equivalent Rust Transpilation with Large Language ModelsAidan Z. H. Yang, Yoshiki Takashima, Brandon Paulsen, Josiah Dodds 等ASE 2025 · 1 次引用
  3. IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code GeneratorsIndraneil Paul, Goran Glavas, Iryna GurevychACL 2024
  4. RustRepoTrans: Repository-level Context Code Translation Benchmark Targeting RustGuangsheng Ou, Mingwei Liu, Yuxuan Chen, Yanlin Wang 等ASE 2025 · 1 次引用
  5. Semi-Supervised Code Translation Overcoming the Scarcity of Parallel Code DataMing Zhu, Mohimenul Karim, Ismini Lourentzou, Daphne YaoASE 2024 · 2 次引用
黄昏的海面,两侧是细线勾勒的悬崖