FB launches AI tool to debug software


Facebook has launched an Artificial Intelligence (AI) tool called ‘SapFix’ that reduces the time engineers spend on debugging, while also speeding up the process of rolling out new software.

FB said in a blog post that SapFix can automatically generate fixes for specific bugs, & then propose them to engineers for approval & deployment to production.

Already, SapFix has been used to accelerate the process of shipping robust, stable code updates to millions of devices using the Facebook Android app. Now FB says its intends to share SapFix with the engineering community, as it is the next step in the evolution of automating debugging, with the potential to boost the production & stability of new code for a wide range of companies & research organizations.

SapFix is designed to operate as an independent tool, able to run either with or without Sapienz, Facebook’s intelligent automated software testing tool, which was announced at F8.

In its current, proof-of-concept state, SapFix is focused on fixing bugs found by Sapienz before they reach production. The process starts with Sapienz, along with Facebook’s Infer static analysis tool, helping localize the point in the code to patch. Once Sapienz & Infer pinpoint a specific portion of code associated with a crash, it can pass that information to SapFix, which automatically picks from a few strategies to generate a patch.

How SapFix approaches debugging

This graphic illustrates how SapFix generates patches for software bugs.

To address high-firing bugs, SapFix creates patches that either fully or partially revert the code submission that introduced them. For more complex crashes, the system generates patches by drawing from its collection of templated fixes. These templates were automatically harvested from those created by human engineers, based on a pool of past fixes.

Once it lands on a specific patch, SapFix’s work is not over. The tool generates multiple potential fixes per bug & then evaluates their quality by checking for 3 issues: Are there compilation errors, does the crash persist, & does the fix introduce new crashes?

To resolve the latter 2 questions, SapFix runs existing, developer-written tests on the patched builds, as well as tests created by Sapienz. And as with the previous, patch-generation step, this validation process happens autonomously & is isolated from the larger codebase. SapFix is replicating the kind of debugging work that people currently do, but it is not designed to deploy fixes to production code on its own.

When its patches are fully tested, SapFix sends them to a human reviewer for approval.

Image Credit: Facebook