Facebook engineers recently created AI tools that localize and fix bugs in the system automatically: SapFix and Sapienz. The SapFix tool is hybrid, because it requires both AI and human interaction, whereas Sapienz is used by Facebook to detect software bugs. SapFix can work on its own but works best in combination with Sapienz: once Sapienz has found a bug, SapFix will find a solution.
Sapienz detects the exact points in the code that need adaptation and then sends this information to SapFix. Next, SapFix has several options to fix this bug. For small bugs, reversion of the initial code during submission is the solution. This reversion can be either whole of partial. For more complex bugs, SapFix searches through human-created templates of previous bug fixes to see whether a similar bug has already been solved earlier and the same strategy can be implemented with the current bug. If it appears the human-based solutions don’t fit as well, SapFix modifies existing code until a potential solution has been found.
Subsequently, the bug fix must be tested for success, which is done by answering the following questions. Do compiling mistakes exist, does the bug prevail and does the fix initiate new bugs? An automated test is run to answer these questions, where after the fix is send to a human engineer for inspection. This means SapFix cannot implement its own solutions, since it may as well implement a solution that would have been rejected by a human. Though, SapFix and Sapienz are one of the first AI tools that automatically debug a system on a scale as large as Facebook’s. This can create new opportunities for machine-generated bug fixing, as developers now spend less time debugging and have more time to generate what’s next.
Right now, SapFix and Sapienz are private, but Facebook announced these tools may be available for open source in the future. Therefore, these tools may help improving AI-based code development and fixing, not only for Facebook but for other companies that put innovation at a high stake. What do you think of these tools and how will they develop in the future?
Finding and fixing software bugs automatically with SapFix and Sapienz