TypeT5: Seq2seq Type Inference using Static Analysis
Not on the map. Why?
Abstract (arXiv)
There has been growing interest in automatically predicting missing type annotations in programs written in Python and JavaScript. While prior methods have achieved impressive accuracy when predicting the most common types, they often perform poorly on rare or complex types. In this paper, we present a new type inference method that treats type prediction as a code infilling task by leveraging CodeT5, a state-of-the-art seq2seq pre-trained language model for code. Our method uses static analysis to construct dynamic contexts for each code element whose type signature is to be predicted by the model. We also propose an iterative decoding scheme that incorporates previous type predictions in the model's input context, allowing information exchange between related code elements. Our evaluation shows that the proposed approach, TypeT5, not only achieves a higher overall accuracy (particularly on rare and complex types) but also produces more coherent results with fewer type errors -- while enabling easy user intervention.
Key facts. Cited by 12 papers in the map (data through 7 Oct 2026). Builds on 25 of its 42 references that are in the map. First posted on arXiv 16 Mar 2023.
Builds on
25 of 42 references.
References · 25
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,898
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
- 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,722
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2021Improving language models by retrieving from trillions of tokenscited by 1,278
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2015Scheduled Sampling for Sequence Prediction with Recurrent Neural Networkscited by 779
- 2017Reading Wikipedia to Answer Open-Domain Questionscited by 777
13 more
- 2020KILT: a Benchmark for Knowledge Intensive Language Taskscited by 571
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2020Autoregressive Entity Retrievalcited by 333
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 123
- 2020LambdaNet: Probabilistic Type Inference using Graph Neural Networkscited by 44
- 2019TypeWriter: Neural Type Prediction with Search-based Validationcited by 32
- 2020Learning to Update Natural Language Comments Based on Code Changescited by 30
- 2020Typilus: Neural Type Hintscited by 29
- 2021Type4Py: Practical Deep Similarity Learning-Based Type Inference for Pythoncited by 19
- 2020OptTyper: Probabilistic Type Inference by Optimising Logical and Natural Constraintscited by 14
- 2021Static Inference Meets Deep Learning: A Hybrid Type Inference Approach for Pythoncited by 12
- 2021ManyTypes4Py: A Benchmark Python Dataset for Machine Learning-based Type Inferencecited by 9
- 2022Cross-Domain Evaluation of a Deep Learning-Based Type Inference Systemcited by 1
Built on by
Citing papers per year: 2023: 3; 2024: 6; 2025: 3.
12 papers.
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
- 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 62
- 2023Bias Testing and Mitigation in LLM-based Code Generationcited by 53
- 2024EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimizationcited by 28
- 2024MHPP: Exploring the Capabilities and Limitations of Language Models Beyond Basic Code Generationcited by 25
- 2025EffiBench-X: A Multi-Language Benchmark for Measuring Efficiency of LLM-Generated Codecited by 24
- 2024EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuningcited by 15
- 2023Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editingcited by 9
- 2025Beyond the Prompt: An Empirical Study of Cursor Rulescited by 7
- 2024The Power of Types: Exploring the Impact of Type Checking on Neural Bug Detection in Dynamically Typed Languagescited by 1
- 2023Learning Type Inference for Enhanced Dataflow Analysiscited by 0
- 2025TypyBench: Evaluating LLM Type Inference for Untyped Python Repositoriescited by 0
- 2025Beyond the Prompt: An Empirical Study of Cursor Rules21 Dec 2025
- 2025TypyBench: Evaluating LLM Type Inference for Untyped Python Repositories28 Jul 2025
- 2025EffiBench-X: A Multi-Language Benchmark for Measuring Efficiency of LLM-Generated Code19 May 2025
- 2024The Power of Types: Exploring the Impact of Type Checking on Neural Bug Detection in Dynamically Typed Languages22 Nov 2024
- 2024EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuning14 Oct 2024
- 2024EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimization24 May 2024
- 2024MHPP: Exploring the Capabilities and Limitations of Language Models Beyond Basic Code Generation19 May 2024
- 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Code3 Feb 2024
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution5 Jan 2024
- 2023Learning Type Inference for Enhanced Dataflow Analysis1 Oct 2023
- 2023Bias Testing and Mitigation in LLM-based Code Generation3 Sep 2023
- 2023Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editing29 May 2023