HomeinetFacebook TransCoder AI: Converts code from one programming language to another

Facebook TransCoder AI: Converts code from one programming language to another

One code converter makes it possible to convert one source code from one high-level programming language to another. Facebook researchers have developed TransCoder AI. This is a system, which makes it possible to convert code between programming languages, such as Java, Python and C ++. Relocating an existing code base to a more modern or efficient language requires a huge number of resources. In particular, both economic resources and human resources are needed. In theory, a converter can help eliminate the cost required to rewrite code from scratch. However, this is a difficult process, as the source language and target language have different syntax, types of variables, standard library functions and API platform.

TransCoder AI: Code converter for any programming language

Facebook's TransCoder AI can run unattended with minimal human intervention to find undetected patterns in sets data without labels and exceed the basic principles by rules with a "significant" margin. It can map code snippets that represent the same instructions in identical code snippets, regardless of the programming language used. The best part about Facebook TransCoder AI is that it can be easily generalized to any programming language and does not require any specialized knowledge to convert codes from one programming language to another.

Accuracy of TransCoder AI

Facebook researchers train TransCoder AI on publicly available code in more than 2,8 million open source repositories GitHub, to focus on code translation at the operating level. To evaluate the performance of TransCoder AI, they selected 852 parallels functions in C ++, Java and Python programming languages ​​from GeeksforGeeks - a popular platform that teaches problem-solving coding and offers solutions in various programming languages. Using this data, the researchers developed a new measurement called "computational accuracy", which checks whether the translated functions generate the same outputs with the same inputs as in the source language.

Results of TransCoder AI

Regarding the level of accuracy in the results obtained by TransCoder AI when converting passwords, the following are observed:

  • From C ++ in Python: 67,2%
  • From C ++ to Java: 74,8%
  • From Java to C ++: 91,6%
  • From Java to Python: 68,7%
  • From Python to Java: 56,1%
  • From Python to C ++: 57,8%

Researchers claim that TransCoder AI has "understood" the syntax of each language (Java, Python and C ++) along with their data structures. He even managed to align libraries in each language, while adapting to small ones amendments, such as renaming a variable at the input.

However, Transcoder AI is not perfect, as it failed to take into account certain types of variables when creating code. However, it went beyond the framework of "rebuilding" one code from scratch manually, based on the knowledge of specialized human resources.

Every accomplishment starts with the decision to try.