paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Automating Just-In-Time Python Type Annotation Updating

自动化即时 Python 类型标注更新
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 6/10 · 该论文属于“AI→PL”方向,即用 LLM 改进与静态分析密切相关的类型推断/类型标注任务,且问题驱动(指出旧标注与代码变更不一致的痛点)、有真实项目落地验证,与用户的若干偏好契合;但其主题是 Python 类型标注更新,未涉及用户核心关注的 Agentic 程序静态分析、浮点程序分析或贝叶斯程序分析,属于相关但非核心方向。引用 0 inbox
Zhipeng Xue, Zhipeng Gao, Xing Hu, Jingyuan Chen, Xin Xia, Shanping Li
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出基于 LLM 的 TypeUp,利用代码变更与旧标注即时更新 Python 类型标注,并显著优于 TypeGen。

Python 的动态类型易引发类型错误,类型标注可缓解该问题,但源码变更后标注常未同步,导致过时、不一致,影响理解并可能引入缺陷。论文提出“即时(JIT)类型标注更新”任务,并设计基于 LLM 的方法 TypeUp。它根据旧类型标注和对应代码变更生成新标注,通过激发 LLM 的知识与逻辑推理能力,并借鉴相似代码变更来指导更新。评估显示,在该任务上 TypeUp 比最先进的类型推断方法 TypeGen 高 41.9%。在真实项目应用中,25 个更新有 20 个获开发者确认,表明其实用价值。

问题
源码变更后 Python 类型标注常被忽略而变得过时、不一致,论文旨在自动、即时地更新这些标注。
方法
TypeUp 基于 LLM,利用旧标注与代码变更,通过提示激发知识与逻辑推理并学习相似变更,生成新类型标注。
评估
在类型标注更新任务上与 SOTA 类型推断方法 TypeGen 对比,效果提升 41.9%,并在真实项目中验证,25 个更新中 20 个被开发者确认。
原文摘要(Abstract)

Type annotations are more and more popular in Python projects to avoid type errors caused by Python’s dynamic typing feature. However, when developers change source code, these type annotations are often neglected or overlooked, resulting in outdated and inconsistent type annotations. Such obsolete type annotations can hinder program comprehension, mislead developers, and even introduce bugs in the future. Therefore, it is necessary to avoid and correct these inconsistent type annotations from the very beginning. In this work, we argue that obsolete type annotations can be reduced and even avoided by automatically updating type annotations alongside code changes. We refer to this task as “Just-In-Time (JIT) type annotation updating”. To solve this task, we propose a novel LLM-based approach named TypeUp (Type Annotation Updator) to automate this task. TypeUp can automatically generate new type annotations based on the old type annotations and corresponding code changes. Specifically, TypeUp guides LLM to perform type annotation updates by eliciting its knowledge and logical reasoning power and learning from similar code changes. The evaluation results show that TypeUp outperforms the state-of-the-art type inference approach (i.e., TypeGen) by 41.9% on our task. Moreover, we conducted a practical application with real-world software projects, 20 out of 25 type annotation updates generated by our approach have already been confirmed by developers, showing our approach’s practical value in real-world environments.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2607-09054,
  title = {Automating Just-In-Time Python Type Annotation Updating},
  author = {Zhipeng Xue and Zhipeng Gao and Xing Hu and Jingyuan Chen and Xin Xia and Shanping Li},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3764565}
}