Leveraging Automated Unit Tests for Unsupervised Code Translation
Baptiste Rozière, Jie Zhang, François Charton, Mark Harman, Gabriel Synnaeve, Guillaume Lample
摘要
With little to no parallel data available for programming languages, unsupervised methods are well-suited to source code translation. However, the majority of unsupervised machine translation approaches rely on back-translation, a method developed in the context of natural language translation and one that inherently involves training on noisy inputs. Unfortunately, source code is highly sensitive to small changes; a single token can result in compilation failures or erroneous programs, unlike natural languages where small inaccuracies may not change the meaning of a sentence. To address this issue, we propose to leverage an automated unit-testing system to filter out invalid translations, thereby creating a fully tested parallel corpus. We found that fine-tuning an unsupervised model with this filtered data set significantly reduces the noise in the translations so-generated, comfortably outperforming the state-of-the-art for all language pairs studied. In particular, for Java Python and Python C++ we outperform the best previous methods by more than 16% and 24% respectively, reducing the error rate by more than 35%.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 51 篇顶会 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 引用了 Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation
- Exploring and Unleashing the Power of Large Language Models in Automated Code Translation 引用了 CodeT: Code Generation with Generated Tests
- Exploring and Unleashing the Power of Large Language Models in Automated Code Translation 引用了 Unsupervised Translation of Programming Languages
- 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
- Teaching Large Language Models to Self-Debug 引用了 CodeT: Code Generation with Generated Tests
- Teaching Large Language Models to Self-Debug 引用了 Unsupervised Translation of Programming Languages
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation 引用了 Unsupervised Translation of Programming Languages
引用它的顶会 Paper51
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code GenerationJiawei Liu, Chunqiu Steven Xia, Yuyao Wang, Lingming ZhangNeurIPS 2023 · 2,317 次引用
- Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 次引用
- 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 次引用
- Exploring and Unleashing the Power of Large Language Models in Automated Code TranslationZhen Yang, Fang Liu, Zhongxing Yu, Jacky Wai Keung 等FSE 2024 · 72 次引用
- CodeT: Code Generation with Generated TestsBei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan 等ICLR 2023 · 64 次引用
它引用的 Paper8
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng 等ICLR 2021 · 1,644 次引用
- Unsupervised Translation of Programming LanguagesBaptiste Rozière, Marie-Anne Lachaux, Lowik Chanussot, Guillaume LampleNeurIPS 2020 · 606 次引用
- Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 次引用
- Hoppity: Learning Graph Transformations to Detect and Fix Bugs in ProgramsElizabeth Dinella, Hanjun Dai, Ziyang Li, Mayur Naik 等ICLR 2020 · 212 次引用
相关 Paper
- Syntax and Domain Aware Model for Unsupervised Program TranslationFang Liu, Jia Li, Li ZhangICSE 2023 · 25 次引用
- Data Augmentation for Code Translation with Comparable Corpora and Multiple ReferencesYiqing Xie, Atharva Naik, Daniel Fried, Carolyn P. RoséEMNLP Findings 2023 · 5 次引用
- Program Translation via Code DistillationYufan Huang, Mengnan Qi, Yongqiang Yao, Maoquan Wang 等EMNLP 2023 · 7 次引用
- AVATAR: A Parallel Corpus for Java-Python Program TranslationWasi Uddin Ahmad, Md Golam Rahman Tushar, Saikat Chakraborty, Kai-Wei ChangACL Findings 2023 · 46 次引用
- Semi-Supervised Code Translation Overcoming the Scarcity of Parallel Code DataMing Zhu, Mohimenul Karim, Ismini Lourentzou, Daphne YaoASE 2024 · 2 次引用
