arXiv:2508.05034cs.SEcs.LG2025-08被引 2

用机器学习预测代码变更依赖,提升开源项目开发效率

An ML-based Approach to Predicting Software Change Dependencies: Insights from an Empirical Study on OpenStack

  • 基于机器学习模型预测代码变更间的依赖关系
  • 依赖识别延迟超5小时,57小时平均耗时寻找依赖
  • 模型准确率高,适合大型分布式团队使用

随着软件系统复杂度上升,准确识别和管理变更依赖变得愈发关键。例如,调用某函数的变更必须依赖于该函数的引入变更。建立此类依赖关系可使CI/CD流水线有效构建和编排变更,避免构建失败与功能部署不全。在现代软件系统中,依赖常跨越多个组件及团队,带来开发与部署挑战。它们用于实现新功能、管理配置,甚至包括传统上独立的文档更新等变更。我们对大型开源系统OpenStack开展了初步研究,发现过去10年中超过一半(51.08%)的变更存在相互依赖。令人意外的是,这些依赖大多在代码审查阶段才被识别,平均延迟5.06小时;开发者平均花费57.12小时,在约463个其他变更中搜索依赖。为帮助开发者提前发现依赖,我们提出一种半自动化方法,包含两个机器学习模型:第一个预测变更间是否存在依赖,第二个识别具体的依赖对。所提模型表现良好,平均AUC分别为79.33%和91.89%,Brier得分分别为0.11和0.014。第二模型在所有类型依赖对上的top-k召回率较高,但精度仍有提升空间。

原文摘要 · Abstract (English)

As software systems grow in complexity, accurately identifying and managing dependencies among changes becomes increasingly critical. For instance, a change that leverages a function must depend on the change that introduces it. Establishing such dependencies allows CI/CD pipelines to build and orchestrate changes effectively, preventing build failures and incomplete feature deployments. In modern software systems, dependencies often span multiple components across teams, creating challenges for development and deployment. They serve various purposes, from enabling new features to managing configurations, and can even involve traditionally independent changes like documentation updates. To address these challenges, we conducted a preliminary study on dependency management in OpenStack, a large-scale software system. Our study revealed that a substantial portion of software changes in OpenStack over the past 10 years are interdependent. Surprisingly, 51.08% of these dependencies are identified during the code review phase-after a median delay of 5.06 hours-rather than at the time of change creation. Developers often spend a median of 57.12 hours identifying dependencies, searching among a median of 463 other changes. To help developers proactively identify dependencies, we propose a semi-automated approach that leverages two ML models. The first model predicts the likelihood of dependencies among changes, while the second identifies the exact pairs of dependent changes. Our proposed models demonstrate strong performance, achieving average AUC scores of 79.33% and 91.89%, and Brier scores of 0.11 and 0.014, respectively. Indeed, the second model has a good top-k recall across all types of pairs, while the top-k precision has room for improvement.

代码依赖机器学习DevOpsOpenStack

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。