paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Nalin

Nalin:自动检测名称-值不一致
ICSE Proceedings of the 44th International Conference on Software Engineering2022匹配度 3/10 · 该论文将神经网络分类器与动态分析结合用于检测 Python 变量名与运行时值不一致,属于 PL 与机器学习交叉,但并非用户核心关注的静态分析、LLM/Agent 改进程序分析、浮点程序分析或贝叶斯程序分析。其研究目标也不是 LLM/Agent,因此与研究方向仅有较弱的边缘关联。引用 29 inbox
Jibesh Patra, Michael Pradel
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 Nalin,结合动态分析与神经网络分类器,自动检测 Python 程序中变量名与运行时值不一致的问题。

变量名与运行时值不一致会损害代码可理解性或导致意外行为。Nalin 将追踪值到变量名赋值的动态分析与神经网络模型结合,判断名称与值是否匹配,从而把发现此类编码问题形式化为对名称和运行时值的分类问题。作者在 106,652 个真实 Python 程序上评估,发现分类器能高准确率检测名称-值不一致;相对用户研究构建的 ground truth,警告精确率 80%、召回率 76%,并可补充现有编码问题检测技术。

问题
变量名与运行时值不匹配会造成名称-值不一致,既有误导性命名影响可维护性,也可能隐藏错误;自动发现这类问题需要理解名称语义并掌握运行时值。
方法
Nalin 结合动态分析记录变量赋值与值,并用神经机器学习模型预测名称和值是否匹配,将问题建模为分类任务。
评估
在 106,652 个真实 Python 程序上应用,基于用户研究 ground truth 评估,警告精确率 80%、召回率 76%,并显示与现有技术互补。
原文摘要(Abstract)

Variable names are important to understand and maintain code. If a variable name and the value stored in the variable do not match, then the program suffers from a name-value inconsistency, which is due to one of two situations that developers may want to fix: Either a correct value is referred to through a misleading name, which negatively affects code understandability and maintainability, or the correct name is bound to a wrong value, which may cause unexpected runtime behavior. Finding name-value inconsistencies is hard because it requires an understanding of the meaning of names and knowledge about the values assigned to a variable at runtime. This paper presents Nalin, a technique to automatically detect name-value inconsistencies. The approach combines a dynamic analysis that tracks assignments of values to names with a neural machine learning model that predicts whether a name and a value fit together. To the best of our knowledge, this is the first work to formulate the problem of finding coding issues as a classification problem over names and runtime values. We apply Nalin to 106,652 real-world Python programs, where meaningful names are particularly important due to the absence of statically declared types. Our results show that the classifier detects name-value inconsistencies with high accuracy, that the warnings reported by Nalin have a precision of 80% and a recall of 76% w.r.t. a ground truth created in a user study, and that our approach complements existing techniques for finding coding issues.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2112-06186,
  title = {Nalin},
  author = {Jibesh Patra and Michael Pradel},
  booktitle = {ICSE},
  year = {2022},
  doi = {10.1145/3510003.3510144}
}