On Learning Meaningful Code Changes Via Neural Machine Translation

By Michele Tufano, Jevgenija Pantiuchina, Cody Watson, Gabriele Bavota, Denys Poshyvanyk. 2019

249 citations recorded by the source corpus.

Recent years have seen the rise of Deep Learning (DL) techniques applied to source code. Researchers have exploited DL to automate several development and maintenance tasks, such as writing commit messages, generating comments and detecting vulnerabilities among others. One of the long lasting dreams of applying DL to source code is the possibility to automate non-trivial coding activities. While some steps in this direction have been taken (e.g., learning how to fix bugs), there is still a glaring lack of empirical evidence on the types of code changes that can be learned and automatically applied by DL. Our goal is to make this first important step by quantitatively and qualitatively investigating the ability of a Neural Machine Translation (NMT) model to learn how to automatically apply code changes implemented by developers during pull requests. We train and experiment with the NMT model on a set of 236k pairs of code components before and after the implementation of the changes provided in the pull requests. We show that, when applied in a narrow enough context (i.e., small/medium-sized pairs of methods before/after the pull request changes), NMT can automatically replicate the changes implemented by developers during pull requests in up to 36% of the cases. Moreover, our qualitative analysis shows that the model is capable of learning and replicating a wide variety of meaningful code changes, especially refactorings and bug-fixing activities. Our results pave the way for novel research in the area of DL on code, such as the automatic learning and applications of refactoring.

Subfields: Artificial Intelligence, Information Systems, Machine Translation, Code Generation & Program Synthesis, Signal Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Charles Sutton
  2. Rafael-Michael Karampatsis
  3. Romain Robbes
  4. Hlib Babii
  5. Andrea Janes
  6. Miltiadis Allamanis
  7. Georgios Gousios
  8. Michael Pradel

In Information Systems

  1. Charles Sutton
  2. Michael Pradel
  3. Rafael-Michael Karampatsis
  4. Miltiadis Allamanis
  5. Georgios Gousios
  6. Tien Nhut Nguyen
  7. Romain Robbes
  8. Hlib Babii

In Machine Translation

  1. Baishakhi Ray
  2. Saikat Chakraborty

In Code Generation & Program Synthesis

  1. Michael Pradel
  2. Charles Sutton
  3. Koushik Sen
  4. Miltiadis Allamanis
  5. Rafael-Michael Karampatsis
  6. Romain Robbes
  7. Hlib Babii
  8. Andrea Janes

In Signal Processing

  1. Michael Pradel
  2. Charles Sutton
  3. Koushik Sen
  4. Rafael-Michael Karampatsis
  5. Baishakhi Ray
  6. Miltiadis Allamanis
  7. Georgios Gousios
  8. Saikat Chakraborty

Citations in the corpus