{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/unsupervised-translation-of-programming","title":"Unsupervised Translation of Programming Languages","arxiv_id":"2006.03511","date":"2020-06-05","proceeding":"NeurIPS 2020 12","authors":["Marie-Anne Lachaux","Baptiste Roziere","Lowik Chanussot","Guillaume Lample"],"abstract":"A transcompiler, also known as source-to-source translator, is a system that converts source code from a high-level programming language (such as C++ or Python) to another. Transcompilers are primarily used for interoperability, and to port codebases written in an obsolete or deprecated language (e.g. COBOL, Python 2) to a modern one. They typically rely on handcrafted rewrite rules, applied to the source code abstract syntax tree. Unfortunately, the resulting translations often lack readability, fail to respect the target language conventions, and require manual modifications in order to work properly. The overall translation process is timeconsuming and requires expertise in both the source and target languages, making code-translation projects expensive. Although neural models significantly outperform their rule-based counterparts in the context of natural language translation, their applications to transcompilation have been limited due to the scarcity of parallel data in this domain. In this paper, we propose to leverage recent approaches in unsupervised machine translation to train a fully unsupervised neural transcompiler. We train our model on source code from open source GitHub projects, and show that it can translate functions between C++, Java, and Python with high accuracy. Our method relies exclusively on monolingual source code, requires no expertise in the source or target languages, and can easily be generalized to other programming languages. We also build and release a test set composed of 852 parallel functions, along with unit tests to check the correctness of translations. We show that our model outperforms rule-based commercial baselines by a significant margin.","url_abs":"https://arxiv.org/abs/2006.03511v3","url_pdf":"https://arxiv.org/pdf/2006.03511v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/facebookresearch/CodeGen","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/AmrHendy/programming-language-translator","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/MaratSaidov/source-code-summarization","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/OctopusNO1/Artificial-Intelligence-Guide","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/YonoHub/Model-Implementation-and-Training","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/code-desc/codesc","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/csebuetnlp/CoDesc","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/facebookresearch/TransCoder","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"unsupervised-translation-of-programming","repo_url":"https://github.com/sberbank-ai/fusion_brain_aij2021","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}}],"tasks":[{"task_slug":"code-translation","task_name":"Code Translation"},{"task_slug":"machine-translation","task_name":"Machine Translation"},{"task_slug":"translation","task_name":"Translation"},{"task_slug":"unsupervised-machine-translation","task_name":"Unsupervised Machine Translation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2006.03511","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2006.03511"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/OctopusNO1/Artificial-Intelligence-Guide","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/TransCoder","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/csebuetnlp/CoDesc","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/CodeGen","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/AmrHendy/programming-language-translator","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/code-desc/codesc","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/YonoHub/Model-Implementation-and-Training","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MaratSaidov/source-code-summarization","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sberbank-ai/fusion_brain_aij2021","reach":{"status":"unanswered"}}],"summary":{"ran_violates":1,"unverified":7},"by_repo_kind":{"listed":{"samples":8,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"8c0dec327bfce0f2","entry":"str2bool","repo":"code-desc/codesc","repo_kind":"listed","path":"CodeSummarization/c2nl/config.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/CodeSummarization/c2nl/config.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8c0dec327bfce0f2"}},{"code_sha256_prefix":"cb64b0975f6c0461","entry":"create_sample","repo":"code-desc/codesc","repo_kind":"listed","path":"Dataset_Preparation/Preprocess_CSN.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/Dataset_Preparation/Preprocess_CSN.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cb64b0975f6c0461"}},{"code_sha256_prefix":"d04ac70d96d9c8bd","entry":"get_model_args","repo":"code-desc/codesc","repo_kind":"listed","path":"CodeSummarization/c2nl/config.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/CodeSummarization/c2nl/config.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d04ac70d96d9c8bd"}},{"code_sha256_prefix":"c77d305475488a3d","entry":"override_model_args","repo":"code-desc/codesc","repo_kind":"listed","path":"CodeSummarization/c2nl/config.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/CodeSummarization/c2nl/config.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c77d305475488a3d"}},{"code_sha256_prefix":"81cd041092327b37","entry":"str_int_str_case_tokenizer","repo":"code-desc/codesc","repo_kind":"listed","path":"Tokenizer/CodePreprocess_final.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/Tokenizer/CodePreprocess_final.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"81cd041092327b37"}},{"code_sha256_prefix":"002866c5d9bea425","entry":"str_int_str_case_tokenizer","repo":"code-desc/codesc","repo_kind":"listed","path":"Tokenizer/NLPreprocess_final.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/Tokenizer/NLPreprocess_final.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"002866c5d9bea425"}},{"code_sha256_prefix":"d1365e142f9912b3","entry":"tokenize_with_snake_case","repo":"code-desc/codesc","repo_kind":"listed","path":"Tokenizer/CodePreprocess_final.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/Tokenizer/CodePreprocess_final.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d1365e142f9912b3"}},{"code_sha256_prefix":"925b4c4f3d361730","entry":"tokenize_with_str_int_str","repo":"code-desc/codesc","repo_kind":"listed","path":"Tokenizer/CodePreprocess_final.py","file_url":"https://github.com/code-desc/codesc/blob/HEAD/Tokenizer/CodePreprocess_final.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"925b4c4f3d361730"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}