Google report on using AI for internal code migrations

Google report on using AI for internal code migrations

Google published a report on it’s effort to migrate code to the latest dependencies – an often thankless task fraught with risk. Google’s code migrations involved: changing 32-bit IDs in the 500-plus-million-line codebase for Google Ads to 64-bit IDs; converting its old JUnit3 testing library to JUnit4; and replacing the Joda time library with Java’s standard java.time package. The 32-bit ID’s were particularly rough because they were often generically defined types that were not easily searchable.

They used a collection of AI tools as well as manual code reviews and touch-ups to achieve their goal. They emphasize that LLMs should be viewed as complementary to traditional migration techniques that rely on Abstract Syntax Trees (ASTs), grep-like searches, Kythe, and custom scripts because LLMs can be very expensive.

The results?

With LLM assistance, it took just three months to migrate 5,359 files and modify 149,000 lines of code to complete the JUnit3-JUnit4 transition. Approximately 87 percent of the code generated by AI ended up being committed with no changes. For the Joda-Java time framework switch, the authors estimate a time saving of 89 percent compared to the projected manual change time.

Links:

One thought on “Google report on using AI for internal code migrations

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.