论文标题

Lambdanet:使用图神经网络的概率推理

LambdaNet: Probabilistic Type Inference using Graph Neural Networks

论文作者

Wei, Jiayi, Goyal, Maruth, Durrett, Greg, Dillig, Isil

论文摘要

随着逐渐键入在Python和Typescript等语言中变得越来越流行,因此越来越需要自动推断出注释。虽然类型注释有助于执行诸如代码完成和静态错误捕获之类的任务,但这些注释不能由编译器完全确定,并且可以手工注释。本文提出了基于图神经网络的打字稿的概率类型推理方案。我们的方法首先使用轻型源代码分析来生成一个称为类型依赖关系图的程序抽象,该图形将类型变量与逻辑约束以及名称和使用信息链接在一起。鉴于此程序抽象,然后我们使用图形神经网络在相关类型变量之间传播信息,并最终做出类型预测。我们的神经体系结构可以预测培训期间未遇到的标准类型,例如数字或字符串,以及用户定义的类型。我们的实验结果表明,我们的方法在图书馆类型上优于该领域的先前工作$ 14 \%$(绝对),同时具有对现有技术不超出范围的类型预测的能力。

As gradual typing becomes increasingly popular in languages like Python and TypeScript, there is a growing need to infer type annotations automatically. While type annotations help with tasks like code completion and static error catching, these annotations cannot be fully determined by compilers and are tedious to annotate by hand. This paper proposes a probabilistic type inference scheme for TypeScript based on a graph neural network. Our approach first uses lightweight source code analysis to generate a program abstraction called a type dependency graph, which links type variables with logical constraints as well as name and usage information. Given this program abstraction, we then use a graph neural network to propagate information between related type variables and eventually make type predictions. Our neural architecture can predict both standard types, like number or string, as well as user-defined types that have not been encountered during training. Our experimental results show that our approach outperforms prior work in this space by $14\%$ (absolute) on library types, while having the ability to make type predictions that are out of scope for existing techniques.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源