News

Facebook researchers develop tool to convert code from one programming language to another

The researchers at Facebook claim to have developed an artificially intelligent program that converts programming code from one high level language to another.

Researchers are calling the program a ‘neural transcompiler.’ It essentially uses unsupervised learning, where the program does not have to have a training set of data; it detects patterns in the datasets with minimal human supervision. The program can convert code from languages like C++, Java, and Python, into other high-level languages.

The conversion of code has proven to be an expensive and tedious, yet necessary task in this modern era of coding. More and more programs need to be converted to modern language like C++ and Python for them to be compatible with the programs of today. Transcompilers can be very difficult to build as all languages differ from one another in the way that they issue commands. They also use different language-specific APIs, standard-library function, as well as variable types.

Facebook’s newly developed system – The TransCoder uses an unsupervised learning approach. This approach bypasses the need for the program to be explicitly told what method will be converted to what. The TransCoder is initialised with cross-lingual language model pre-training – this maps equivalent instructions in two pieces of code onto one another. A process called denoising auto-encoding is also run – this essentially trains the system to output valid sequences of code, even when the input data is filled with noise. Another process called back-translation is used by the TransCoder to generate parallel data for training purposes.

After the development of the TransCoder, researchers have evaluated the program by gathering up 852 parallel functions (A function is a block of code designed to perform a specific action) in C++, Java, and Python from the popular coding solutions website, GeeksforGeeks. The functions have then been fed into the TransCoder and the accuracy of the results measured.

Facebook has reported that while the results of the tests were not strictly accurate, the TransCoder demonstrated an understanding of syntax for each specific language and correctly mapped many of the data structures and methods of each language. It did, however, have a hard time accounting for certain variables while generations but also, it outperformed many frameworks that are manually built and rewrite rules using expert knowledge.

“TransCoder can easily be generalized to any programming language, does not require any expert knowledge, and outperforms commercial solutions by a large margin,” said the authors of the TransCoder. “Our results suggest that a lot of mistakes made by the model could easily be fixed by adding simple constraints to the decoder to ensure that the generated functions are syntactically correct, or by using dedicated architectures.”

Sponsored
Hamnah Khalid

Share
Published by
Hamnah Khalid

Recent Posts

Garena Free Fire India Launch Rumors: What Fans Need to Know

Reports suggest that Garena Free Fire is set to make a much-anticipated return to India.…

6 hours ago

Albania Bans TikTok for One Year: Here’s the Reason!

The Albanian government has announced a ban on the social media platform TikTok for a…

10 hours ago

Google Pixel 9 Pro vs. 8 Pro: Biggest Upgrades Compared

The launch of Google’s latest Pixel lineup brings an exciting chance to compare the new…

12 hours ago

Azad Kashmir to Host Pakistan’s First Women-Centric Software Technology Park

ISLAMABAD: In February next year, Pakistan is set to launch its first women-focused software technology…

13 hours ago

HEC Reveals Law Admission Test Date for LLB Students

The Law Admission Test (LAT) has been announced by the Higher Education Commission (HEC) of…

13 hours ago

Meta’s WhatsApp to Release New Playback Speed Feature for Videos

Meta's WhatsApp is rolling out a new playback speed feature, allowing users to adjust video…

1 day ago