Bbabo NET

Science & Technology News

Microsoft showed an AI tool to automate debugging and find bugs in the code

Microsoft researchers have developed an AI-powered tool that scientists believe will help programmers find and fix bugs in code faster. The software is named BugLab and is based on the principles of generative adversarial networks.

In total, BugLab employs two competing GANs that learn by playing hide and seek with each other. And the process itself is structured as follows. The first network receives the reference program code as input and decides whether it is worth the error in the code and accurately formulates its error. For example, decides to replace the addition sign with a subtraction sign. After that, the code is edited and errors are specially entered into it. The other network then looks for the mistake made by the first network and tries to fix it.

These two GANs learn on their own in a self-monitoring mode. The first network learns to hide errors in the code in such a way that it is difficult to find them, and the second learns to look for even the most unobvious bugs. As a result, both networks benefit - the first can generate more and more complex errors each time, and the second can find them. This approach to learning is similar to the principles of generative adversarial networks, except that new pieces of code are not created from scratch, but overwrite the data of already existing passages. Researchers from Microsoft noted that the learning process is similar to a game of hide and seek, when one participant searches for the most suitable place in which they would not be found, and the second analyzes the situation and tries to find such places.

The company noted that current machine learning models are not yet able to find complex logical and architectural bugs, so the researchers focused on teaching AI to identify the most common mistakes, which include:

errors of using comparison symbols;

incorrect use of logical operators;

errors in variable names.

The researchers also stated that during the training they used code snippets in the Python programming language. And after the learning process, we tested the AI ​​on code snippets from the Python Package Index (PyPI). Tests have shown that this training method is 30% more effective than the alternatives.

Then the experts from Microsoft tested BugLab on open source projects on GitHub. Among all the errors found, 19 were previously unknown. But besides this, experiments have shown that the instrument is still far from ideal and often gives false positives.

In the near future, researchers plan to train AI to understand the structure of the code; for this, it is planned to present code fragments in the form of graph vertices and indicate their relationship with each other with edges. This approach will allow us to apply standard machine learning models and achieve more accurate error detection.

Microsoft showed an AI tool to automate debugging and find bugs in the code