Neural Sketch Learning for Conditional Program Generation

Vijayaraghavan Murali, Letao Qi, Swarat Chaudhuri, Chris Jermaine
3/16/2017
39 citations
cs.PLcs.LG

Official code: trishullab/bayou (279 stars, Java, Apache-2.0, last commit 2023-06-14).

Abstract

We study the problem of generating source code in a strongly typed, Java-like programming language, given a label (for example a set of API calls or types) carrying a small amount of information about the code that is desired. The generated programs are expected to respect a "realistic" relationship between programs and labels, as exemplified by a corpus of labeled programs available during training.

Show full abstract

Two challenges in such conditional program generation are that the generated programs must satisfy a rich set of syntactic and semantic constraints, and that source code contains many low-level features that impede learning. We address these problems by training a neural generator not on code but on program sketches, or models of program syntax that abstract out names and operations that do not generalize across programs. During generation, we infer a posterior distribution over sketches, then concretize samples from this distribution into type-safe programs using combinatorial techniques. We implement our ideas in a system for generating API-heavy Java code, and show that it can often predict the entire body of a method given just a few API calls or data types that appear in the method.

View on arXivView PDF

Code Implementations(1)

trishullab/bayouOfficial100%
Apache-2.0

System for synthesizing Java API idioms, powered by Neural Sketch Learning

27977Java, PythonMay 5, 20173 years agoApache-2.0
javamachine-learningsynthesis

Similar Papers

Cite this paper

@article{murali2017neural,
  title  = {Neural Sketch Learning for Conditional Program Generation},
  author = {Vijayaraghavan Murali and Letao Qi and Swarat Chaudhuri and Chris Jermaine},
  year   = {2017},
  eprint = {1703.05698},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1703.05698}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1703.05698.svg)](https://codeofpaper.com/paper/1703.05698)

Discussion