Screen with source code

AI autocomplete tool saves time for coders

Image credit: Dreamstime

Researchers based at Rice University, Texas, have developed a machine-learning application called Bayou that automates the writing of some code, saving software developers much time and frustration.

“People have tried for 60 years to build systems that can write code, but the problem is that these methods aren’t good with ambiguity,” said Professor Swarat Chaudhuri, co-creator of the application. “You usually need to give a lot of details about what the target program does, and writing down these details can be as much work as just writing the code.”

“Bayou is a considerable improvement. A developer can give Bayou a very small amount of information – just a few keywords or prompts, really – and Bayou will try to read the programmer’s mind and predict the program they want.”

Many young developers learn about the necessity for precision in coding through the ‘sandwich analogy’; a programmer cannot command a computer to make them sandwich. Instead, they must specify every step and detail involved in sandwich construction. An application like Bayou would respond to a demand for a sandwich by suggesting the specific steps needed to make one, which the programmer can then copy into their code for sandwich construction.

Bayou was taught using millions of lines of code lifted from GitHub (the world’s largest host of source code) which it draws on to suggest its own code. It can be accessed online here.

It is based on ‘neural sketch learning’: an approach to machine learning whereby an artificial neural network – an algorithm approximately inspired by biological brains – are trained to recognise high-level patterns in datasets by creating ‘sketches’ for each set of data, and associating these with the aim of the dataset (in this case, the aim of a program).

When a programmer asks Bayou a question, it creates new ‘sketches’ for likely candidate programs based on the intent of the user.

According to the academics who built Bayou, the application could help programmers navigate the complex and growing collection of application programming interfaces (APIs). Bayou’s ability to generate code for specific software APIs is particularly relevant today, given that programmers very rarely build code from scratch.

“Modern software development is all about APIs,” said Vijay Murali, a research scientist at Rice University who was involved with the project. “These are system-specific rules, tools, definitions and protocols that allow a piece of code to interact with a specific operating system, database, hardware platform or another software system.”

“There are hundreds of APIs, and navigating them is very difficult for developers. They spend lots of time at question-answer sites like Stack Overflow asking other developers for help.”

Recent articles

Info Message

Our sites use cookies to support some functionality, and to collect anonymous user data.

Learn more about IET cookies and how to control them