Skip to main content
QUICK REVIEW

[论文解读] Learning to Grow Pretrained Models for Efficient Transformer Training

Peihao Wang, Rameswar Panda|arXiv (Cornell University)|Mar 2, 2023
Domain Adaptation and Few-Shot LearningComputer Science被引用 13
一句话总结

LiGO 学习一个结构化线性增长算子,用于从较小的预训练模型初始化更大的 Transformer 模型,在语言和视觉领域保持性能的同时,将训练 FLOPs 降至最多约 50%。

ABSTRACT

Scaling transformers has led to significant breakthroughs in many domains, leading to a paradigm in which larger versions of existing models are trained and released on a periodic basis. New instances of such models are typically trained completely from scratch, despite the fact that they are often just scaled-up versions of their smaller counterparts. How can we use the implicit knowledge in the parameters of smaller, extant models to enable faster training of newer, larger models? This paper describes an approach for accelerating transformer training by learning to grow pretrained transformers, where we learn to linearly map the parameters of the smaller model to initialize the larger model. For tractable learning, we factorize the linear transformation as a composition of (linear) width- and depth-growth operators, and further employ a Kronecker factorization of these growth operators to encode architectural knowledge. Extensive experiments across both language and vision transformers demonstrate that our learned Linear Growth Operator (LiGO) can save up to 50% computational cost of training from scratch, while also consistently outperforming strong baselines that also reuse smaller pretrained models to initialize larger models.

研究动机与目标

  • 通过利用较小的预训练模型中的隐式知识,在扩展 Transformer 时激励减少计算资源的浪费。
  • 提出一种可学习的、结构化的增长机制,用以从较小模型初始化更大的模型。
  • 展示在语言和视觉 Transformer 上的跨领域有效性并验证迁移性能。

提出的方法

  • 将从小模型到大模型的权重迁移表述为线性映射:Theta_large = M(Theta_small)。
  • 将 M 分解为深度增长和宽度增长算子:M = L_depth R_width,以分别处理层深度和维度的扩张。
  • 用 Kronecker 乘积对 R_width 和 L_depth 进行因式分解,以编码架构结构并显著减少参数数量。
  • 将增长矩阵在变换器组件(嵌入、Q/K/V/O、FFN)之间耦合,以保持对齐和残差连接。
  • 用很少的步数进行优化(例如 100 次 SGD 步)来学习 M,然后用 M(vec(Theta_small)) 初始化大模型并按常规进行训练。
  • 证明现有的增长方法(StackBERT、Interpolation、Net2Net)是 LiGO 的特例。

实验结果

研究问题

  • RQ1与从头训练和现有增长方法相比,LiGO 可以实现多少培训效率(FLOPs 和实际耗时)?
  • RQ2LiGO 是否在语言和视觉 Transformer 以及不同模型规模上都能持续提高效率?
  • RQ3用 LiGO 初始化的模型在迁移到下游任务后,是否能保持可比的下游性能?
  • RQ4LiGO 如何与结构化矩阵(Kronecker 分解)以及 Monarch 矩阵相关并在表达能力上得以利用?

主要发现

  • LiGO 在语言和视觉 Transformer 上实现显著的训练效率提升,报告的 FLOPs 最高可节省约 50%。
  • 在 BERT-Base 与 BERT-Small 的对比中,LiGO 相较于从头训练约节省 44.7% 的 FLOPs,且实际耗时降低 40% 以上。
  • LiGO 通过重用 GPT2-Base 对 GPT2-Medium 节省 22.5% FLOPs,且在视觉 Transformer 中 DeiT-S 到 DeiT-B 节省 55% FLOPs。
  • LiGO 可以重用较小或中等规模的预训练模型来初始化更大的模型,当使用知识更丰富的较小模型时,节省越多。
  • 下游任务(GLUE、SQuAD、图像分类)的迁移性能与从头训练基线相当或非常接近。
  • LiGO 将 StackBERT、Interpolation 和 Net2Net 作为特例,其 Kronecker 因子化的宽度/深度算子与 Monarch 矩阵对齐,能够用少量学习参数实现高效学习。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。