Military-funded AI application can help programmers write code in response to keywords
A team of computer scientists from Rice University’s Intelligent Software Systems Laboratory has developed a deep learning tool that basically works like a search engine for coding. In other words, this new AI (Artificial Intelligence) tool helps programmers to write code snippets that contain Java application programming interfaces (APIs).
Called as Bayou, this deep learning software coding application has been developed with funding from the US Department of Defense’s Defense Advanced Research Projects Agency (DARPA) and Google. The paper on Bayou was presented on May 1 in Vancouver, British Columbia, at the Sixth International Conference on Learning Representations, a premier outlet for deep learning research. You can read the full paper here.
Bayou allows developers to enter a few keywords indicating what kind of program he or she wants to create. After entering the keywords, the software returns code in Java that will help the developers with their task.
“People have tried for 60 years to build systems that can write code, but the problem is that these methods aren’t that good with ambiguity,” says Bayou co-creator Swarat Chaudhuri, associate professor of computer science at Rice University. “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,” he says. “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.”
Chaudhuri says Bayou trained itself by studying millions of lines of human-written Java code from GitHub, which is almost the source code of about 1500 applications. “It’s basically studied everything on GitHub, and it draws on that to write its own code.”
Based on a method called neural sketch learning, Bayou trains an artificial neural network to recognize high-level patterns in hundreds of thousands of examples, Rice officials said. It does this by creating a “sketch” for each program it reads and then relating this sketch with the “intent” that lies behind the program.
The Java programs in the training data are marked with a label, which may contain information such as the set of API calls, library functions or the types used in the code and its metadata. When a user asks Bayou questions based on those labels, the system makes a judgment call about what program it’s being asked to write and then refers to its sketches to find the most likely matches.
“Based on that guess, a separate part of Bayou, a module that understands the low-level details of Java and can do automatic logical reasoning, is going to generate four or five different chunks of code,” said Chris Jermaine, Bayou co-creator and a professor of computer science who co-directs Rice’s Intelligent Software Systems Laboratory. “It’s going to present those to the user like hits on a web search. This one is most likely the correct answer, but here are three more that could be what you’re looking for.”
According to its website, the system can generate API idioms, or snippets of code that use APIs, in Java. Jermaine says Bayou is mainly useful for creating examples of code for specific software APIs.
“Programming today is very different than it was 30 or 40 years ago,” Jermaine added. “Computers today are in our pockets, on our wrists and in billions of home appliances, vehicles, and other devices. The days when a programmer could write code from scratch are long gone.”
The scientists think Bayou is a major improvement over previous attempts to build systems to write code. “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,” co-creator Swarat Chaudhuri said. “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.”
“Modern software development is all about APls,” Bayou architect Vijay Murali said. “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.”
Murali said developers can now ask BAYOU these questions and receive an immediate answer. “That immediate feedback could solve the problem right away, and if it doesn’t, Bayou’s example code should lead to a more informed question for their human peers,” Murali said.
Jermaine said the team’s primary goal is to get developers to try to extend Bayou, which has been released under a permissive open-source license. “The more information we have about what people want from a system like Bayou, the better we can make it,” Jermaine said. “We want as many people to use it as we can get.”
To learn more and try the system out, go to askbayou.com.