OptTyper: Probabilistic Type Inference by Optimising Logical and Natural Constraints

By Irene Vlassi Pandi, Earl T. Barr, A. Gordon, Charles Sutton. 2020

33 citations recorded by the source corpus.

We present a new approach to the type inference problem for dynamic languages. Our goal is to combine logical constraints, that is, deterministic information from a type system, with natural constraints, that is, uncertain statistical information about types learnt from sources like identifier names. To this end, we introduce a framework for probabilistic type inference that combines logic and learning: logical constraints on the types are extracted from the program, and deep learning is applied to predict types from surface-level code properties that are statistically associated, such as variable names. The foremost insight of our method is to constrain the predictions from the learning procedure to respect the logical constraints, which we achieve by relaxing the logical inference problem of type prediction into a continuous optimisation problem. As proof of concept, we build a tool called OptTyper to predict missing types for TypeScript files. OptTyper combines a continuous interpretation of logical constraints derived by a simple program transformation and static analysis of TypeScript code, with natural constraints obtained from a deep learning model, which learns naming conventions for types from a large codebase. By evaluating OptTyper, we show that the combination of logical and natural constraints yields a large improvement in performance over either kind of information individually and achieves a 3% improvement over the state-of-the-art.

Subfields: Artificial Intelligence, Information Systems, Information Systems and Management, Evaluation & Benchmarks, Program Analysis & Verification

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. Quoc V. Le
  2. Sergey Levine
  3. Percy Liang
  4. Mohit Bansal
  5. Yoshua Bengio
  6. Graham Neubig
  7. Luke S. Zettlemoyer
  8. Joseph E. Gonzalez

In Information Systems

  1. Charles Sutton
  2. Prem Devanbu
  3. Anand Ashok Sawant
  4. Kevin Jesse
  5. Georgios Gousios
  6. Carrie J. Cai
  7. Augustus Odena
  8. Joseph E. Gonzalez

In Information Systems and Management

  1. Charles Sutton
  2. Carrie J. Cai
  3. Georgios Gousios
  4. Ion Stoica
  5. Augustus Odena
  6. Quoc V. Le
  7. Vladimir Filkov
  8. Paul Ralph

In Evaluation & Benchmarks

  1. Georgios Gousios
  2. Prem Devanbu
  3. Ajay Jain
  4. Pieter Abbeel
  5. Sebastian Proksch
  6. Tianjun Zhang
  7. Paras Jain
  8. Ion Stoica

In Program Analysis & Verification

  1. Prem Devanbu
  2. Anand Ashok Sawant
  3. Kevin Jesse
  4. Amir M. Mir
  5. Sebastian Proksch
  6. Evaldas Latoskinas
  7. Georgios Gousios
  8. Augustus Odena

Citations in the corpus