HyperAI

If AI Is Not in Place, the Right Way Is to Work With Programmers to Write Code

6 years ago
Big factory news
Headlines
Information
Dao Wei
特色图像

By Super Neuro

Well-known game development company Ubisoft and open source technology giant Mozila recently released the jointly developed Clever-Commit programming assistance tool, which provides engineers with bug warning and correction functions. 

We have published an article titled "Assisting you in writing Python is just the first step for AI to replace programmers", which introduced that more and more AI tools can help engineers improve their code quality and work efficiency during the code writing process.

For example, Kite, invested by GitHub CEO, can intelligently complete code snippets, call functions, and query document demos based on the current production environment. We once joked that the ambition of AI is not just to assist humans, but to eventually replace the functions of engineers. 

Of course, these are just jokes. At present, it seems unlikely that AI will completely replace craftsmen. In the future, AI will be more involved in helping engineers work more efficiently and with higher quality. 

When you find that your code doesn't work

Recently, Clever-Commit, an AI coding assistant jointly developed by Mozila and Ubisoft, has emerged. Its role is to rescue the engineers behind Firefox from bugs. On February 12, Mozila announced that they have started using this tool in cooperation with Ubisoft to make code writing more efficient, thereby bringing Firefox users a better browsing experience. 

 Clever-Commit: High-energy bug warning ahead! 

Clever-Commit's predecessor was Commit- Assistant launched by Ubisoft last year.  

Commit-Assistant is a system for finding bugs and suggesting fixes. It is a code assistant that helps developers improve the gaming experience. The birth of this AI assistant is due to their huge code base. It is said that during training, it accepted about ten years of Ubisoft's working code, including many codes with modified bugs. 

Against this backdrop, Mozlia and Ubisoft collaborated to launch an upgraded version of Clever-Commit. 

Clever-Commit is an auxiliary programming tool, which can be simply described as an AI assistant that checks code. When developers submit code changes to the Firefox code base, it can compare the newly added code with the previous ones to see if they are similar to the bugs that have been found. If the assistant determines that the newly submitted part is suspicious, it will alert the developer. 

If the assistant's judgment accuracy is high, it means that the bug can be detected and warned before it is submitted to the source repository. For some bugs, Clever-Commit can even suggest suitable fixes. 

Mozilla plans to use Clever-Commit during code review first, and then expand it to other development stages over time. It is worth mentioning that it is fully applicable to the three languages Mozilla uses for Firefox: C++, JavaScript, and Rust. 

How does it find bugs? 

In fact, its occurrence is inevitable. Automatic prevention and resolution of faults is an inevitable path for software development. Existing methods use code and process metrics to build metric-based models, which can effectively prevent defect insertion in software projects. 

The technology used here is called CLEVER, which was first developed by researchers from Ubisoft and Concordia University. They wrote a paper titled "CLEVER: Combining Code Metrics with Clone Detection for Just-In-Time Fault Prevention and Resolution in Large Industrial Projects" that explains its details. In general, it is a combined-level bug prevention and resolution technology.

Article address: https://montreal.ubisoft.com/wp-content/uploads/2018/05/ICSE-CE-MSR-165.pdf

The key is to accurately determine whether the code is a risky part when it is added, so as to intercept or repair it. 

The implementation method has two main stages. The first is to build a library based on existing indicators, which can determine whether the newly added code is similar to the risky code. The second stage is to add these seemingly dangerous codes to the clone area of the code, and then determine whether they are risky codes. 

In addition, CLEVER not only evaluates the current project, but also considers other related projects in its judgment, so it is more intelligent. Based on code base matching and previous data accumulation, CLEVER is at the leading level in terms of bug recognition rate and improvement suggestions. 

Ubisoft and Firefox cross-border cooperation 

Speaking of why CLEVER is so powerful, it is because it has powerful resources behind it. Ubisoft is a giant in the video game industry, specializing in the design and implementation of high-budget video games. 

Ubisoft's highly coupled software systems, containing millions of files and commits, are developed and maintained by more than 8,000 developers in 29 locations across six continents, providing a unique advantage for CLEVER's development and training. 

To compare the performance of CLEVER, they tested it on 12 Ubisoft systems, and the results showed that CLEVER achieved 79% precision and 65% recall for risky code commits, which exceeded the performance of a similar method, Commit-guru (66% precision and 63% recall). In addition, CLEVER was able to recommend to developers how to fix 66.7% of risky commits. 

Clever-Commit, which uses CLEVER technology, is expected to achieve good results once it is fully integrated into Mozilla's development process, which will greatly reduce the pain of developers. Catching four or five vulnerabilities before submission will save more resources than discovering them after they are submitted.

The Firefox engineering team has stated that they will begin using Clever-Commit in their code writing, testing, and release processes. They expect to save hundreds of hours of vulnerability risk analysis and detection through this approach. 

Anything else? 

There are other attempts to use machine learning to detect bugs in large code bases. 

Last year, Microsoft launched a similar tool in Visual Studio: IntelliCode. 

IntelliCode studied the most popular public GitHub repositories (over 2,000 projects with over 100 stars each) to discover the characteristics of best coding practices. 

The initial purpose of IntelliCode is quite conservative, it provides smarter IntelliSense completion suggestions by understanding which suggestions are more likely to be used based on how other projects use the same API. It is also used to detect coding style and whitespace usage so that it can write code in a similar code writing style. 

Like Clever-Commit, IntelliCode can be used to find bugs and provide timely remediation for developers' mistakes.