Facebook’s AI Can Now Translate Code Into Other Programming Languages Automatically
Muhammad Mubeen Javed
Facebook artificial team has developed a system dubbed the neural transcompiler. It uses around 2.8 million open-source GitHub repositories to translate code among popular languages Java, C++, and Python.
Keeping the system up to date with the latest technologies and the latest programming languages costs millions of dollars every year. AI team has developed an automated system with the help of advanced Deep Learning architecture to tackle this issue.
Migrating existing codebases to an efficient and modern language requires individuals with expertise in both the target and the source language. It is tedious and costly too.
This new system is unsupervised. It requires minimum human supervision. It will translate code based on previously undetected patterns in data sets without labels. Researchers claim that this system outperforms a rule-based baseline by a “significant” margin.
The unsupervised translation has been achieved by initializing the transcoder with a cross-lingual language model. The model maps pieces of code expressing the same instructions common tokens like “if”, “while”, “for” and mathematical operators. It uses a target to source model to translate all the sequences.
The result of the compiler is not accurate completely. It’s much more accurate than other transcoders available today.
According to Facebook:
“TransCoder can easily be generalized to any programming language, does not require any expert knowledge, and outperforms commercial solutions by a large margin. Our results suggest that a lot of mistakes made by the model could easily be fixed by adding simple constraints to the decoder to ensure that the generated functions are syntactically correct, or by using dedicated architectures..”