ZME Science
No Result
View All Result
ZME Science
No Result
View All Result
ZME Science

Home → Research

Facebook’s new AI can translate from one programming language to another

This could save billions of dollars and years of work.

Mihai AndreibyMihai Andrei
June 18, 2020
in News, Research, Tech, Technology
A A
Share on FacebookShare on TwitterSubmit to Reddit

Translating from one language to another is not just a nuisance. The Commonwealth Bank of Australia spent 5 years and a whopping $750 million to convert the code on their platform from COBOL (a programming language first developed over 50 years ago) to Java.

This is hardly an exception. Worldwide, 95% of ATM swipes and 80% of in-person transactions use COBOL, and much scientific and industrial research is still done in Fortran, another legacy programming language.

A surprisingly large part of the data in our day to day lives is based on old programming languages, and translating them to newer and more efficient languages is extremely expensive and time-consuming.

This is where Facebook’s AI comes in.

Example. Credits: Lachaux et al.

According to a new paper, researchers have developed a transcompiler — a system that converts source code from a high-level programming language (such as C++ or Python) to another. When done by humans, this migration is challenging and time-consuming as it requires extensive knowledge in both languages. But if you could train an algorithm to do that for you, you’d save a lot of time and resources.

Facebook researchers trained the new Artificial Intelligence (AI) on open source GitHub projects. The AI is unsupervised, so it learns on its own, mostly by looking for patterns in datasets. It requires a minimal amount of human supervision and expertise.

The TransCoder (as the AI was called) was trained on 2.8 million open source repositories, targeting translation at the function level. The AI started by looking for common keywords like “for,” “while,” “if,” and “try” and also digits, mathematical operators, and common English words or strings that appear in the source code. After the initial training period, the algorithm also undergoes a process of denoising and back-translating components (which was only done on functions).

RelatedPosts

The UN expects Earth’s 10 billionth inhabitant sometime in the early 2050s
Retinol vs. Retinal: Which One is Better for Skincare?
What’s the value of a human life?
NASA plans manned outpost on the far side of the moon

This is not the first time something like this was attempted — several translation algorithms have already been developed, but Facebook engineers say this AI outperforms them by a ‘significant’ margin.

The results weren’t perfect. The TransCoder was tested on 852 parallel functions in all the 3 languages, exhibiting remarkable (but not perfect) accuracy. When translating from C++ to Java, 74.8% of the functions returned the expected output. From C++ to Python, the figure was 67.2%. The highest accuracy was obtained when translating from Java to C++ (91.6%), and the lowest was obtained from Python to Java (56.1%).

So it’s still not exactly perfect, but the approach has promise — and to make things even better, it can be easily adapted to a number of different programming languages with ease.

“TransCoder can easily be generalized to any programming language, does not require any expert knowledge, and outperforms commercial solutions by a large margin,” the coauthors wrote. “Our results suggest that a lot of mistakes made by the model could easily be fixed.”

While the algorithm hasn’t yet been adapted to languages such as COBOL, it’s only one step away. A quick and cheap revolution could finally be coming to out ATMs.

ShareTweetShare
Mihai Andrei

Mihai Andrei

Dr. Andrei Mihai is a geophysicist and founder of ZME Science. He has a Ph.D. in geophysics and archaeology and has completed courses from prestigious universities (with programs ranging from climate and astronomy to chemistry and geology). He is passionate about making research more accessible to everyone and communicating news and features to a broad audience.

Related Posts

Genetics

This Superbug Learned How to Feed on Plastic from Hospitals

byMihai Andrei
12 hours ago
Biology

China’s Tiangong space station has some bacteria that are unknown to science

byMihai Andrei
13 hours ago
News

Hidden Communication Devices Found in Chinese-Made Inverters Could Put U.S. Electrical Grid at Risk

byTudor Tarita
13 hours ago
Health

Patients on Weight Loss Drugs Like Wegovy May Say They Just Don’t Want to Drink Anymore

byTudor Tarita
13 hours ago

Recent news

This Superbug Learned How to Feed on Plastic from Hospitals

May 20, 2025

China’s Tiangong space station has some bacteria that are unknown to science

May 20, 2025

Hidden Communication Devices Found in Chinese-Made Inverters Could Put U.S. Electrical Grid at Risk

May 20, 2025
  • About
  • Advertise
  • Editorial Policy
  • Privacy Policy and Terms of Use
  • How we review products
  • Contact

© 2007-2025 ZME Science - Not exactly rocket science. All Rights Reserved.

No Result
View All Result
  • Science News
  • Environment
  • Health
  • Space
  • Future
  • Features
    • Natural Sciences
    • Physics
      • Matter and Energy
      • Quantum Mechanics
      • Thermodynamics
    • Chemistry
      • Periodic Table
      • Applied Chemistry
      • Materials
      • Physical Chemistry
    • Biology
      • Anatomy
      • Biochemistry
      • Ecology
      • Genetics
      • Microbiology
      • Plants and Fungi
    • Geology and Paleontology
      • Planet Earth
      • Earth Dynamics
      • Rocks and Minerals
      • Volcanoes
      • Dinosaurs
      • Fossils
    • Animals
      • Mammals
      • Birds
      • Fish
      • Amphibians
      • Reptiles
      • Invertebrates
      • Pets
      • Conservation
      • Animal facts
    • Climate and Weather
      • Climate change
      • Weather and atmosphere
    • Health
      • Drugs
      • Diseases and Conditions
      • Human Body
      • Mind and Brain
      • Food and Nutrition
      • Wellness
    • History and Humanities
      • Anthropology
      • Archaeology
      • History
      • Economics
      • People
      • Sociology
    • Space & Astronomy
      • The Solar System
      • Sun
      • The Moon
      • Planets
      • Asteroids, meteors & comets
      • Astronomy
      • Astrophysics
      • Cosmology
      • Exoplanets & Alien Life
      • Spaceflight and Exploration
    • Technology
      • Computer Science & IT
      • Engineering
      • Inventions
      • Sustainability
      • Renewable Energy
      • Green Living
    • Culture
    • Resources
  • Videos
  • Reviews
  • About Us
    • About
    • The Team
    • Advertise
    • Contribute
    • Editorial policy
    • Privacy Policy
    • Contact

© 2007-2025 ZME Science - Not exactly rocket science. All Rights Reserved.