2 min Analytics

AI from Google Brain predicts code changes

AI from Google Brain predicts code changes

A team from Google Brain has written a new approach to create an Artificial Intelligence (AI) that can predict changes in the source code based on past adjustments. It claims that the approach delivers the best performance and scalability of all the options tested so far.

Making such an AI is challenging, as a developer often makes changes with one or more goals in mind. “Patterns of change can be understood not only in terms of the change (what has been added or removed) or its outcome (the state of the code after the application of the change)”, according to the researchers, reports Venturebeat.

“According to the researchers, if you want to get an AI to predict a series of operations, there must be a representation of the previous operations with which the model can generalize the pattern and predict future operations.


Therefore, the team first developed two representations to capture intentional information that scales with the length of the code series over time. It concerns explicit representations, which show operations in the series as tokens in a 2D grid, and implicit representations, which confirm further operations.

The team then created a machine learning model that can record the relationship between the changes and the context in which they were made, specifically by encoding the initial code and the changes, composing the context and recording the subsequent changes and their positions.

To measure the generalizability of the system, the researchers developed a set of synthetic data inspired by changes that may occur in real data, but have been simplified to allow for a clearer interpretation of the results. In addition, they have put together a large dataset of editing sequences of snapshots of a Google code base with eight million changes from 5,700 developers, and divided it into sets for training, development and testing.


The researchers argue that experiments show that the model reliably and accurately predicted positions where a change had to be made, as well as the content of that change. The researchers believe that the model can be adapted to improve autocomplete systems that ignore the history of changes, or to predict searches for code that developers will perform.

This news article was automatically translated from Dutch to give Techzine.eu a head start. All news articles after September 1, 2019 are written in native English and NOT translated. All our background stories are written in native English as well. For more information read our launch article.