Training deep neural network (DNN) models, which has become an important task in today's software development, is often costly in terms of computational resources and time. With the inspiration of software reuse, building DNN models through reusing existing ones has gained increasing attention recently. Prior approaches to DNN model reuse have two main limitations: 1) reusing the entire model, while only a small part of the model's functionalities (labels) are required, would cause much overhead (e.g., computational and time costs for inference), and 2) model reuse would inherit the defects and weaknesses of the reused model, and hence put the new system under threats of security attack. To solve the above problem, we propose SeaM, a tool that re-engineers a trained DNN model to improve its reusability. Specifically, given a target problem and a trained model, SeaM utilizes a gradient-based search method to search for the model's weights that are relevant to the target problem. The re-engineered model that only retains the relevant weights is then reused to solve the target problem. Evaluation results on widely-used models show that the re-engineered models produced by SeaM only contain 10.11% weights of the original models, resulting 42.41% reduction in terms of inference time. For the target problem, the re-engineered models even outperform the original models in classification accuracy by 5.85%. Moreover, reusing the re-engineered models inherits an average of 57% fewer defects than reusing the entire model. We believe our approach to reducing reuse overhead and defect inheritance is one important step forward for practical model reuse.
翻译:训练深度神经网络(DNN)模型已成为当今软件开发中的重要任务,但通常需要大量的计算资源和时间。随着软件重用的启发,最近通过重复使用现有模型来构建DNN模型已经引起了越来越多的关注。以前的DNN模型重用方法有两个主要局限性:1)使用整个模型,而只需要模型功能(标签)的一小部分,将导致令人费解的开销(例如,推断的计算和时间成本),2)重用模型将继承重用模型的缺陷和弱点,因此使新系统面临安全攻击威胁问题。为了解决上述问题,我们提出了一种名为SeaM的工具,该工具可以重新设计经过训练的DNN模型以提高其重用性。具体而言,给定目标问题和训练的模型,SeaM使用基于梯度的搜索方法搜索与目标问题相关的模型权重。然后重用仅保留相关权重的重新设计模型来解决目标问题。对广泛使用的模型进行的评估结果显示,SeaM生成的重新设计模型仅包含原始模型的10.11%的权重,从而推导时间减少了42.41%。对于目标问题,重新设计模型的分类准确度甚至比原始模型提高了5.85%。此外,将重新设计的模型重用可以减少平均57%的缺陷比完整模型重用更少的缺陷。我们认为我们的方法对于实现实际模型重用是向前迈出的一步。