LEMON: Lossless model expansion

Yite Wang, Jiahao Su, Hanlin Lu, Cong Xie, Tianyi Liu, Jianbo Yuan, Haibin Lin, Ruoyu Sun, Hongxia Yang

In the era of "Scaling Laws," the standard recipe for achieving better performance in deep learning is simply to make models bigger. However, the conventional practice is to train these larger models from scratch using random initialization. This approach is incredibly wasteful: if researchers already possess a perfectly capable "Small" model, discarding the compute spent training it just to start a "Large" model from zero is highly inefficient.

Comparison of training from scratch versus expanding a pretrained model with LEMON.

Existing "model expansion" techniques attempt to solve this inefficiency but face three major hurdles:

  1. Weight Symmetry: When neurons are duplicated to increase width, they often remain identical during training, effectively wasting the newly added capacity.
  2. Architecture Constraints: Many methods only work if the model size is exactly doubled or if specific structures (like "Pre-LayerNorm") are used.
  3. Initialization Loss: Most methods are "lossy," meaning the model's performance actually drops immediately after expansion before it starts improving again.

To tackle these inefficiencies, researchers have introduced LEMON (LosslEss MOdel ExpansioN), a new framework that allows pre-trained models to be scaled up into larger architectures without losing any of their original knowledge.

The LEMON Approach: Lossless Expansion

LEMON introduces a suite of algorithms to perform true lossless expansion, ensuring that at the very first moment of expansion, the large model's output is mathematically identical to the small model's output.

  • Symmetry Breaking: To increase width, LEMON replicates neurons but sets their "fan-out" (output) weights to be unequal (e.g., using weights $\alpha$ and $\beta$ where $\alpha + \beta = 1$ but $\alpha \neq \beta$). This crucial step prevents the newly added neurons from getting stuck in a redundant state.
Illustration of neuron replication and symmetry breaking in LEMON to prevent redundant capacity.
  • Handling Indivisible Widths: Unlike previous methods that require strictly doubling the hidden dimension (e.g., from 512 to 1024), LEMON can handle any arbitrary increment (e.g., 512 to 768) by using an "average expansion" technique for LayerNorm layers.
  • Lossless Depth: To add layers, LEMON uses two strategies: either zeroing out the weights of new layers or specifying weights so that replicated neurons cancel each other out initially, effectively acting as an identity mapping.

The Learning Rate Paradox

A common intuition in deep learning is that a pre-trained model needs a "gentle" (low) learning rate to avoid destroying its existing weights. LEMON reveals the opposite: an expanded model needs the same high maximum learning rate as a model trained from scratch to ensure good generalization. The key difference is that it needs the learning rate to decay much faster. Because the model starts near a local optimum thanks to the lossless initialization, it reaches peak performance in a fraction of the time.

Furthermore, LEMON is highly versatile. It is one of the first expansion methods compatible with Post-LN, Pre-LN, and Res-Post-Norm architectures, making it applicable to almost any modern Transformer variant.

Empirical Results

The authors validated LEMON across several standard benchmarks, including ImageNet-1k for Vision Transformers (ViT) and English Wikipedia/GLUE for BERT models.

  • Vision Transformers (ViT): LEMON reached the target accuracy of a ViT-Base model in just 130 epochs, compared to the 300 epochs required when training from scratch. This represents a massive 56.7% reduction in compute.
  • BERT: For language modeling, LEMON achieved a 33.2% saving in training iterations.
  • Downstream Superiority: BERT models expanded via LEMON actually outperformed models trained from scratch on the GLUE benchmark, suggesting that inheriting knowledge provides a fundamentally better starting point for fine-tuning.

LEMON consistently outperformed baseline expansion methods like bert2BERT and Knowledge Inheritance (KI), which often struggled to recover the performance of a scratch-trained model within the same shortened time frame.

Limitations and Future Work

While LEMON significantly reduces training time, it introduces the need to decide how much to shorten the training schedule (e.g., choosing 130 vs. 150 epochs). Finding the optimal shortened schedule still requires some empirical tuning. Additionally, the current experiments were conducted on "Base" sized models (around 100M parameters); its effectiveness on "Large" or "Huge" models with billions of parameters remains to be fully explored. Finally, the "free parameters" used to break symmetry are currently chosen randomly, leaving room for future work to discover more optimal initialization strategies for these new dimensions.

Summary updated

BibTeX
@inproceedings{wang2024lemon,
  author = {Yite Wang and Jiahao Su and Hanlin Lu and Cong Xie and Tianyi Liu and Jianbo Yuan and Haibin Lin and Ruoyu Sun and Hongxia Yang},
  title = {{LEMON: Lossless model expansion}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=3Vw7DQqq7U},
}
Figure