论文标题
相关变压器:生成带有相关反馈的简洁代码段
Relevance Transformer: Generating Concise Code Snippets with Relevance Feedback
论文作者
论文摘要
能够自动代码生成的工具有可能增强程序员的功能。虽然将直接的代码检索纳入了许多IDE,但新兴区域是明确的代码生成。当前,代码生成作为机器翻译任务,并具有基于反复的神经网络(RNN)的编码器架构架构,该体系在代码 - 描述对训练。在这项工作中,我们介绍并研究了该任务的现代变压器体系结构。我们进一步提出了一个称为“相关变压器”的新模型,该模型使用伪相关反馈结合了外部知识。相关性变压器使解码过程偏向于在执行多样性的同时类似于现有的检索代码。我们在多个标准基准数据集上进行代码生成的实验,包括Django,炉石和Conala。结果表明,基于BLEU评估的最先进方法的改进。相关性变压器模型显示了基于变压器的代码生成的架构的潜力,并引入了一种在推理过程中结合伪相关反馈的方法。
Tools capable of automatic code generation have the potential to augment programmer's capabilities. While straightforward code retrieval is incorporated into many IDEs, an emerging area is explicit code generation. Code generation is currently approached as a Machine Translation task, with Recurrent Neural Network (RNN) based encoder-decoder architectures trained on code-description pairs. In this work we introduce and study modern Transformer architectures for this task. We further propose a new model called the Relevance Transformer that incorporates external knowledge using pseudo-relevance feedback. The Relevance Transformer biases the decoding process to be similar to existing retrieved code while enforcing diversity. We perform experiments on multiple standard benchmark datasets for code generation including Django, Hearthstone, and CoNaLa. The results show improvements over state-of-the-art methods based on BLEU evaluation. The Relevance Transformer model shows the potential of Transformer-based architectures for code generation and introduces a method of incorporating pseudo-relevance feedback during inference.