What is Bayou?

Bayou is a system for generating API idioms – snippets of code that use APIs – in Java. Users can specify programming tasks within their code by issuing a query to Bayou about the kind of program that will likely solve the tasks. Bayou’s job is to use the user’s code and the query in order to generate the right program for the task.

Specifically, the input to Bayou consists of two parts:

  • A “draft program” in which the user can declare and initialize variables that are intended to be used in the programming task.
  • A “query” that conveys the intent of the programming task. Think of the query as hints or suggestions as to the nature of the task. Each term in the query can be of two kinds: (i) names of API methods that may be called in the programming task, (ii) types of variables that may be used in the programming task.

Bayou interprets this query using a novel method called Neural Sketch Learning. This method trains a new kind of neural network, called a Gaussian Encoder-Decoder, on a corpus of real-world open source code, and learns to associate queries about programming tasks with the shapes of solutions to these tasks. During program generation, the neural network is used to infer a probability distribution over programs that assigns higher weight to programs that, according to the learned model, are more likely to match the provided query. The output consists of the top-k most likely programs from this distribution.

Here a brief tutorial on how to use Bayou. For details on how Bayou works, read this paper.

Credits

Bayou was developed at the Department of Computer Science, Rice University, as part of the DARPA Pliny project (DARPA MUSE Award #FA8750-14-2-0270).