paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Static Type Recommendation for Python

Python 静态类型推荐
ASE Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering2022匹配度 3/10 · 该论文属于静态程序分析与类型系统,但未涉及用户核心关注的LLM/Agent与静态分析交叉、浮点程序分析或贝叶斯程序分析,也未将静态分析应用于ML/Agentic程序。因此仅与PL领域泛泛相关,不匹配具体研究方向。引用 8 inbox
Ke Sun, Yifan Zhao, Dan Hao, Lu Zhang
crossref: 2026-09-12

AI 速览

一句话:提出静态类型推荐方法 Stray,为 Python 代码正确推荐类型注解,精度与召回率显著优于机器学习基线。

Python 支持可选类型注解以进行类型检查与程序文档说明,但开发者手工编写注解十分耗时。已有基于机器学习的类型推荐方法依赖代码特征,却存在推荐类型无法通过类型检查的正确性问题。本文提出静态类型推荐方法 Stray,能够正确推荐类型,从而缓解上述正确性问题。作者将 Stray 与四种当前先进的类型推荐方法进行比较,实验发现 Stray 在精度和召回率上均取得超过 30% 的绝对提升。

问题
手工为 Python 编写可选类型注解耗时,而现有机器学习类型推荐方法常推荐无法通过类型检查的类型。
方法
提出静态类型推荐方法 Stray,采用静态类型推荐思路来保证推荐类型的正确性。
评估
与四种当前先进的类型推荐方法进行对比,Stray 在精度和召回率上均取得超过 30% 的绝对提升。
原文摘要(Abstract)

Recently, Python has adopted optional type annotation to support type checking and program documentation. However, to enjoy the benefits, developers have to manually write type annotations, which is recognized to be a time-consuming task. To alleviate human efforts on manual type annotation, machine-learning-based approaches have been proposed to recommend types based on code features. However, they suffer from the correctness problem, i.e., the recommended types cannot pass type checking. To address the correctness problem of the machine-learning-based approaches, in this paper, we present a static type recommendation approach, named Stray. Stray can recommend types correctly. We evaluate Stray by comparing it against four state-of-art type recommendation approaches, and find that Stray outperforms these baselines by over 30% absolute improvement in both precision and recall.

链接与引用

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

BibTeX
@inproceedings{paperbot7327,
  title = {Static Type Recommendation for Python},
  author = {Ke Sun and Yifan Zhao and Dan Hao and Lu Zhang},
  booktitle = {ASE},
  year = {2022},
  doi = {10.1145/3551349.3561150}
}