Empirical Study of Transformers for Source Code

Nadezhda Chirkova, Sergey Troshin
10/15/2020
cs.LGcs.CLcs.SE
transformer-attention

Official code: bayesgroup/code_transformers (67 stars, Python, PyTorch, last commit 2021-12-03).

Abstract

Initially developed for natural language processing (NLP), Transformers are now widely used for source code processing, due to the format similarity between source code and text. In contrast to natural language, source code is strictly structured, i.e., it follows the syntax of the programming language.

Show full abstract

Several recent works develop Transformer modifications for capturing syntactic information in source code. The drawback of these works is that they do not compare to each other and consider different tasks. In this work, we conduct a thorough empirical study of the capabilities of Transformers to utilize syntactic information in different tasks. We consider three tasks (code completion, function naming and bug fixing) and re-implement different syntax-capturing modifications in a unified framework. We show that Transformers are able to make meaningful predictions based purely on syntactic information and underline the best practices of taking the syntactic information into account for improving the performance of the model.

View on arXivView PDF

Code Implementations(1)

PyTorch

Empirical Study of Transformers for Source Code & A Simple Approach for Handling Out-of-Vocabulary Identifiers in Deep Learning for Source Code

6718Python, ShellMar 22, 20214 years agoNOASSERTION
code-completiondeep-learningfunction-namingpytorchvariable-misuse

Similar Papers

Cite this paper

@article{chirkova2020empirical,
  title  = {Empirical Study of Transformers for Source Code},
  author = {Nadezhda Chirkova and Sergey Troshin},
  year   = {2020},
  eprint = {2010.07987},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2010.07987}
}

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

Discussion