avatarKevin Buddaeus

Summary

Facebook's TransCoder AI is revolutionizing the software industry by automating the translation of code between programming languages, potentially saving companies significant time and resources.

Abstract

Facebook is developing an AI-driven translator for software code, named TransCoder, which aims to convert code from one programming language to another. This innovation addresses the costly and time-consuming manual process currently required for code translation, which is exemplified by the Commonwealth Bank of Australia's $750 million expenditure to update their codebase from Cobol to Java. TransCoder's ability to translate between C++, Java, and Python, and its potential to adapt to any language pair, promises to streamline the conversion process, making it quicker and cheaper. The AI's versatility is demonstrated through its approach of translating code back and forth between languages to ensure coherence and accuracy, outperforming existing source-to-source (S2S) compilers. Initial tests have shown impressive results, with accuracy rates as high as 91.6% for Java to C++ translation. While TransCoder is poised to assist programmers by reducing their workload, it is not expected to replace them entirely, as human oversight will still be necessary to ensure error-free code.

Opinions

  • The article suggests that manual code translation is an expensive and outdated process, highlighting the need for a solution like TransCoder.
  • TransCoder is seen as a significant advancement over existing S2S compilers, which often require extensive bugfixing and are not as reliable.
  • The author implies that the adoption of TransCoder could lead to job displacement within the programming community, although human programmers will still be needed for oversight and error correction.
  • The development of TransCoder is part of a broader trend of AI being used to automate complex tasks, which is both exciting for its potential to assist humans and concerning for its impact on employment.
  • The article expresses optimism about the future of programming with AI assistance, suggesting that tools like TransCoder will allow for greater versatility, such as enabling game developers to switch between engines like Unreal and Unity without rewriting code from scratch.
  • The author is impressed with the AI developments presented at the Microsoft Build 2020 conference, particularly with OpenAI's progress in AI writing code based on instructions, indicating a competitive landscape in AI-based code translation solutions.

Facebook Develops An AI-Translator For Software Programmers

How the TransCoder AI can bridge a gap

Photo by Markus Spiske on Unsplash

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

Facebook’s researchers have publicized a research paper showing the approach and the first results of TransCoder in various tests.

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.

The Github demonstration starts around mark 30:00.

These developments are both exciting and frightening. It is exciting to see AI being able to help us with more complex tasks. But at the same time, it reminds us time and time again that more people will slowly lose their jobs to sophisticated machines.

Because these technologies are still being developed with the goal to save money in mind. And this money currently pays the people who do these jobs manually.

Kevin is an editor and writer for the ILLUMINATION and Polyglot Poetry publications. Follow him on Twitter and LinkedIn.

AI
Technology
Software Development
Programming
Business
Recommended from ReadMedium