TypeWriter: Neural Type Prediction with Search-based Validation
Not on the map. Why?
Abstract (arXiv)
Maintaining large code bases written in dynamically typed languages, such as JavaScript or Python, can be challenging due to the absence of type annotations: simple data compatibility errors proliferate, IDE support is limited, and APIs are hard to comprehend. Recent work attempts to address those issues through either static type inference or probabilistic type prediction. Unfortunately, static type inference for dynamic languages is inherently limited, while probabilistic approaches suffer from imprecision. This paper presents TypeWriter, the first combination of probabilistic type prediction with search-based refinement of predicted types. TypeWriter's predictor learns to infer the return and argument types for functions from partially annotated code bases by combining the natural language properties of code with programming language-level information. To validate predicted types, TypeWriter invokes a gradual type checker with different combinations of the predicted types, while navigating the space of possible type combinations in a feedback-directed manner. We implement the TypeWriter approach for Python and evaluate it on two code corpora: a multi-million line code base at Facebook and a collection of 1,137 popular open-source projects. We show that TypeWriter's type predictor achieves an F1 score of 0.64 (0.79) in the top-1 (top-5) predictions for return types, and 0.57 (0.80) for argument types, which clearly outperforms prior type prediction models. By combining predictions with search-based validation, TypeWriter can fully annotate between 14% to 44% of the files in a randomly selected corpus, while ensuring type correctness. A comparison with a static type inference tool shows that TypeWriter adds many more non-trivial types. TypeWriter currently suggests types to developers at Facebook and several thousands of types have already been accepted with minimal changes.
Key facts. Cited by 32 papers in the map (data through 14 Oct 2026). First posted on arXiv 8 Dec 2019.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 6; 2022: 7; 2023: 10; 2024: 3; 2025: 4; 2026: 2.
32 papers.
Sort:
By area:
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023StarCoder: may the source be with you!cited by 799
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2023SantaCoder: don't reach for the stars!cited by 170
- 2022MultiPL-E: A Scalable and Extensible Approach to Benchmarking Neural Code Generationcited by 136
- 2024Can LLMs Replace Manual Annotation of Software Engineering Artifacts?cited by 42
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
- 2021Counterfactual Explanations for Models of Codecited by 25
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2021Type4Py: Practical Deep Similarity Learning-Based Type Inference for Pythoncited by 19
- 2023TypeT5: Seq2seq Type Inference using Static Analysiscited by 12
- 2022AutoPruner: Transformer-Based Call Graph Pruningcited by 11
20 more
- 2022CodeQueries: A Dataset of Semantic Queries over Codecited by 11
- 2024Studying LLM Performance on Closed- and Open-source Datacited by 11
- 2021ManyTypes4Py: A Benchmark Python Dataset for Machine Learning-based Type Inferencecited by 9
- 2023Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editingcited by 9
- 2023LExecutor: Learning-Guided Executioncited by 7
- 2023Type Prediction With Program Decomposition and Fill-in-the-Type Trainingcited by 6
- 2022NeuDep: Neural Binary Memory Dependence Analysiscited by 3
- 2021Cross-Lingual Transfer Learning for Statistical Type Inferencecited by 2
- 2025Treefix: Enabling Execution with a Tree of Prefixescited by 2
- 2026Doc2Spec: Synthesizing Formal Programming Specifications from Natural Language via Grammar Inductioncited by 2
- 2026AgenticTyper: Automated Typing of Legacy Software Projects Using Agentic AIcited by 2
- 2022Cross-Domain Evaluation of a Deep Learning-Based Type Inference Systemcited by 1
- 2025Call Me Maybe: Enhancing JavaScript Call Graph Construction using Graph Neural Networkscited by 1
- 2021Report of the Workshop on Program Synthesis for Scientific Computingcited by 0
- 2023Serenity: Library Based Python Code Analysis for Code Completion and Automated Machine Learningcited by 0
- 2023Learning Type Inference for Enhanced Dataflow Analysiscited by 0
- 2023DocGen: Generating Detailed Parameter Docstrings in Pythoncited by 0
- 2024Inferring Pluggable Types with Machine Learningcited by 0
- 2025TypyBench: Evaluating LLM Type Inference for Untyped Python Repositoriescited by 0
- 2025Automated Type Annotation in Python Using Large Language Modelscited by 0
- 2026AgenticTyper: Automated Typing of Legacy Software Projects Using Agentic AI21 Feb 2026
- 2026Doc2Spec: Synthesizing Formal Programming Specifications from Natural Language via Grammar Induction30 Jan 2026
- 2025Automated Type Annotation in Python Using Large Language Models1 Aug 2025
- 2025TypyBench: Evaluating LLM Type Inference for Untyped Python Repositories28 Jul 2025
- 2025Call Me Maybe: Enhancing JavaScript Call Graph Construction using Graph Neural Networks22 Jun 2025
- 2025Treefix: Enabling Execution with a Tree of Prefixes21 Jan 2025
- 2024Can LLMs Replace Manual Annotation of Software Engineering Artifacts?10 Aug 2024
- 2024Inferring Pluggable Types with Machine Learning21 Jun 2024
- 2024Studying LLM Performance on Closed- and Open-source Data23 Feb 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023DocGen: Generating Detailed Parameter Docstrings in Python11 Nov 2023
- 2023Learning Type Inference for Enhanced Dataflow Analysis1 Oct 2023
20 more
- 2023Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editing29 May 2023
- 2023Type Prediction With Program Decomposition and Fill-in-the-Type Training25 May 2023
- 2023StarCoder: may the source be with you!9 May 2023
- 2023TypeT5: Seq2seq Type Inference using Static Analysis16 Mar 2023
- 2023LExecutor: Learning-Guided Execution5 Feb 2023
- 2023SantaCoder: don't reach for the stars!9 Jan 2023
- 2023Serenity: Library Based Python Code Analysis for Code Completion and Automated Machine Learning5 Jan 2023
- 2022NeuDep: Neural Binary Memory Dependence Analysis4 Oct 2022
- 2022CodeQueries: A Dataset of Semantic Queries over Code17 Sep 2022
- 2022AutoPruner: Transformer-Based Call Graph Pruning7 Sep 2022
- 2022Cross-Domain Evaluation of a Deep Learning-Based Type Inference System19 Aug 2022
- 2022MultiPL-E: A Scalable and Extensible Approach to Benchmarking Neural Code Generation17 Aug 2022
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Code2 Jun 2022
- 2022InCoder: A Generative Model for Code Infilling and Synthesis12 Apr 2022
- 2021Counterfactual Explanations for Models of Code10 Nov 2021
- 2021Program Synthesis with Large Language Models16 Aug 2021
- 2021Cross-Lingual Transfer Learning for Statistical Type Inference1 Jul 2021
- 2021ManyTypes4Py: A Benchmark Python Dataset for Machine Learning-based Type Inference10 Apr 2021
- 2021Report of the Workshop on Program Synthesis for Scientific Computing2 Feb 2021
- 2021Type4Py: Practical Deep Similarity Learning-Based Type Inference for Python12 Jan 2021
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023StarCoder: may the source be with you!cited by 799
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2023SantaCoder: don't reach for the stars!cited by 170
- 2022MultiPL-E: A Scalable and Extensible Approach to Benchmarking Neural Code Generationcited by 136
- 2024Can LLMs Replace Manual Annotation of Software Engineering Artifacts?cited by 42
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
- 2021Counterfactual Explanations for Models of Codecited by 25
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2021Type4Py: Practical Deep Similarity Learning-Based Type Inference for Pythoncited by 19
- 2023TypeT5: Seq2seq Type Inference using Static Analysiscited by 12
- 2022AutoPruner: Transformer-Based Call Graph Pruningcited by 11
12 most cited of 31 All 31 (JSON)
- 2026Doc2Spec: Synthesizing Formal Programming Specifications from Natural Language via Grammar Induction30 Jan 2026
- 2025Automated Type Annotation in Python Using Large Language Models1 Aug 2025
- 2025TypyBench: Evaluating LLM Type Inference for Untyped Python Repositories28 Jul 2025
- 2025Call Me Maybe: Enhancing JavaScript Call Graph Construction using Graph Neural Networks22 Jun 2025
- 2025Treefix: Enabling Execution with a Tree of Prefixes21 Jan 2025
- 2024Can LLMs Replace Manual Annotation of Software Engineering Artifacts?10 Aug 2024
- 2024Inferring Pluggable Types with Machine Learning21 Jun 2024
- 2024Studying LLM Performance on Closed- and Open-source Data23 Feb 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023DocGen: Generating Detailed Parameter Docstrings in Python11 Nov 2023
- 2023Learning Type Inference for Enhanced Dataflow Analysis1 Oct 2023
- 2023Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editing29 May 2023
12 newest of 31 All 31 (JSON)