PLLGMLApr 29, 2020

LambdaNet: Probabilistic Type Inference using Graph Neural Networks

arXiv:2005.02161v1119 citations
AI Analysis

This addresses the need for efficient type inference in programming languages to aid tasks like code completion and error detection, representing a strong specific gain in this domain.

The paper tackles the problem of automatically inferring type annotations in gradually typed languages like TypeScript, which are tedious to annotate manually, by proposing a probabilistic type inference scheme using a graph neural network that outperforms prior work by 14% on library types and handles user-defined types not seen during training.

As gradual typing becomes increasingly popular in languages like Python and TypeScript, there is a growing need to infer type annotations automatically. While type annotations help with tasks like code completion and static error catching, these annotations cannot be fully determined by compilers and are tedious to annotate by hand. This paper proposes a probabilistic type inference scheme for TypeScript based on a graph neural network. Our approach first uses lightweight source code analysis to generate a program abstraction called a type dependency graph, which links type variables with logical constraints as well as name and usage information. Given this program abstraction, we then use a graph neural network to propagate information between related type variables and eventually make type predictions. Our neural architecture can predict both standard types, like number or string, as well as user-defined types that have not been encountered during training. Our experimental results show that our approach outperforms prior work in this space by $14\%$ (absolute) on library types, while having the ability to make type predictions that are out of scope for existing techniques.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes