Nowadays, software analytics tools using machine learning (ML) models to, for example, predict the risk of a code change are well established. However, as the goals of a project shift over time, and developers and their habits change, the performance of said models tends to degrade (drift) over time, until a model is retrained using new data. Current retraining practices typically are an afterthought (and hence costly), requiring a new model to be retrained from scratch on a large, updated data set at random points in time; also, there is no continuity between the old and new model. In this paper, we propose to use lifelong learning (LL) to continuously build and maintain ML-based software analytics tools using an incremental learner that progressively updates the old model using new data. To avoid so-called ''catastrophic forgetting'' of important older data points, we adopt a replay buffer of older data, which still allows us to drastically reduce the size of the overall training data set, and hence model training time. We empirically evaluate our LL approach on two industrial use cases, i.e., a brown build detector and a Just-in-Time risk prediction tool, showing how LL in practice manages to at least match traditional retraining-from-scratch performance in terms of F1-score, while using 3.3-13.7x less data at each update, thus considerably speeding up the model updating process. Considering both the computational effort of updates and the time between model updates, the LL setup needs 2-40x less computational effort than retraining-from-scratch setups.
翻译:如今,使用机器学习(ML)模型(例如预测代码变更风险)的软件分析工具已十分成熟。然而,随着项目目标随时间演变、开发人员及其习惯发生变化,这些模型的性能往往会随时间退化(漂移),直到使用新数据重新训练模型。当前的重新训练实践通常是一种事后补救(因而成本高昂),需要在随机时间点使用大规模更新数据集从头开始训练新模型;此外,新旧模型之间缺乏连续性。本文提出采用终身学习(LL)方法,通过增量学习器持续构建和维护基于ML的软件分析工具,该学习器使用新数据逐步更新旧模型。为避免对重要旧数据点的所谓"灾难性遗忘",我们采用旧数据重放缓冲区,这仍然能够大幅缩减整体训练数据集的大小,从而缩短模型训练时间。我们在两个工业用例上实证评估了LL方法,即Brown Build检测器和即时风险预测工具,展示了LL在实际中如何至少在F1分数上达到传统从头重新训练的性能,同时每次更新使用的数据量减少3.3-13.7倍,从而显著加速模型更新过程。综合考虑更新的计算开销和模型更新间隔时间,LL设置所需的计算开销比从头重新训练设置少2-40倍。