Learning to Grow Pretrained Models for Efficient Transformer Training

Peihao Wang, Rameswar Panda, Lucas Torroba Hennigen, Philip Greengard, Leonid Karlinsky, Rogerio Feris, David Daniel Cox, Zhangyang Wang, Yoon Kim

TL;DR

The Linear Growth Operator (LiGO) is a novel framework that accelerates the training of large Transformer models by "growing" them from smaller, pretrained versions. By learning a structured linear mapping to initialize a large model’s weights from a smaller one, LiGO can save up to 50% of the computational cost (FLOPs) and wall-clock time without sacrificing downstream performance.

The Problem: Scaling from Scratch is Wasteful

In the current AI landscape, the standard paradigm is to scale up: we move from "Small" to "Base" to "Large" models to unlock better performance. However, the industry standard is to train each new, larger instance completely from scratch. This is incredibly wasteful because these larger models are often just wider or deeper versions of their predecessors, which already contain significant "implicit knowledge" in their parameters.

Existing "model growth" techniques—like stacking layers or copying neurons—are mostly heuristic-based and lack a data-driven learning component. The authors tackle the challenge of how to efficiently and mathematically map the knowledge of a small model into the architecture of a larger one to provide a "head start" for training.

The Solution: Linear Growth Operator (LiGO)

The core contribution is LiGO (Linear Growth Operator). The authors frame model initialization as a learning problem: find a linear map $M$ such that the large model's weights $\Theta^{(large)}$ are initialized as $M\Theta^{(small)}$.

Because a raw linear map between millions of parameters is computationally impossible to optimize, the authors introduce three key constraints:

  1. Depth-Width Decomposition: They factorize $M$ into two separate operators: $L_{depth}$ (to handle adding layers) and $R_{width}$ (to handle increasing the hidden dimension).
  2. Kronecker Factorization: To further reduce the number of parameters in $M$, they use Kronecker products. This allows the growth operator to "understand" architectural structure by grouping parameters by neurons and layers.
  3. Data-Driven Initialization: Before the main training begins, they run a very small number of optimization steps (typically just 100 steps of SGD) on a small subset of data to learn the optimal values for the growth operator $M$.
The LiGO framework factorizes the growth operator into depth and width expansions using Kronecker products.

Once $M$ is learned, the large model is initialized, and standard training proceeds. Interestingly, the authors prove that existing methods like StackBERT or Net2Net are actually just restricted, special cases of the LiGO framework.

Experimental Setup & Datasets

The authors evaluated LiGO across diverse domains to prove its universality:

  • Language Modeling: BERT and RoBERTa were trained on the English Wikipedia corpus, while GPT-2 was trained on the C4 dataset.
  • Vision: Vision Transformers (ViT, DeiT, and CaiT) were trained and evaluated on ImageNet-1K.
  • Downstream Evaluation: The models were fine-tuned on standard benchmarks including GLUE (General Language Understanding Evaluation), SQuAD (v1.1 and v2.0), and various image classification tasks like CIFAR-10/100 and Stanford Cars.

Key Insights and Ideas

  • Learning to Initialize: The most significant "aha moment" is that a tiny amount of learning (100 steps) on the initialization mapping provides a much better starting point than thousands of steps of random initialization.
  • Architectural Awareness: By using Kronecker factorization, the growth operator preserves the "functional" relationship between weights. It doesn't just copy numbers; it maps the relationships between neurons from the small space to the large space.
  • Flexibility: LiGO is "size-agnostic." You can grow a model from Small to Base, or even skip a step and grow from Small directly to Large. The paper shows that growing from a "Base" model to a "Large" model yields even higher savings than growing from a "Small" one, as there is more prior knowledge to leverage.
  • Compatibility: LiGO is orthogonal to other efficiency tricks. It can be combined with techniques like layer dropping or token dropping to stack even more savings.

Results: Faster Training, Same Performance

LiGO demonstrates significant savings across different architectures and modalities:

  • BERT-Base: LiGO saved 44.7% in FLOPs and 40.7% in wall-clock time compared to training from scratch, while achieving nearly identical GLUE scores.
  • GPT-2 Medium: Reusing a GPT-2 Base model saved 22.5% of the computational cost.
  • Vision Transformers: For DeiT-B, LiGO achieved a staggering 55.4% saving in FLOPs and 52% in GPU time. Remarkably, a LiGO-initialized DeiT-B starts training at ~72% accuracy on ImageNet, whereas a scratch model starts at near zero.
Training curves demonstrating LiGO's efficiency gains in FLOPs and wall-clock time compared to training from scratch and other baselines.

In almost all tests, the LiGO-trained models matched or slightly exceeded the final accuracy/perplexity of models trained from scratch for the full duration.

Limitations and Future Work

  • Scale Limits: While the authors tested models up to 1.5 billion parameters (GPT2-1.5B), they acknowledge that they did not have the compute resources to test on "Extreme Scale" models (100B+ parameters) like GPT-3 or PaLM.
  • Linearity Constraint: LiGO currently uses a linear mapping. The authors suggest that exploring non-linear growth operators could potentially capture even more complex relationships between model scales.
  • Architecture Search: The current work assumes the target architecture is predefined. A potential future direction is using LiGO to dynamically "grow" a model during training as part of a neural architecture search process.

Summary updated

BibTeX
@inproceedings{wang2023learning,
  author = {Peihao Wang and Rameswar Panda and Lucas Torroba Hennigen and Philip Greengard and Leonid Karlinsky and Rogerio Feris and David Daniel Cox and Zhangyang Wang and Yoon Kim},
  title = {{Learning to Grow Pretrained Models for Efficient Transformer Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=cDYRS5iZ16f},
}
Figure