Migrating a codebase from one programming language to another is difficult and resource-intensive — the development teams involved need extensive knowledge of both the source and the target language; and is often costly. For example, the Commonwealth Bank of Australia spent around $ 750 million over the course of 5 years to convert its COBOL platform to Java.
This is particularly problematic when it comes to legacy systems — many companies, financial institutions, and administrations, therefore, decide against modernization.
So, Facebook wants to simplify the migration of a system from one programming language to another with an AI — especially for the modernization of legacy code.
For that, Facebook’s AI researchers have developed what they call a neural transcompiler, which should make such migration much easier and more efficient. According to the development team, the method is the first of its kind, where AI is used to translate code from one programming language to another without additional data.
The tool called TransCoder that converts code from one high-level programming language to another. TransCoder AI has already been tested and able to successfully translated functions from C ++ to Java and Python 3 and vice versa, surpassing both openly licensed and commercial other tools.
When it comes to TransCoder translation accuracy, over 90 percent of the translations from Java to C ++, 74.8 percent of the translations from C ++ to Java, and 68.7 percent of those from Java to Python were apparently correct. In comparison, a commercial tool with the language pair C ++ and Java only recorded a hit rate of 61 percent, and an open-source tool managed an accuracy level, only 38.3 percent.
No expertise required for TransCoder AI
So-called self-supervised training is particularly essential for translation between programming languages. However, TransCoder AI is unsupervised, which means it searches for previously undetected patterns in unlabelled data sets with a minimal amount of human oversight, and supposedly outperforms rule-based baselines by a “significant” margin.
According to the Facebook AI blog post, TransCoder AI can be able to be used by anyone who does not have expertise in one or both of the programming languages, and the approach of the tool can easily be extended to other programming languages.
Legacy code and new areas of application
TransCoder AI could be particularly suitable for the modernization of legacy codebases, and it was also a prime example of how translation techniques based on neural networks can be applied to new areas.
In the past, Facebook’s AI team had successfully used neural networks to solve complex mathematical equations. It is likely that the new TransCoder AI is also suitable for use in areas that are not related to translation or pattern recognition.