[论文解读] Train Large, Then Compress: Rethinking Model Size for Efficient Training and Inference of Transformers
该论文表明在训练非常大的 Transformer 模型并提前停止可以比训练小模型收敛更具计算效率,并且这类大模型在压缩后在量化/剪枝时能以相似推理成本获得更高的准确率。
Since hardware resources are limited, the objective of training deep learning models is typically to maximize accuracy subject to the time and memory constraints of training and inference. We study the impact of model size in this setting, focusing on Transformer models for NLP tasks that are limited by compute: self-supervised pretraining and high-resource machine translation. We first show that even though smaller Transformer models execute faster per iteration, wider and deeper models converge in significantly fewer steps. Moreover, this acceleration in convergence typically outpaces the additional computational overhead of using larger models. Therefore, the most compute-efficient training strategy is to counterintuitively train extremely large models but stop after a small number of iterations. This leads to an apparent trade-off between the training efficiency of large Transformer models and the inference efficiency of small Transformer models. However, we show that large models are more robust to compression techniques such as quantization and pruning than small models. Consequently, one can get the best of both worlds: heavily compressed, large models achieve higher accuracy than lightly compressed, small models.
研究动机与目标
- 调查 Transformer 模型大小在固定硬件和时间约束下对计算效率的影响。
- 评估较大的模型短时训练是否能在下游任务中超越收敛的小模型。
- 考察大型模型对量化和剪枝等压缩技术的鲁棒性。
- 分析在训练速度和推理效率之间,较大模型在何时以及为何提供更好的权衡。
提出的方法
- 系统地改变 RoBERTa 风格 MLM 预训练和 WMT14 En→Fr 翻译中的 Transformer 宽度和深度。
- 在不同模型规模下度量达到收敛所需的墙钟时间和梯度更新次数。
- 对经过微调的大模型进行事后压缩(量化和剪枝),并评估准确性与内存的关系。
- 将权重量化到不同的比特宽度,并对权重进行迭代剪枝以实现不同稀疏度,评估对下游任务的影响。
- 比较不同模型规模下的压缩影响,以确定大型模型的鲁棒性。
实验结果
研究问题
- RQ1在 MLM 预训练和 MT 任务中,增加 Transformer 尺寸是否能在墙钟时间和梯度更新次数方面加速收敛?
- RQ2相较于较小模型,在微调下游任务时,较大模型是否更容易通过量化和剪枝实现更高的压缩性?
- RQ3在固定推理预算下,训练更大模型与后续压缩之间在准确性方面的权衡如何?
- RQ4数据集规模和潜在的过拟合如何影响大型模型相对于小型模型的收益?
- RQ5为什么大型模型表现出更好的可压缩性,如何在实际中利用?
主要发现
- 较大模型在更少的梯度更新下收敛至更低的验证误差,考虑开销后在墙钟时间上也更快。
- 对于 MLM 和 MT,较大模型在每单位墙钟时间内收敛更快,增益超过了模型更大带来的开销。
- 相较于较小模型,较大模型对量化和剪枝更具鲁棒性,在压缩后在相似内存预算下获得更高的准确性。
- 对大型模型同时进行剪枝和量化可实现帕累托最优的准确性-效率权衡,尤其是在中等稀疏度周围进行剪枝后再进行低位量化时的表现突出。
- 最佳模型尺寸与数据集大小相关,在大数据场景下大模型表现良好且过拟合问题不那么突出。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。