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

Leave a Comment
Share
Published by
Hamnah Khalid

Recent Posts

Pakistani Passport Continues to Rank Among the Worst in the World

According to the most recent Henley Passport Index, Pakistan's passport is still one of the…

18 hours ago

November 9 Approaches: Will Iqbal Day Be a Public Holiday This Year?

As Iqbal Day approaches on November 9, Pakistan prepares to honor Allama Iqbal, the celebrated…

19 hours ago

Most Wanted Human Trafficker Taken Into Custody

GUJRAT: According to the Gujrat circle of the Federal Investigation Agency (FIA), they have arrested…

19 hours ago

Air Sial Starts Weekly Flights from Islamabad to Riyadh

Air Sial, one of Pakistan's leading private airlines, has officially launched its weekly flights from…

20 hours ago

Important Update on Profit Rates for Savings Schemes 

On Friday, the government stated that from November 4th, 2024, profit rates on National Savings…

22 hours ago

Pakistan to Legalize Bitcoin and Cryptocurrency Through SBP Act Amendments?

The federal government has proposed amendments to the State Bank of Pakistan (SBP) Act aimed…

22 hours ago