paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Static inference meets deep learning

静态推断遇上深度学习
ICSE Proceedings of the 44th International Conference on Software Engineering2022匹配度 5/10 · 论文将静态类型推断规则与深度学习预测结合,属于“AI→PL”中“用机器学习增强静态分析”的范畴,与用户关心的静态分析+ML 交叉方向在方法论上契合;但其采用的是较传统的深度学习模型而非 LLM/Agent,也不涉及 Agentic 程序、浮点分析或贝叶斯程序分析,任务本身是类型推断,未正中研究画像核心。引用 85 inbox
Yun Peng, Cuiyun Gao, Zongjie Li, Bowei Gao, David Lo, Qirun Zhang, Michael Lyu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 Hityper,通过类型依赖图将静态推断规则与深度学习预测结合,迭代完成动态语言类型推断。

针对 Python 等动态语言类型推断难题,静态推断能利用约束精确推断部分变量却难处理动态特性,深度学习不依赖特征但无法保证结果正确且依赖训练数据,二者互补。本文提出混合方法 Hityper:将每个函数内变量间的类型依赖编码为类型依赖图(TDG),在节点中集成类型推断规则执行静态推断,并用类型拒绝规则检验神经网络预测,迭代进行静态推断与 DL 预测直至 TDG 完成。在两个基准数据集上,Hityper 比先进 DL 模型多精确匹配 10% 的人工标注,稀有类型推断提升超过 30%;仅静态部分即比现有静态类型推断工具多推断 2~3 倍类型。它还在六个 GitHub 项目中修正七处错误人工标注,其中两处已获仓库所有者批准。

问题
动态语言(如 Python)的类型推断困难:静态推断能精确处理有足够静态约束的变量但难以处理动态特性,深度学习虽不依赖特征却无法保证预测类型正确且性能依赖训练数据质量。
方法
提出 Hityper,将每个函数内变量间的类型依赖编码为类型依赖图(TDG),在节点中集成静态类型推断规则与类型拒绝规则,迭代执行静态推断和深度学习预测直至 TDG 完成推断。
评估
在两个基准数据集上比较 Hityper 与先进深度学习模型及静态类型推断工具,并评估稀有类型推断、静态部分效果以及修正 GitHub 项目中错误人工标注的能力。
原文摘要(Abstract)

Type inference for dynamic programming languages such as Python is an important yet challenging task. Static type inference techniques can precisely infer variables with enough static constraints but are unable to handle variables with dynamic features. Deep learning (DL) based approaches are feature-agnostic, but they can-not guarantee the correctness of the predicted types. Their per-formance significantly depends on the quality of the training data (i.e., DL models perform poorly on some common types that rarely appear in the training dataset). It is interesting to note that the static and DL-based approaches offer complementary benefits. Un-fortunately, to our knowledge, precise type inference based on both static inference and neural predictions has not been exploited and remains an open challenge. In particular, it is hard to integrate DL models into the framework of rule-based static approaches. This paper fills the gap and proposes a hybrid type inference approach named Hityper based on both static inference and deep learning. Specifically, our key insight is to record type dependen-cies among variables in each function and encode the dependency information in type dependency graphs (TDGs). Based on TDGs, we can easily integrate type inference rules in the nodes to conduct static inference and type rejection rules to inspect the correctness of neural predictions. Hityper iteratively conducts static inference and DL-based prediction until the TDG is fully inferred. Experi-ments on two benchmark datasets show that Hityper outperforms state-of-the-art DL models by exactly matching 10% more human annotations. Hityper also achieves an increase of more than 30% on inferring rare types. Considering only the static part of Hityper, it infers 2× ~3× more types than existing static type inference tools. Moreover, Hityper successfully corrected seven wrong human an-notations in six GitHub projects, and two of them have already been approved by the repository owners.

链接与引用

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

BibTeX
@inproceedings{PengGLG0ZL22,
  title = {Static inference meets deep learning},
  author = {Yun Peng and Cuiyun Gao and Zongjie Li and Bowei Gao and David Lo and Qirun Zhang and Michael Lyu},
  booktitle = {ICSE},
  year = {2022},
  doi = {10.1145/3510003.3510038}
}