Learning Python Code Suggestion with a Sparse Pointer Network

By Avishkar Bhoopchand, Tim Rocktaschel, Earl T. Barr, Sebastian Riedel. 2016

90 citations recorded by the source corpus.

To enhance developer productivity, all modern integrated development environments (IDEs) include code suggestion functionality that proposes likely next tokens at the cursor. While current IDEs work well for statically-typed languages, their reliance on type annotations means that they do not provide the same level of support for dynamic programming languages as for statically-typed languages. Moreover, suggestion engines in modern IDEs do not propose expressions or multi-statement idiomatic code. Recent work has shown that language models can improve code suggestion systems by learning from software repositories. This paper introduces a neural language model with a sparse pointer network aimed at capturing very long range dependencies. We release a large-scale code suggestion corpus of 41M lines of Python code crawled from GitHub. On this corpus, we found standard neural language models to perform well at suggesting local phenomena, but struggle to refer to identifiers that are introduced many tokens in the past. By augmenting a neural language model with a pointer network specialized in referring to predefined classes of identifiers, we obtain a much lower perplexity and a 5 percentage points increase in accuracy for code suggestion compared to an LSTM baseline. In fact, this increase in code suggestion accuracy is due to a 13 times more accurate prediction of identifiers. Furthermore, a qualitative analysis shows this model indeed captures interesting long-range dependencies, like referring to a class member defined over 60 tokens in the past.

Subfields: Artificial Intelligence, Information Systems, Natural Language 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. Percy Liang
  2. Miltiadis Allamanis
  3. Quoc V. Le
  4. Luke S. Zettlemoyer
  5. Mohit Bansal
  6. Graham Neubig
  7. Charles Sutton
  8. Yoshua Bengio

In Information Systems

  1. Miltiadis Allamanis
  2. Charles Sutton
  3. Rishabh Singh
  4. Marc Brockschmidt
  5. Earl T. Barr
  6. Eran Yahav
  7. Uri Alon
  8. Daniel Tarlow

In Natural Language Processing

  1. Charles Sutton
  2. Miltiadis Allamanis
  3. Graham Neubig
  4. Guillaume Lample
  5. Luke S. Zettlemoyer
  6. Rishabh Singh
  7. Marc Brockschmidt
  8. Quoc V. Le

Citations in the corpus