Mark Zuckerberg, Facebook’s CEO at the European Parliament in Brussels in May 2018 (European Parliament, 2018)

This article is brought to you thanks to the strategic cooperation of The European Sting with the World Economic Forum.

Author:  Alex Gray, Senior Writer, Formative Content

Bugs in computer software can range from mild irritant to huge economic loss, and, in the worst cases, to a tragic loss of life.

The vast majority of companies today depend on software to run their businesses. Along the whole supply chain and down to the last customer, it’s software that runs the show.

Facebook’s new Android app has sought to use artificial intelligence – for the first time – to find and fix bugs in its software.

Bugs are a big problem

How Facebook’s SapFix tool generates patches for software bugs

Image: SapFix

The consequences of software bugs range far and wide.

For instance, in 2017, a glitch in the United Kingdom’s NHS computer system meant it didn’t send out 709,000 pieces of medical correspondence. While some people missed routine appointments as a result, others failed to receive their patient records, or worse, their cancer test results. Almost 2,000 patients were exposed to harm as a result.

The same year, the Uber app got a Frenchman into trouble when it exposed his affair to his wife. It had continued to send push notifications of his whereabouts, despite him having logged off the service.

In 2018, Tricentis, a Vienna-based software testing company, issued a report that found 606 major software fails, affecting 314 companies and a whopping $1.7 trillion in assets.


How AI could save developers’ time

Software developers have a constant roll of fixes to find and implement, some critical, others routine, and they have systems and processes in place that help alert them to bugs. But a lot of the work involves manually trawling through code.

Facebook’s new AI hybrid tool (called a hybrid because it still requires human interaction) was introduced to alleviate some of this spadework.

SapFix was created by Facebook engineers and is designed to drastically reduce the amount of time engineers spend debugging programs. It’s also designed to speed up the process of rolling out new software.

 How SapFix seeks the engineer’s feedback on the fix it generates

SapFix seeks engineer feedback after it generates a fix.
Image: Facebook

It works in two parts. First Sapienz, Facebook’s intelligent software testing tool, finds the bugs. Then SapFix automatically generates fixes and proposes them to engineers, who do the final check before letting loose the fix.

“Since we started testing SapFix in August, the tool has successfully generated patches that have been accepted by human reviewers and pushed to production,” says the company, adding that:

“To our knowledge, this marks the first time that a machine-generated fix – with automated end-to-end testing and repair – has been deployed into a codebase of Facebook’s scale.”

The finer details of how it works can be found here. In the meantime, Facebook promises that it will release the tools to open source “in the future”, with the feedback it receives used to further improve its innovations.

One of its key highlights, and one that might have proven useful to both the NHS and Uber, is that it will head off glitches before they happen.