Unsupervised Translation of Programming Languages
By Marie-Anne Lachaux, Baptiste Rozière, Lowik Chanussot, Guillaume Lample. 2020
573 citations recorded by the source corpus.
Un transcompilateur est un système qui convertit le code source d'un langage de programmation de haut niveau (tel que C++ ou Python) vers un autre. Les transcompilateurs sont principalement utilisés pour l'interopérabilité et pour transférer des bases de code écrites dans un langage obsolète (par exemple COBOL ou Python2) vers un langage plus moderne. Ils reposent généralement sur des règles de réécriture manuelles, appliquées à l'arbre de syntaxe abstraite du code source. Malheureusement, les traductions qui en résultent manquent souvent de lisibilité, ne respectent pas les conventions du langage cible et nécessitent des modifications manuelles pour fonctionner correctement. Le processus global de traduction prend du temps et nécessite une expertise à la fois dans les langages source et cible, ce qui rend les projets de traduction de code coûteux. Bien que les modèles neuronaux surpassent considérablement leurs homologues basés sur des règles dans le cadre de la traduction en langues naturelles, leurs applications à la transcompilation ont été limitées en raison de la rareté des données parallèles dans ce domaine. Nous proposons des méthodes pour entraîner des transcompilateurs neuronaux efficaces sans données supervisées. Les traducteurs de langues naturelles sont évalués avec des métriques basées sur la cooccurrence de tokens entre la traduction et la référence. Nous remarquons que ces métriques ne capturent pas la sémantique des langages de programmation. Nous construisons et publions donc une base de données de tests composée de 852 fonctions parallèles, ainsi que de tests unitaires pour vérifier l'exactitude sémantique des traductions. Nous exploitons d'abord les objectifs conçus pour les langues naturelles afin d'apprendre des représentations multilingues du code source, et entraînons un modèle à traduire, en utilisant seulement le code monolingue de projets open source GitHub. Ce modèle surpasse les méthodes basées sur des règles pour la traduction de fonctions entre C++, Java et Python. Ensuite, nous développons une méthode de pré-entraînement, amenant le modèle à apprendre des représentations sémantiques du code. Cela conduit à des performances améliorées sur plusieurs tâches, y compris la traduction de code non supervisée. Enfin, nous utilisons des tests unitaires automatisés pour créer des exemples de traductions de programmes. Entraîner un modèle sur ces exemples conduit à des améliorations significatives des performances de nos transcompilateurs neuronaux. Nos méthodes reposent exclusivement sur du code source monolingue, ne nécessitent aucune expertise dans les langues source ou cible, et peuvent facilement être généralisées à d'autres langages.
Subfields: Artificial Intelligence, Information Systems, Natural Language Processing, Code Generation & Program Synthesis
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Mohit Bansal
- Jianfeng Gao
- Percy Liang
- Luke S. Zettlemoyer
- Quoc V. Le
- Graham Neubig
- Yoshua Bengio
- Sergey Levine
In Information Systems
In Natural Language Processing
- Graham Neubig
- Jianfeng Gao
- Mohit Bansal
- Percy Liang
- Luke S. Zettlemoyer
- Caiming Xiong
- Kyunghyun Cho
- Richard Socher
In Code Generation & Program Synthesis
- Vincent J. Hellendoorn
- Charles Sutton
- Baptiste Rozière
- Chun Xia
- Lingming Zhang
- Guillaume Lample
- Baishakhi Ray
- Yangruibo Ding
Citations in the corpus
- Program Synthesis with Large Language Models (2021, methodology): “Porting programs across languages has been treated as a learning problem similar to machine translation [Roziere et al., 2020, Nguyen et al., 2013, Karaivanov et al., 2014].”
- Evaluating Large Language Models Trained on Code (2021, background): “As a consequence, recent works in unsupervised code translation (Lachaux et al., 2020) and pseudocode-to-code translation (Kulal et al., 2019) have turned to functional correctness instead, where a sample is considered correct if it passes a set of unit tests.”
- Break-It-Fix-It: Unsupervised Learning for Program Repair (2021, background): “Unsupervised MT learns translators from unpaired corpora (Artetxe et al., 2018a;b; Lachaux et al., 2020).”
- Code Llama: Open Foundation Models for Code (2023, methodology): “These tasks include code summarization, refinement, translation (Rozière et al., 2020; 2021; Szafraniec et al., 2023) fixing bugs (Yasunaga & Liang, 2021; Zhang et al., 2022a; Prenner et al., 2022), fixing build errors (Tarlow et al., 2020) or generating unit tests (Tufano et al., 2020; Li et al.,…”
- Unified Pre-training for Program Understanding and Generation (2021, methodology): “While most of the prior approaches use task-specific representation learning, a few works (Alon et al., 2019b; Feng et al., 2020; Guo et al., 2021; Lachaux et al., 2020; Clement et al., 2020) attempted to learn transferable representations in an unsupervised fashion.”
- CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generation (2021, background): “• code-code (clone detection [65, 84, 46, 80, 9, 89, 86], defect detection [91, 55, 51, 42, 78, 79], cloze test [15], code completion [57, 1, 56, 66, 67, 8, 27, 7], code repair [69, 4, 23, 26, 71, 73], and code-to-code translation [48, 37, 10, 41]) • text-code (natural language code search [32, 20, ”
- Measuring Coding Challenge Competence With APPS (2021, methodology): “Lachaux et al. (2020) use unsupervised machine translation techniques to translate functions across programming languages, attaining identical behavior after translation in many cases.”
- CodeBLEU: a Method for Automatic Evaluation of Code Synthesis (2020, methodology): “Although there are several automatic evaluation methods, which can be used to evaluate code synthesis (Karaivanov, Raychev, and Vechev 2014; Chen, Liu, and Song 2018; Lachaux et al. 2020), these approaches still suffer from many weakness and are not suitable to evaluate code.”
- Unsolved Problems in ML Safety (2021, background): “[110] Marie-Anne Lachaux, Baptiste Rozière, L.”
- DOBF: A Deobfuscation Pre-Training Objective for Programming Languages (2021, methodology): “For TransCoder, we use a learning rate of 10−4 as in Roziere et al. (2020).”
- PanGu-Coder: Program Synthesis with Function-Level Language Modeling (2022, background): “TransCoder [61] presented a pre-trained language model specifically focused on unsupervised translation of code between different programming languages.”
- The Programmer’s Assistant: Conversational Interaction with a Large Language Model for Software Development (2023, methodology): “Codefluent large language models are capable of generating code from natural language descriptions [105], translating code from one language to another [75], generating unit tests [92], and even generating documentation for code [36, 38, 97, 98].”
- Measuring The Impact Of Programming Language Distribution (2023, methodology): “, 2022) and translation (Roziere et al., 2020) tasks in multiple-languages, but are limited to only C++, Java, and Python.”
- CoDesc: A Large Code–Description Parallel Dataset (2021, methodology): “We modi-fied and re-released the open-source implementation of TransCoder 5 , enabling it to translate data in batches instead of one at a time, and resulting in a 16X faster translation.”
- Controlling Conditional Language Models without Catastrophic Forgetting (2021, methodology): “We use the code provided by (Roziere et al., 2020) for function extraction and randomly choose 5k functions for Ctrain and 5k for Ctest.”
- Leveraging Automated Unit Tests for Unsupervised Code Translation (2021, methodology): “Recently, TransCoder (Roziere et al., 2020) showed that unsupervised methods can be used to translate source code.”
- Natural Language to Code Generation in Interactive Data Science Notebooks (2022, methodology): “We evaluate the P A LM 62B model after the first-stage fine-tuning on Python data (§4) on other code generation benchmarks, namely HumanEval (Chen et al., 2021a), MBPP (Austin et al., 2021) and Transcoder (Lachaux et al., 2020b), following the evaluation setup of P A LM-C ODER in Chowdhery et al. (202”