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

将树馈入 Transformer 进行代码预测

Code Prediction by Feeding Trees to Transformers

Facebook Inc.(脸书公司);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Columbia University(哥伦比亚大学)

Seohyun Kim, Jinman Zhao, Yuchi Tian, Satish Chandra

AI总结:

本文提出让 Transformer 感知代码句法树结构以提升代码下一个 token 预测准确率,并在标准及 Facebook 内部 Python 数据集上显著超越 RNN、Deep3 与 Code2Seq。

摘要:

我们提升了自动补全系统中代码预测(下一个 token 预测)准确率的最新水平。首先,我们报告称,即使直接使用最近提出的 Transformer 架构,其表现也优于此前用于代码预测的神经与非神经系统。随后,我们表明,通过让 Transformer 架构感知代码的句法结构,可进一步扩大基于 Transformer 的系统相对此前系统的优势。由此,该系统的准确率比基于 RNN 的系统(类似于 Hellendoorn 等人 2018 年的系统)高 18.3%,比 Deep3 系统(Raychev 等人,2016)高 14.1%,比为代码预测改编的 Code2Seq(Alon 等人,2018)高 14.4%。我们在论文中提出了若干将代码结构传递给 Transformer 的方法,而 Transformer 从根本上是为处理序列数据而构建的。我们在一个标准 Python 数据集以及一个 Facebook 内部 Python 语料库上,对所提方案及替代设计选择进行了全面实验评估。我们的代码和数据准备流程将以开源形式提供。

英文摘要:

We advance the state-of-the-art in the accuracy of code prediction (next token prediction) used in autocomplete systems. First, we report that using the recently proposed Transformer architecture even out-of-the-box outperforms previous neural and non-neural systems for code prediction. We then show that by making the Transformer architecture aware of the syntactic structure of code, we further increase the margin by which a Transformer-based system outperforms previous systems. With this, it outperforms the accuracy of an RNN-based system (similar to Hellendoorn et al. 2018) by 18.3%, the Deep3 system (Raychev et al 2016) by 14.1%, and an adaptation of Code2Seq (Alon et al., 2018) for code prediction by 14.4%. We present in the paper several ways of communicating the code structure to the Transformer, which is fundamentally built for processing sequence data. We provide a comprehensive experimental evaluation of our proposal, along with alternative design choices, on a standard Python dataset, as well as on a Facebook internal Python corpus. Our code and data preparation pipeline will be available in open source.

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

↑