Retrieval-Based Neural Code Generation

Retrieval-Based Neural Code Generation
复制标题

DOI:
10.18653/v1/d18-1111
复制
发表时间:
2018-08
期刊:
ArXiv
影响因子:
--
通讯作者:
Shirley Anugrah Hayati;R. Olivier;Pravalika Avvaru;Pengcheng Yin;A. Tomasic;Graham Neubig
Shirley Anugrah Hayati;R. Olivier;Pravalika Avvaru;Pengcheng Yin;A. Tomasic;Graham Neubig
中科院分区:
其他
文献类型:
--
作者:
Shirley Anugrah Hayati;R. Olivier;Pravalika Avvaru;Pengcheng Yin;A. Tomasic;Graham Neubig

文献摘要

被引文献

相似文献

在从自然语言中生成程序源代码的模型中,在树结构中代表此代码是一种常见方法。但是,由于缺乏记忆大型和复杂结构的能力,现有方法通常无法正确生成复杂的代码。我们介绍了Recode,这是一种基于子树检索的方法,可以在神经代码生成模型中明确引用现有代码示例。首先,我们使用基于动态编程的句子相似性评分方法检索类似于输入句子的句子。接下来,我们提取构建关联的抽象语法树的动作序列的N克。最后,我们增加了导致检索到的n-gram动作子树处于预测代码中的操作的概率。我们表明,我们的方法将两个代码生成任务的性能提高了+2.6 BLEU。
In models to generate program source code from natural language, representing this code in a tree structure has been a common approach. However, existing methods often fail to generate complex code correctly due to a lack of ability to memorize large and complex structures. We introduce RECODE, a method based on subtree retrieval that makes it possible to explicitly reference existing code examples within a neural code generation model. First, we retrieve sentences that are similar to input sentences using a dynamic-programming-based sentence similarity scoring method. Next, we extract n-grams of action sequences that build the associated abstract syntax tree. Finally, we increase the probability of actions that cause the retrieved n-gram action subtree to be in the predicted code. We show that our approach improves the performance on two code generation tasks by up to +2.6 BLEU.