Skip to main content
QUICK REVIEW

[论文解读] bert2BERT: Towards Reusable Pretrained Language Models

Cheng Chen, Yichun Yin|arXiv (Cornell University)|Oct 14, 2021
Topic Modeling被引用 6
一句话总结

本文提出 bert2BERT,一种通过高级参数初始化和两阶段训练策略,复用小型预训练模型知识以加速大语言模型预训练的方法。通过使用小型模型的知识初始化大模型——具体而言采用高级知识初始化(AKI)和函数保持初始化(FPI)——该方法将 GPT 的预训练计算量减少最多 47%,BERT 的预训练计算量减少最多 45%,在多种架构中均展现出显著的效率提升。

ABSTRACT

In recent years, researchers tend to pre-train ever-larger language models to explore the upper limit of deep models. However, large language model pre-training costs intensive computational resources and most of the models are trained from scratch without reusing the existing pre-trained models, which is wasteful. In this paper, we propose bert2BERT, which can effectively transfer the knowledge of an existing smaller pre-trained model (e.g., BERT_BASE) to a large model (e.g., BERT_LARGE) through parameter initialization and significantly improve the pre-training efficiency of the large model. Specifically, we extend the previous function-preserving on Transformer-based language model, and further improve it by proposing advanced knowledge for large model's initialization. In addition, a two-stage pre-training method is proposed to further accelerate the training process. We did extensive experiments on representative PLMs (e.g., BERT and GPT) and demonstrate that (1) our method can save a significant amount of training cost compared with baselines including learning from scratch, StackBERT and MSLT; (2) our method is generic and applicable to different types of pre-trained models. In particular, bert2BERT saves about 45% and 47% computational cost of pre-training BERT_BASE and GPT_BASE by reusing the models of almost their half sizes. The source code will be publicly available upon publication.

研究动机与目标

  • 降低大规模语言模型预训练带来的高计算成本和碳足迹。
  • 探索通过复用已训练的小型模型知识而非从零开始训练,实现高效预训练。
  • 开发一种通用、与模型无关的方法,适用于 BERT 和 GPT 等多种基于 Transformer 的预训练模型。
  • 通过参数初始化和两阶段预训练策略提升训练效率。

提出的方法

  • 将 Chen 等人(2016)提出的函数保持初始化(FPI)扩展至基于 Transformer 的语言模型,确保大模型在初始化时的行为与小模型相似。
  • 提出高级知识初始化(AKI),通过复制并堆叠小型模型不同层的权重,以加速收敛,即使这轻微违反了函数保持原则。
  • 采用两阶段预训练策略,进一步加速优化过程,提升训练效率。
  • 使用较小的预训练模型(如 D=512 的 BERT BASE)通过参数复制与堆叠,初始化更大的目标模型(如 D=768 的 BERT LARGE)。
  • 将该方法应用于 BERT 和 GPT 架构,证明其在不同模型类型和归一化方案(如后归一化 vs. 前归一化)下的通用适用性。
  • 在初始化后的大模型上使用标准预训练目标(掩码语言建模和下一句预测),并微调超参数以实现更快收敛。

实验结果

研究问题

  • RQ1能否有效利用小型预训练模型的知识来初始化大模型,从而降低预训练成本?
  • RQ2高级知识初始化(AKI)是否在大模型预训练中比标准函数保持初始化更有效地加速收敛?
  • RQ3该方法在 BERT 和 GPT 等不同架构中,能在多大程度上降低计算成本?
  • RQ4该方法是否足够通用,可应用于多种预训练模型,包括采用不同归一化方案(如后归一化 vs. 前归一化)的模型?
  • RQ5与从初始化权重直接进行端到端训练相比,两阶段预训练策略如何提升训练效率?

主要发现

  • 当从大小约为一半的小型模型初始化时,bert2BERT 将 BERT BASE 的预训练计算成本降低 45%,GPT BASE 的预训练计算成本降低 47%。
  • 该方法在多种模型架构中均实现显著效率提升,包括 BERT(后归一化)和 GPT(前归一化),证明了其通用适用性。
  • 尽管轻微违反了函数保持原则,高级知识初始化(AKI)仍比标准函数保持初始化实现更快收敛。
  • 两阶段预训练策略进一步加速了训练过程,对整体效率提升有显著贡献。
  • 与 StackBERT 和 MSLT 等基线方法相比,该方法在降低计算成本方面表现更优,同时在下游任务上保持了具有竞争力的性能。
  • 实证结果表明,小型模型与大模型之间的注意力模式高度相似,验证了不同尺寸模型间知识迁移的可行性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。