UCL Discovery
UCL home » Library Services » Electronic resources » UCL Discovery

Typilus: Neural type hints

Allamanis, M; Barr, ET; Ducousso, S; Gao, Z; (2020) Typilus: Neural type hints. In: Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation. (pp. pp. 91-105). Association for Computing Machinery (ACM) Green open access

[thumbnail of typilus.pdf]
Preview
Text
typilus.pdf - Accepted Version

Download (1MB) | Preview

Abstract

Type inference over partial contexts in dynamically typed languages is challenging. In this work, we present a graph neural network model that predicts types by probabilistically reasoning over a program’s structure, names, and patterns. The network uses deep similarity learning to learn a TypeSpace — a continuous relaxation of the discrete space of types — and how to embed the type properties of a symbol (i.e. identifier) into it. Importantly, our model can employ one-shot learning to predict an open vocabulary of types, including rare and user-defined ones. We realise our approach in Typilus for Python that combines the TypeSpace with an optional type checker. We show that Typilus accurately predicts types. Typilus confidently predicts types for 70% of all annotatable symbols; when it predicts a type, that type optionally type checks 95% of the time. Typilus can also find incorrect type annotations; two important and popular open source libraries, fairseq and allennlp, accepted our pull requests that fixed the annotation errors Typilus discovered.

Type: Proceedings paper
Title: Typilus: Neural type hints
Event: The 41st ACM SIGPLAN Conference on Programming Language Design and Implementation
Location: London, UK
Dates: 15th-20th June 2020
ISBN-13: 978-1-4503-7613-6
Open access status: An open access version is available from UCL Discovery
DOI: 10.1145/3385412.3385997
Publisher version: https://doi.org/10.1145/3385412.3385997
Language: English
Additional information: This version is the author accepted manuscript. For information on re-use, please refer to the publisher's terms and conditions.
Keywords: type inference, structured learning, deep learning, graph neural networks, meta-learning
UCL classification: UCL
UCL > Provost and Vice Provost Offices > UCL BEAMS
UCL > Provost and Vice Provost Offices > UCL BEAMS > Faculty of Engineering Science
UCL > Provost and Vice Provost Offices > UCL BEAMS > Faculty of Engineering Science > Dept of Computer Science
URI: https://discovery.ucl.ac.uk/id/eprint/10107432
Downloads since deposit
315Downloads
Download activity - last month
Download activity - last 12 months
Downloads by country - last 12 months

Archive Staff Only

View Item View Item