AutoFreeze:自动冻结模型块以加速微调
AutoFreeze: Automatically Freezing Model Blocks to Accelerate Fine-tuning
摘要:
随着机器学习(ML)的快速采用,许多领域现在使用微调模型的方法,这些模型是在大型数据库上预先训练的。然而,我们的实验表明,即使使用GPU等现代加速器,即使对BERT等模型进行微调也需要花费数小时。虽然先前的工作提出限制微调的层的数量,例如,冻结除最后一层之外的所有层,我们发现这种静态方法导致精度降低。我们提出了AutoFreeze系统,该系统使用自适应方法来选择训练哪些层,并展示了如何在保持准确性的同时加速模型微调。我们还开发了机制,使有效的缓存中间激活,可以减少执行微调时的向前计算时间。我们扩展AutoFreeze执行分布式微调和设计两种执行模式,以最大限度地减少成本和运行时间。我们对10个NLP任务的评估表明,启用缓存的AutoFreeze可以将单个GPU上的微调提高高达2.55倍。在64 GPU的集群上,为了对AG的新闻数据集进行微调,AutoFreeze在优化端到端训练时间时能够实现高达4.38倍的加速,在优化效率时能够将总成本降低5.03倍,而不会影响模型的准确性。
英文摘要:
With the rapid adoption of machine learning (ML), a number of domains now use the approach of fine tuning models which were pre-trained on a large corpus of data. However, our experiments show that even fine-tuning on models like BERT can take many hours even when using modern accelerators like GPUs. While prior work proposes limiting the number of layers that are fine-tuned, e.g., freezing all layers but the last layer, we find that such static approaches lead to reduced accuracy. We propose, AutoFreeze, a system that uses an adaptive approach to choose which layers are trained and show how this can accelerate model fine-tuning while preserving accuracy. We also develop mechanisms to enable efficient caching of intermediate activations which can reduce the forward computation time when performing fine-tuning. We extend AutoFreeze to perform distributed fine-tuning and design two execution modes that minimize cost and running time respectively. Our evaluation on ten NLP tasks shows that AutoFreeze, with caching enabled, can improve fine-tuning on a single GPU by up to 2.55x. On a 64 GPU cluster, for fine-tuning on the AG's news dataset, AutoFreeze is able to achieve up to 4.38x speedup when optimizing for end-to-end training time and 5.03x reduction in total cost when optimizing for efficiency, without affecting model accuracy.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。