Facebook Develops An AI-Translator For Software Programmers
How the TransCoder AI can bridge a gap
Converting software from one programming language to another is a costly endeavor. Many companies spend millions of US$ to have code rewritten from scratch.
Usually, this process has to be done by hand, relying on programmers who can read and understand both the source language and the target language, much like translators for our everyday languages (no, not leetspeak). This makes translating code from one language into another an expensive and time-consuming process.
But Facebook researchers are currently developing a new AI called TransCoder, which may well be able to automate this process in the near future. This can save many companies a lot of time and money. The Commonwealth Bank of Australia just spent 5 years and US$750 million in order to update their codebase from the outdated Cobol programming language to Java.
Streamlining conversion and programming processes
Once TransCoder takes over, the process of converting code from one language to another can be much quicker and cheaper than it is right now.
There are many programming languages available, from complex languages like C# and C++ to Java or Python as well as languages that slowly near their retirement, like Cobol.
To use Cobol as an example, it’s a language that many people don’t learn anymore. Compared to more modern languages like Java, it is outdated, overly complicated, and not as user friendly.
But a lot of software is still running on Cobol. Reuters has compiled graphics showing that 95% of all ATM card swipes are done using Cobol code. Almost half of all banking systems in the US still operate using Cobol.
All these programs will need to be re-written to use more modern programming languages like Java in the future to stay manageable. This is where TransCoder may well automate and ease the process.
TransCoder is highly versatile
Currently, TransCoder can translate freely between C++, Java and Python, but the research team behind TransCoder says that it will be able to adapt to any programming language pair and fluently translate in between them.
Software with the sole purpose of translating between languages is already available, but the results are more often than not underwhelming and can’t be used in a fire-and-forget manner due to the differences in how each language is structured. These so-called S2S (source to source) compilers are far from compiling code errorfree and need extensive bugfixing to get the final result to work. It’s often easier to just rewrite the code from scratch in the desired language.
Any programmer who needs to change code from let’s say C# to C++ or the other way around will tell you the same thing: “Learn both C# and C++, then spend a whole lot of time rewriting code from scratch.”
TransCoder learns by translating not only from a source language to a target language but also reverse translating it back. If you have used Google translator in the past, then you surely know that hitting “reverse translate” a few times can give you weird results as the translator pulls more things out of context.
TransCoder translates code both ways to pick up on these differences and tweaks the code until both ways give the expected results. This way, it ensures coherence.
First tests have delivered impressive results
Using over 852 parallel functions from GeeksForGeeks, they have run tests and checked to ensure the accuracy of TransCoder’s translations.
- Translating from Java to C++ resulted in 91.6% accuracy.
- Translating from C++ to Java resulted in 74.8% accuracy.
This shows that TransCoder outperforms its competition by a big margin already.
The biggest advantage is that TransCoder works autonomously and does not rely on human expertise, whereas current baseline programs need skilled programmers to deliver equal results.
The future of TransCoder and source-to-source-compilers
While it already outperforms other baseline S2S compilers in the tested language pairs, the research team will work on improving its accuracy and delivering more reliable results.
What does this development mean for the future of programming?
Currently, many programmers earn their income by working as code translators. TransCoder could theoretically take over this job. But luckily, results are never perfect and a human eye can spot errors that will always find their way into source code. TransCoder will not take over the job in its entirety, but may well be able to reduce the workload for programmers a lot.
Instead of writing the entire code from scratch, they’ll only have to “proofread” what TransCoder delivers as a result.
Many game developers, especially indie studios, rely on either the Unreal engine by Epic or the Unity engine by Unity Technologies. One of the main differences here is that one uses C++, while the other runs with C#. This is often a deciding factor when it comes to choosing the engine.
Being able to easily rewrite code from one language to the other will allow more versatility and allow game developers to switch an engine without having to rewrite tons of code from scratch.
Facebook is not the only one developing an AI-based S2S solution though. OpenAI, Microsoft’s flagship in AI development, has talked about the future of AI on the Microsoft Build 2020 conference.
CTO Kevin Scott has talked about a lot of interesting developments, but I was most impressed with his AI writing code from scratch given nothing but instructions.






