Facebook's Automated Bug Fixers
Written by Kay Ewbank   
Monday, 04 February 2019

The developers at Facebook are using AI-based tools to automatically find and fix bugs in the code for the Facebook app. Two tools, Sapienz and SapFix, are used to carry out testing and to locate and fix bugs.

Sapienz is more fully developed than SapFix, and has been in use for longer - in production at Facebook since September 2017 for Facebook's Android app, according to a paper given at the International Symposium on Search Based Software Engineering.

sapienz

Sapienz is built on top of FBLearner, a Machine Learning (ML) platform through which most of Facebook’s ML work is conducted. In addition to Sapienz, Facebook uses FBLearner for problems including search queries for videos, photos, people and events, anomaly detection, image understanding, language translation, and speech and face recognition.

Sapienz is used for checking large numbers of interactions across many combinations of devices and operating systems. Sapienz uses automated test design to make the testing process faster, as well as testing more comprehensively. It looks at all possible tests using what the developers say is "intelligent computational search and an approach called search-based software testing". It tests through the UI, meaning issues Sapienz reports to engineers can be found through the UI, so avoiding false positives. 

As Sapienz searches, it builds a model of the system under test, through the UI interactions, and any good tests are saved so they can be reused. Facebook says the technology has allowed engineers to fix issues within hours (sometimes within minutes) of the code being written.

SapFix process

The newer part of the story is SapFix, an AI hybrid tool that automatically generates fixes for specific bugs, then proposes the potential fixes to engineers for approval. Facebook says it 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 and stability of new code for a wide range of companies and research organizations. The way SapFix is being used is that Sapienz is used to localize the point in the code to patch. That information is passed to SapFix, which automatically picks from a small number of possible ways to generate a patch.

At the simplest level, SapFix just takes the code back to the state it was in before the last change. A more sophisticated approach is to try fixes based on fixes that worked for human developers in previous cases. Those fixes are stored and accessed as templates. If neither reversion or template fixes work, SapFix will attempt a mutation-based fix, whereby it performs small code modifications to the abstract syntax tree (AST) of the crash-causing statement, making adjustments to the patch until a potential solution is found.

SapFix generates multiple potential fixes for a bug then evaluates their quality by checking for three issues: Are there compilation errors, does the crash persist, and does the fix introduce new crashes? The patches that meet these criteria are passed to a human reviewer for approval.

SapFix is still in development, but it is already successfully generating patches that have been accepted by human reviewers and pushed to production.

sapienz
 

More Information

International Symposium on Search Based Software Engineering

https://developers.facebook.com/videos/f8-2018/friction-free-fault-finding-with-sapienz/

Related Articles

Facebook Advances in AI At F8

Facebook F8 - We Are The Enemy!

Facebook Roadmap For Connectivity, AI and VR/AR

Facebook Shares Deep Learning Tools

Facebook Open Sources Detectron Object Detection

Facebook's New AI Lab In Montreal

Yann LeCun Recruited For Facebook's New AI Group 

Facebook's Yann LeCun On Everything AI

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Visual Studio 17.12 Released Along With Aspire
25/11/2024

Visual Studio 2022 v17.12 is now available. The release can be used for .NET 9 projects and has a range of other improvements.



Apache Releases Tomcat 11
07/11/2024

Apache has announced the release of Tomcat 11, as well as marking the 25th anniversary of the first commit to the Apache Tomcat source code repository since becoming an ASF project.


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 04 February 2019 )