Code Prediction by Feeding Trees to Transformers

Seohyun Kim, Jinman Zhao, Yuchi Tian, Satish Chandra
3/30/2020
cs.SEcs.LG
transformer-attention

Official code: facebookresearch/code-prediction-transformer (101 stars, Python, last commit 2022-06-03).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

This repo will contain replication package for the paper "Feeding Trees to Transformers for Code Completion"

10126PythonMar 23, 20204 years agoNOASSERTION

Similar Papers

Cite this paper

@article{kim2020code,
  title  = {Code Prediction by Feeding Trees to Transformers},
  author = {Seohyun Kim and Jinman Zhao and Yuchi Tian and Satish Chandra},
  year   = {2020},
  eprint = {2003.13848},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2003.13848}
}

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/2003.13848.svg)](https://codeofpaper.com/paper/2003.13848)

Discussion