arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2211.00683cs.LGcs.AI
收藏

减少、再利用、再循环:通过蒸馏提高培训效率

Reduce, Reuse, Recycle: Improving Training Efficiency with Distillation

Texas State University(德克萨斯州立大学);MosaicML(MosaicML公司);Brown University(布朗大学)

Cody Blakeney, Jessica Zosa Forde, Jonathan Frankle, Ziliang Zong, Matthew L. Leavitt

摘要:

提高深度网络训练效率的方法(即达到给定模型质量水平所需的资源)对深度学习实践者来说是直接有益的。蒸馏通常用于压缩模型或提高模型质量,但尚不清楚蒸馏是否真的提高了训练效率。蒸馏的质量改进是否可以转化为训练的加速,或者它们只是提高了最终模型的质量而没有节省资源?我们进行了一系列实验,以研究蒸馏是否以及如何使用ImageNet上训练的ResNet-50和C4上训练的BERT来加速训练,并使用通用企业硬件(8 x NVIDIA A100)进行GLUE评估。我们发现,在ImageNet上训练的ResNet-50中,蒸馏可以将训练速度提高1.96倍,在GLUE上评估时,在BERT上可以提高1.42倍。此外,BERT的蒸馏仅在训练的前20-50%执行时产生最佳结果。我们还观察到,在ResNet-50和BERT中,使用蒸馏的训练几乎总是比不使用蒸馏的训练更有效,即使使用质量最差的模型作为老师。最后,我们发现,通过在每个步骤上从教师模型池中随机抽样一个教师,可以从具有O(n)运行时成本的教师模型集合中获得提取的好处,这只有O(1)运行时成本。综上所述,这些结果表明,蒸馏可以大大提高图像分类和语言建模的训练效率,并且对蒸馏协议进行一些简单的优化可以进一步提高这些效率。

英文摘要:

Methods for improving the efficiency of deep network training (i.e. the resources required to achieve a given level of model quality) are of immediate benefit to deep learning practitioners. Distillation is typically used to compress models or improve model quality, but it's unclear if distillation actually improves training efficiency. Can the quality improvements of distillation be converted into training speed-ups, or do they simply increase final model quality with no resource savings? We conducted a series of experiments to investigate whether and how distillation can be used to accelerate training using ResNet-50 trained on ImageNet and BERT trained on C4 with a masked language modeling objective and evaluated on GLUE, using common enterprise hardware (8x NVIDIA A100). We found that distillation can speed up training by up to 1.96x in ResNet-50 trained on ImageNet and up to 1.42x on BERT when evaluated on GLUE. Furthermore, distillation for BERT yields optimal results when it is only performed for the first 20-50% of training. We also observed that training with distillation is almost always more efficient than training without distillation, even when using the poorest-quality model as a teacher, in both ResNet-50 and BERT. Finally, we found that it's possible to gain the benefit of distilling from an ensemble of teacher models, which has O(n) runtime cost, by randomly sampling a single teacher from the pool of teacher models on each step, which only has a O(1) runtime cost. Taken together, these results show that distillation can substantially improve training efficiency in both image classification and language modeling, and that a few simple optimizations to distillation protocols can further enhance these efficiency improvements.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑