Papers › Unsupervised Translation of Programming Languages

Unsupervised Translation of Programming Languages

5 Jun 2020NeurIPS 2020 12arXiv:2006.03511archive 2025-07-28

Marie-Anne Lachaux, Baptiste Roziere, Lowik Chanussot, Guillaume Lample

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.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2006.03511")

Code

Syntology Ran 1 of 8 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 1 ran · violated contract.

By repository: community (archive-listed): 8 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

facebookresearch/CodeGen officialmentioned on GitHubMIT report
OctopusNO1/Artificial-Intelligence-Guide mentioned on GitHubtfApache-2.0 report
YonoHub/Model-Implementation-and-Training mentioned on GitHubtfApache-2.0 report
code-desc/codesc mentioned on GitHubpytorchMIT report
csebuetnlp/CoDesc mentioned on GitHubpytorchMIT report
facebookresearch/TransCoder mentioned on GitHubpytorchNOASSERTION report
sberbank-ai/fusion_brain_aij2021 mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

8 samples harvested; 1 ran; 0 honoured the contract we drafted; 7 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
7unverified

Licence: 0 of the 8 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from code-desc/codesc. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

str2bool code-desc/codesc/CodeSummarization/c2nl/config.py community (archive-listed) ran · violated contract MIT (permissive) · 8c0dec327bfce0f2 · report
create_sample code-desc/codesc/Dataset_Preparation/Preprocess_CSN.py community (archive-listed) unverified MIT (permissive) · cb64b0975f6c0461 · report
get_model_args code-desc/codesc/CodeSummarization/c2nl/config.py community (archive-listed) unverified MIT (permissive) · d04ac70d96d9c8bd · report
override_model_args code-desc/codesc/CodeSummarization/c2nl/config.py community (archive-listed) unverified MIT (permissive) · c77d305475488a3d · report
str_int_str_case_tokenizer code-desc/codesc/Tokenizer/CodePreprocess_final.py community (archive-listed) unverified MIT (permissive) · 81cd041092327b37 · report
str_int_str_case_tokenizer code-desc/codesc/Tokenizer/NLPreprocess_final.py community (archive-listed) unverified MIT (permissive) · 002866c5d9bea425 · report
tokenize_with_snake_case code-desc/codesc/Tokenizer/CodePreprocess_final.py community (archive-listed) unverified MIT (permissive) · d1365e142f9912b3 · report
tokenize_with_str_int_str code-desc/codesc/Tokenizer/CodePreprocess_final.py community (archive-listed) unverified MIT (permissive) · 925b4c4f3d361730 · report

Tasks

Code TranslationMachine TranslationTranslationUnsupervised Machine Translation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections