arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1703.05698cs.PLcs.LG
收藏

用于条件程序生成的神经草图学习

Neural Sketch Learning for Conditional Program Generation

Rice University(莱斯大学)

Vijayaraghavan Murali, Letao Qi, Swarat Chaudhuri, Chris Jermaine

摘要:

我们研究了在强类型的、类似Java的程序设计语言中生成源代码的问题,给出了一个标签(例如一组API调用或类型),其中携带了有关所需代码的少量信息。所生成的程序被期望尊重程序和标签之间的“现实”关系,如在训练期间可用的标记程序的语料库所例示的。在这样的条件程序生成的两个挑战是,生成的程序必须满足一组丰富的语法和语义约束,源代码包含许多低层次的功能,阻碍学习。我们通过训练神经生成器来解决这些问题,而不是在代码上,而是在程序草图上,或者程序语法的模型上,这些模型抽象出了不能在程序中泛化的名称和操作。在生成过程中,我们推断后验分布的草图,然后具体化样本从这个分布到类型安全的程序使用组合技术。我们实现了我们的想法,在一个系统中生成API重Java代码,并表明,它往往可以预测整个身体的方法给出了几个API调用或数据类型出现在方法。

英文摘要:

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. 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑