论文标题

概率类型推理的高级基于图的深度学习

Advanced Graph-Based Deep Learning for Probabilistic Type Inference

论文作者

Ye, Fangke, Zhao, Jisheng, Sarkar, Vivek

论文摘要

诸如JavaScript和Python之类的动态键入语言已成为最受欢迎的编程语言。重要的好处可以从动态键入程序中的类型注释中产生。 TypeScript编程系统允许程序员指定部分键入程序,然后使用静态分析来推断其余类型来说明这种逐渐键入的方法。但是,通常,静态类型推理的有效性是有限的,取决于程序结构的复杂性和初始类型的注释。结果,对于新方法,有很大的动力可以在动态键入程序中静态预测类型,并且可以在交互式编程环境中使用可接受的性能。先前的工作证明了使用深度学习的概率类型推断的希望。在本文中,我们通过引入一系列图形神经网络(GNN)模型来推进过去的工作,这些模型在新颖的流程图(TFG)表示上运行。 TFG代表输入程序的元素作为与语法边缘和数据流动边缘连接的图节点,并且我们的GNN模型经过训练,以预测给定输入程序中TFG中的类型标签。我们在评估数据集中为GNN模型研究不同的GNN模型的不同设计选择,并表明我们最好的两种GNN配置的准确性达到了顶级1的精度,分别为87.76%和86.89%,超过了两种最封闭相关的深度学习类型的推断方法,与过去的高度精确度相关 - 与84.62%的顶级精确度相关,并具有最高的精度。 79.45%。此外,这两种配置的平均推理吞吐量为353.8和1,303.9文件/秒,而deepTyper的186.7文件/秒为1,050.3文件/秒/秒。

Dynamically typed languages such as JavaScript and Python have emerged as the most popular programming languages in use. Important benefits can accrue from including type annotations in dynamically typed programs. This approach to gradual typing is exemplified by the TypeScript programming system which allows programmers to specify partially typed programs, and then uses static analysis to infer the remaining types. However, in general, the effectiveness of static type inference is limited and depends on the complexity of the program's structure and the initial type annotations. As a result, there is a strong motivation for new approaches that can advance the state of the art in statically predicting types in dynamically typed programs, and that do so with acceptable performance for use in interactive programming environments. Previous work has demonstrated the promise of probabilistic type inference using deep learning. In this paper, we advance past work by introducing a range of graph neural network (GNN) models that operate on a novel type flow graph (TFG) representation. The TFG represents an input program's elements as graph nodes connected with syntax edges and data flow edges, and our GNN models are trained to predict the type labels in the TFG for a given input program. We study different design choices for our GNN models for the 100 most common types in our evaluation dataset, and show that our best two GNN configurations for accuracy achieve a top-1 accuracy of 87.76% and 86.89% respectively, outperforming the two most closely related deep learning type inference approaches from past work -- DeepTyper with a top-1 accuracy of 84.62% and LambdaNet with a top-1 accuracy of 79.45%. Further, the average inference throughputs of those two configurations are 353.8 and 1,303.9 files/second, compared to 186.7 files/second for DeepTyper and 1,050.3 files/second for LambdaNet.

扫码加入交流群

加入微信交流群

微信交流群二维码

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