Incremental pre-training from smaller language models

Han Zhang, Hui Wang, Ruifeng Xu2024

Abstract

Large language models have recently become a new learning paradigm and led to state-of-the-art performance across a range of tasks. As explosive open-source pre-trained models are available, it is worth investigating how to better utilize existing models. We propose a simple yet effective method, Incr-Pretrain, for incrementally pre-training language models from smaller well-trained source models. Different layer-wise transfer strategies were introduced for model augmentation including parameter copying, initial value padding, and model distillation. Experiments on multiple zero-shot learning tasks demonstrate satisfying inference performance upon transferring and promising training efficiency during continuing pre-training. Compared to training from scratch, Incr-Pretrain can save up to half the training time to get a similar testing loss.

Introduction

The "compute wall" remains the most significant barrier in modern artificial intelligence. Training a large language model (LLM) like GPT-3 requires massive computational resources and financial investment. While high-quality, open-source "small" models (e.g., BERT-base or GPT-2) are widely available, they are typically treated as static endpoints. When a larger model is required, researchers often start from scratch, discarding the thousands of compute hours already crystallized in smaller models' weights. Incr-Pretrain addresses this by investigating how to use the knowledge inside a small pre-trained model to jumpstart the training of a larger one.

Methodology

The Incr-Pretrain framework enables both widening (increasing hidden dimensions) and deepening (adding layers) of Transformer architectures through three primary strategies:

  1. Widening (Padding): To increase the width of linear layers, existing weights are copied, and new dimensions are "padded" with either zeros or small random values. Mathematical analysis suggests that padding with values from a distribution with very small variance allows the model output to remain nearly identical to the original.
  2. Deepening (Residual Trick): New layers are initialized with very small values. Due to the residual connection architecture ($Layer(x) + x$), these layers initially act as identity mappings, allowing signals from original layers to pass undisturbed while the new layers gradually learn.
  3. LayerNorm Distillation: Changing the hidden dimension ($H$) breaks the standard LayerNorm statistics. Since an exact analytical solution to map old LayerNorm parameters to new ones is intractable, the authors employ KL-divergence-based distillation. This trains new LayerNorm parameters on a small dataset to match the output distribution of the source model.
Overview of the Incr-Pretrain framework showing parameter transfer and supervision from source to target models.

Experimental Results

The researchers evaluated Incr-Pretrain across BERT and GPT architectures using datasets such as LAMA (for BERT) and LAMBADA, StoryCloze, and HellaSwag (for GPT-2).

Training Efficiency

A key finding is the significant reduction in training time. When transitioning from a "Small" GPT model to a "Medium" target, the method saved 51% of the training time required to reach the same loss as a model trained from scratch. Even when jumping from Small to Large, a 34% time saving was observed.

Training efficiency metrics comparing Incr-Pretrain (GPT-S/M/L) against training from scratch, showing steps and percentage of pre-training time saved (PPTS).

Zero-Shot Performance Recovery

Simple weight padding often leads to a massive drop in zero-shot performance due to LayerNorm mismatch. For instance, on the LAMA ConceptNet task, a padded BERT model's accuracy dropped from 26.00 to 15.24. However, applying LayerNorm distillation (Target-LN) recovered the accuracy to 22.66 immediately after transfer, providing a superior starting point for further pre-training.

Key Insights and Conclusion

  • LayerNorm is the Bottleneck: Proper handling of normalization layers is critical for maintaining performance during model growth.
  • Randomness over Zeros: While zero-padding is mathematically clean, padding with small random values ($\sigma = 0.02$) prevents the model from getting stuck in initialization symmetry, leading to faster convergence.
  • The Warm Start Advantage: Augmented models follow a steeper descent curve than from-scratch models, effectively inheriting the optimization trajectory of the source model.

Incr-Pretrain demonstrates that model training need not be a zero-sum game. By recycling the intelligence of smaller models, the community can develop larger, more capable AI systems with significantly reduced environmental and financial costs.

Summary updated

BibTeX
@misc{zhang2024incremental,
  author = {Han Zhang and Hui Wang and Ruifeng Xu},
  title = {{Incremental pre-training from smaller language models}},
  year = {2024},
  doi = {10.18653/v1/2024.sighan-1.5},
}
Figure