paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Statistical Type Inference for Incomplete Programs

不完整程序的统计类型推断
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 5/10 · 论文属于机器学习与程序分析交叉,针对不完整程序的类型推断,与“AI→PL”方向有交集,但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,也不是面向 ML 系统/Agentic 程序的静态分析。引用 4 inbox
Yaohui Peng, Jing Xie, Qiongling Yang, Hanwen Guo, Qingan Li, Jingling Xue, Mengting Yuan
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出两阶段方法 Stir,用神经网络预测 token 类型标签并还原复杂类型,将类型推断转化为序列到图解析问题。

论文关注不完整程序的类型推断问题:这类程序可能语法不完整,整体程序的语法分析往往失败,现有方法难以处理。作者提出两阶段方法 Stir。第一阶段用神经网络为每个 token 预测类型标签,从而推断程序中的所有简单类型;第二阶段对预测为复杂类型的 token 进一步细化,利用类型图表示复杂类型。与以往把类型推断视为分类问题的机器学习方法不同,Stir 将其归结为序列到图的解析问题(sequence-to-graph parsing)。实验表明,Stir 在简单类型上达到 97.37% 的准确率;将复杂类型表示为有向图(类型图)后,在复杂类型和零样本复杂类型上分别取得 77.36% 和 59.61% 的类型相似度得分。

问题
不完整或语法不完整的程序无法通过整体程序的语法分析来推断类型,而这类代码在开发与补全场景中很常见。
方法
Stir 分两阶段:先用神经网络为每个 token 预测类型标签以推断简单类型,再对复杂类型标签的 token 细化复杂类型,并采用序列到图解析而非分类来建模类型推断。
评估
在类型推断任务上评估,简单类型准确率达 97.37%,复杂类型与零样本复杂类型的类型相似度分别为 77.36% 和 59.61%。
原文摘要(Abstract)

We propose a novel two-stage approach, Stir, for inferring types in incomplete programs that may be ill-formed, where whole-program syntactic analysis often fails. In the first stage, Stir predicts a type tag for each token by using neural networks, and consequently, infers all the simple types in the program. In the second stage, Stir refines the complex types for the tokens with predicted complex type tags. Unlike existing machine-learning-based approaches, which solve type inference as a classification problem, Stir reduces it to a sequence-to-graph parsing problem. According to our experimental results, Stir achieves an accuracy of 97.37 % for simple types. By representing complex types as directed graphs (type graphs), Stir achieves a type similarity score of 77.36 % and 59.61 % for complex types and zero-shot complex types, respectively.

链接与引用

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

BibTeX
@inproceedings{PengXYGLXY23,
  title = {Statistical Type Inference for Incomplete Programs},
  author = {Yaohui Peng and Jing Xie and Qiongling Yang and Hanwen Guo and Qingan Li and Jingling Xue and Mengting Yuan},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3616283}
}