一句话:大规模实证研究揭示 Python 机器学习系统中代码变更与软件质量的关系,提出工具 PyQu 并给出 61 类质量提升变更。
随着生成式 AI 辅助代码生成与 Python 机器学习系统(MLS)的普及,软件质量成为关注焦点,但现有研究多停留在“有哪些代码变更”,缺乏对变更与质量之间关系的理解,也缺少质量评估工具。本文对 3,340 个开源 Python ML 项目、370 万余次提交和 2.7 万亿行代码开展大规模实证研究,提出 PyQu 工具,利用底层软件度量识别能提升质量的提交,平均准确率与精确率、召回率均为 0.84,平均 F1 为 0.85。结合主题分析,作者识别出 61 种对质量有直接提升作用的代码变更,并按上下文特征归为 13 类;其中 41% 为本文新发现,未被当前最先进的 Python 变更检测工具识别。
In an era shaped by Generative Artificial Intelligence for code generation and the rising adoption of Python-based Machine Learning systems (MLS), software quality has emerged as a major concern. As these systems grow in complexity and importance, a key obstacle lies in understanding exactly how specific code changes affect overall quality—a shortfall aggravated by the lack of quality assessment tools and a clear mapping between ML systems code changes and their quality effects. Although prior work has explored code changes in MLS, it mostly stops at what the changes are, leaving a gap in our knowledge of the relationship between code changes and the MLS quality. To address this gap, we conducted a large-scale empirical study of 3,340 open-source Python ML projects, encompassing more than 3.7 million commits and 2.7 trillion lines of code. We introduce PyQu, a novel tool that leverages low-level software metrics to identify quality-enhancing commits with an average accuracy, precision, and recall of 0.84 and 0.85 of average F1 score. Using PyQu and a thematic analysis, we identified 61 code changes, each demonstrating a direct impact on enhancing software quality, and we classified them into 13 categories based on contextual characteristics. 41% of the changes are newly discovered by our study and have not been identified by state-of-the-art Python changes detection tools. Our work offers a vital foundation for researchers, practitioners, educators, and tool developers, advancing the quest for automated quality assessment and best practices in Python-based ML software.
@inproceedings{abs-2511-02827,
title = {From Code Changes to Quality Gains: An Empirical Study in Python ML Systems with PyQu},
author = {Mohamed Almukhtar and Anwar Ghammam and Marouane Kessentini and Hua Ming},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3773258}
}