Deep learning type inference

By Vincent J. Hellendoorn, Christian Bird, Earl T. Barr, Miltiadis Allamanis. 2018

222 citations recorded by the source corpus.

Dynamically typed languages such as JavaScript and Python are increasingly popular, yet static typing has not been totally eclipsed: Python now supports type annotations and languages like TypeScript offer a middle-ground for JavaScript: a strict superset of JavaScript, to which it transpiles, coupled with a type system that permits partially typed programs. However, static typing has a cost: adding annotations, reading the added syntax, and wrestling with the type system to fix type errors. Type inference can ease the transition to more statically typed code and unlock the benefits of richer compile-time information, but is limited in languages like JavaScript as it cannot soundly handle duck-typing or runtime evaluation via eval. We propose DeepTyper, a deep learning model that understands which types naturally occur in certain contexts and relations and can provide type suggestions, which can often be verified by the type checker, even if it could not infer the type initially. DeepTyper, leverages an automatically aligned corpus of tokens and types to accurately predict thousands of variable and function type annotations. Furthermore, we demonstrate that context is key in accurately assigning these types and introduce a technique to reduce overfitting on local cues while highlighting the need for further improvements. Finally, we show that our model can interact with a compiler to provide more than 4,000 additional type annotations with over 95% precision that could not be inferred without the aid of DeepTyper.

Subfields: Information Systems, Software, Natural Language Processing, 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 Information Systems

  1. Charles Sutton
  2. Miltiadis Allamanis
  3. Prem Devanbu
  4. Michael Pradel
  5. Arjun Guha
  6. Earl T. Barr
  7. Georgios Gousios
  8. Rishabh Singh

In Software

  1. Charles Sutton
  2. Michael Pradel
  3. Miltiadis Allamanis
  4. Rishabh Singh
  5. Earl T. Barr
  6. Georgios Gousios
  7. Prem Devanbu
  8. Vincent J. Hellendoorn

In Natural Language Processing

  1. Charles Sutton
  2. Luke S. Zettlemoyer
  3. Miltiadis Allamanis
  4. Prem Devanbu
  5. Michael Pradel
  6. Percy Liang
  7. Omer Levy
  8. Graham Neubig

In Signal Processing

  1. Prem Devanbu
  2. Kevin Jesse
  3. Georgios Gousios
  4. Arjun Guha
  5. Toufique Ahmed
  6. Michael Pradel
  7. Charles Sutton
  8. Ming-Ho Yee

Citations in the corpus