Search
Close this search box.

Facebook’s TransCoder AI Converts C++ and Java Code 2024

Facebook's TransCoder AI Converts C++ and Java Code 2024

High-level programming languages can have their source code converted to another language using transcompilers. Additionally, Facebook researchers have created TransCoder AI, a “neural transcompiler.” This system has the ability to translate code between high-level languages like C++, Java, and Python.

A significant investment of money and labor is needed to migrate an existing codebase to a more advanced or productive language. Theoretically, transcompilers can reduce the cost associated with starting from scratch while developing code.

However, because to differences in platform APIs, standard library functions, syntax, and variable types between the source and destination languages, they are challenging to implement in reality.

Facebook’s TransCoder AI Converts C++ and Java Code 2024

Facebook’s TransCoder AI uses an unsupervised learning strategy to address these problems. It can uncover hidden patterns in unlabeled data sets and outperform rule-based baselines by a “significant” margin when run unattended with little to no human interaction.

No matter what programming language is used, the neural transcompiler can translate code segments that express the same instructions to code segments that are identical.

Facebook TransCoder’s biggest feature is that it’s readily generalizable to any programming language and doesn’t require any specialized expertise to convert codes between different programming languages.

The precision of TransCoder AI

With an emphasis on function-level code translation, Facebook researchers trained TransCoder AI on publicly accessible code from over 2.8 million open-source projects on GitHub.

They selected 852 parallel functions in C++, Java, and Python from GeeksforGeeks, a well-known website that teaches coding by providing solutions in a variety of programming languages, in order to assess TransCoder AI’s performance.

They created a new statistic termed “computational accuracy” using the two aforementioned data sets to determine if translated functions produce the same results with the same inputs as they did in the original language.

The End Results

This is the degree of accuracy that the AI was able to achieve while transforming codes from

  • Java to C++ conversion rate: 74.8%
  • 67.2% of C++ to Python
  • 91.6% of Java to C++
  • Python to Java: 68.7%
  • Java to Python: 56.1%
  • C++ to Python: 57.8%

According to the researchers, TransCoder AI has demonstrated a comprehension of the data structures and grammar of the three languages (Python, Java, and C++). It was even able to adjust to minor changes, like changing a variable in the input, and accurately align the libraries across all languages.

Also Check: 5 Computer Myths You Should Never Accept

However, Transcoder’s shortcomings stem from the fact that during code creation, several variable types were overlooked. It did, however, perform better than the frameworks that manually rewrite rules created using human specialists’ knowledge.

Leave a Reply

Discover more from Warriors of Computer Science

Subscribe now to keep reading and get access to the full archive.

Continue reading