paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Deep learning type inference

深度学习类型推断
FSE Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2018匹配度 4/10 · 论文属于机器学习与程序语言的交叉,利用深度学习为 JavaScript 等动态语言做类型推断,与“AI→PL”方向有一定关联;但它不是基于 LLM/Agent 的方法,也未涉及静态分析/形式化验证、浮点程序分析或贝叶斯程序分析,因此不在当前研究画像的核心关注点上。引用 188 inbox
Vincent J. Hellendoorn, Christian Bird, Earl T. Barr, Miltiadis Allamanis
crossref: 2026-09-12

AI 速览

一句话:提出 DeepTyper,用深度学习结合编译器为 JavaScript 等动态语言预测并补充类型标注,准确率高。

针对 JavaScript/Python 等动态语言静态类型化成本高、传统类型推断难以可靠处理鸭子类型与 eval 的问题,本文提出 DeepTyper:一个基于深度学习的类型推断模型。它从自动对齐的 token 与类型语料中学习类型在特定上下文和关系中的自然分布,为变量和函数预测类型标注。作者发现上下文对准确赋值至关重要,并提出缓解对局部线索过拟合的技术。评估表明,DeepTyper 能预测数千个类型标注,并可同编译器交互,额外提供 4,000 多个初始无法推断的类型标注,精确率超过 95%。

问题
动态语言中静态类型标注成本高,且 JavaScript 等语言的类型推断无法健全处理鸭子类型和 eval,导致难以获得编译期类型信息。
方法
提出 DeepTyper 深度模型,利用自动对齐的 token-类型语料学习上下文与类型关系,并为变量/函数生成类型建议,同时设计减少局部线索过拟合的技术,且可与编译器交互验证。
评估
在自动对齐语料上预测数千个类型标注,并展示与编译器协作可新增 4,000 多个原先无法推断的标注,精确率超过 95%。
原文摘要(Abstract)

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 TypeScript 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.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot4572,
  title = {Deep learning type inference},
  author = {Vincent J. Hellendoorn and Christian Bird and Earl T. Barr and Miltiadis Allamanis},
  booktitle = {FSE},
  year = {2018},
  doi = {10.1145/3236024.3236051}
}