Deep Learning Type Inference

被引:116
|
作者
Hellendoorn, Vincent J. [1 ]
Bird, Christian [2 ]
Barr, Earl T. [3 ]
Allamanis, Miltiadis [4 ]
机构
[1] Univ Calif Davis, Davis, CA 95616 USA
[2] Microsoft Res, Redmond, WA USA
[3] UCL, London, England
[4] Microsoft Res Cambridge, Cambridge, England
基金
美国国家科学基金会; 英国工程与自然科学研究理事会;
关键词
Type Inference; Deep Learning; Naturalness;
D O I
10.1145/3236024.3236051
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Dynamically typed languages such as JavaScript and Python are increasingly popular, yet static typing has not been totally eclipsed: Python now supports type annotations and languages like Type-Script offer a middle-ground for JavaScript: a strict superset of JavaScript, to which it transpiles, coupled with a type system that permits partially typed programs. However, static typing has a cost: adding annotations, reading the added syntax, and wrestling with the type system to fix type errors. Type inference can ease the transition to more statically typed code and unlock the benefits of richer compile-time information, but is limited in languages like JavaScript as it cannot soundly handle duck-typing or runtime evaluation via eval. We propose DEEPTYPER, a deep learning model that understands which types naturally occur in certain contexts and relations and can provide type suggestions, which can often be verified by the type checker, even if it could not infer the type initially. DEEPTYPER, leverages an automatically aligned corpus of tokens and types to accurately predict thousands of variable and function type annotations. Furthermore, we demonstrate that context is key in accurately assigning these types and introduce a technique to reduce overfitting on local cues while highlighting the need for further improvements. Finally, we show that our model can interact with a compiler to provide more than 4,000 additional type annotations with over 95% precision that could not be inferred without the aid of DEEPTYPER.
引用
收藏
页码:152 / 162
页数:11
相关论文
共 50 条
  • [11] Subspace Inference for Bayesian Deep Learning
    Izmailov, Pavel
    Maddox, Wesley J.
    Kirichenko, Polina
    Garipov, Timur
    Vetrov, Dmitry
    Wilson, Andrew Gordon
    35TH UNCERTAINTY IN ARTIFICIAL INTELLIGENCE CONFERENCE (UAI 2019), 2020, 115 : 1169 - 1179
  • [12] Collapsed Inference for Bayesian Deep Learning
    Zeng, Zhe
    Van den Broeck, Guy
    ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 36 (NEURIPS 2023), 2023,
  • [13] Deep type inference for mobile functions
    Gilmore, S
    TRENDS IN FUNCTIONAL PROGRAMMING, 2000, : 40 - 48
  • [14] Type4Py: Practical Deep Similarity Learning-Based Type Inference for Python
    Mir, Amir M.
    Latoškinas, Evaldas
    Proksch, Sebastian
    Gousios, Georgios
    arXiv, 2021,
  • [15] Cross-Domain Evaluation of a Deep Learning-Based Type Inference System
    Gruner, Bernd
    Sonnekalb, Tim
    Heinze, Thomas S.
    Brust, Clemens-Alexander
    2023 IEEE/ACM 20TH INTERNATIONAL CONFERENCE ON MINING SOFTWARE REPOSITORIES, MSR, 2023, : 158 - 169
  • [16] Type4Py: Practical Deep Similarity Learning-Based Type Inference for Python']Python
    Mir, Amir M.
    Latoskinas, Evaldas
    Proksch, Sebastian
    Gousios, Georgios
    2022 ACM/IEEE 44TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2022), 2022, : 2241 - 2252
  • [17] Deep reinforcement learning with significant multiplications inference
    Ivanov, Dmitry A.
    Larionov, Denis A.
    Kiselev, Mikhail V.
    Dylov, Dmitry V.
    SCIENTIFIC REPORTS, 2023, 13 (01)
  • [18] Prospective Interest of Deep Learning for Hydrological Inference
    Marcais, Jean
    de Dreuzy, Jean-Raynald
    GROUNDWATER, 2017, 55 (05) : 688 - 692
  • [19] Deep reinforcement learning with significant multiplications inference
    Dmitry A. Ivanov
    Denis A. Larionov
    Mikhail V. Kiselev
    Dmitry V. Dylov
    Scientific Reports, 13
  • [20] Towards Inference Efficient Deep Ensemble Learning
    Li, Ziyue
    Ren, Kan
    Yang, Yifan
    Jiang, Xinyang
    Yang, Yuqing
    Li, Dongsheng
    THIRTY-SEVENTH AAAI CONFERENCE ON ARTIFICIAL INTELLIGENCE, VOL 37 NO 7, 2023, : 8711 - 8719