{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/typet5-seq2seq-type-inference-using-static","title":"TypeT5: Seq2seq Type Inference using Static Analysis","arxiv_id":"2303.09564","date":"2023-03-16","proceeding":null,"authors":["Jiayi Wei","Greg Durrett","Isil Dillig"],"abstract":"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.","url_abs":"https://arxiv.org/abs/2303.09564v1","url_pdf":"https://arxiv.org/pdf/2303.09564v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"typet5-seq2seq-type-inference-using-static","repo_url":"https://github.com/utopia-group/typet5","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"type-prediction","task_name":"Type prediction"},{"task_slug":"type","task_name":"Vocal Bursts Type Prediction"}],"methods":[{"method_slug":"adafactor","method_name":"Adafactor"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"glu","method_name":"Gated Linear Unit"},{"method_slug":"inverse-square-root-schedule","method_name":"Inverse Square Root Schedule"},{"method_slug":"lstm","method_name":"LSTM"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sentencepiece","method_name":"SentencePiece"},{"method_slug":"seq2seq","method_name":"Seq2Seq"},{"method_slug":"sigmoid-activation","method_name":"Sigmoid Activation"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"t5","method_name":"T5"},{"method_slug":"tanh-activation","method_name":"Tanh Activation"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2303.09564","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.09564"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/utopia-group/typet5","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"unverified":7},"by_repo_kind":{"official":{"samples":7,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"6ba8079246a34897","entry":"dynamic_dataloader","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/model.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"6ba8079246a34897"}},{"code_sha256_prefix":"e6717dddf0d23b04","entry":"get_config","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/utils.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"e6717dddf0d23b04"}},{"code_sha256_prefix":"1650108633cf4fd4","entry":"get_dataset_dir","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/utils.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"1650108633cf4fd4"}},{"code_sha256_prefix":"2025e986eb5cbc67","entry":"get_gpu_id","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/utils.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"2025e986eb5cbc67"}},{"code_sha256_prefix":"15011ab85eff80c6","entry":"normalize_type_head","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/type_check.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/type_check.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"15011ab85eff80c6"}},{"code_sha256_prefix":"83883cff92651591","entry":"normalize_type_name","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/type_check.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/type_check.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"83883cff92651591"}},{"code_sha256_prefix":"ec70a4adfdbf766c","entry":"wrap_main_code","repo":"utopia-group/typet5","repo_kind":"official","path":"src/typet5/function_dataset.py","file_url":"https://github.com/utopia-group/typet5/blob/HEAD/src/typet5/function_dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"ec70a4adfdbf766c"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}