Accelerating Training of Transformer-Based Language Models with Progressive Layer Dropping

Minjia Zhang, Yuxiong He

TL;DR

Pre-training large Transformer language models like BERT is notoriously compute-heavy, but simply dropping layers during training (stochastic depth) typically causes model divergence or degraded accuracy. This paper introduces Progressive Layer Dropping (PLD)—combining Pre-Layer Normalization (PreLN) and a novel Switchable-Transformer block with a curriculum-based drop schedule—achieving a 24% wall-clock time reduction per sample and up to a 2.5× speedup to match baseline downstream GLUE performance, while even improving final downstream accuracy.

What Problem Does This Paper Address?

Pre-training state-of-the-art Transformer models requires immense compute resources. Standard acceleration methods rely on massive distributed clusters or custom hardware optimizations like mixed precision. A natural alternative to reduce floating-point operations (FLOPs) is stochastic depth—randomly skipping layers during training.

However, applying naive stochastic depth to Transformers destabilizes training, leading to divergence or bad local optima. The authors investigate why Transformers fail under stochastic depth and design a stable, drop-in training strategy that speeds up pre-training without degrading representation quality or downstream transferability.

Methods

The authors introduce Progressive Layer Dropping (PLD), which modifies both network architecture and the training schedule:

  1. Pre-Layer Normalization (PreLN) Reordering: Standard BERT applies LayerNorm after residual additions (PostLN), which suffers from vanishing gradients in lower layers. Moving LayerNorm to the input stream of each sub-layer (PreLN) establishes clean identity mapping shortcuts, preserving gradient norms across all layers.
  2. Switchable-Transformer (ST) Blocks: Each sub-layer (self-attention and feed-forward) is governed by a stochastic gate $G \sim \text{Bernoulli}(p)$. When dropped ($G=0$), computation is completely skipped in both forward and backward passes. When active ($G=1$), activations are scaled by $1/p$ to maintain expected magnitude.
  3. Temporal Progressive Schedule: Early in training, weights are randomly initialized and representations are unstable. PLD uses a curriculum schedule $\theta(t) = (1 - \bar{\theta})\exp(-\gamma t) + \bar{\theta}$, starting with no dropped layers ($\theta(0) = 1$) and exponentially transitioning toward a target keep probability $\bar{\theta}$ (e.g., $0.5$).
  4. Depth-Wise Drop Distribution: Lower layers learn foundational input features and exhibit high dissimilarity between layers, whereas upper layers perform iterative refinement. Therefore, drop probabilities are scaled linearly by layer depth: deeper layers are dropped more frequently than early layers.

At inference and fine-tuning, all blocks are restored to full depth with no architectural alterations.

       [ Input x_i ]
             │
      ┌──────┴──────┐
      │             ▼
      │        [ LayerNorm ]
      │             ▼
      │     [ Attention / FFN ]
      │             ▼
      │       [ Gate G * 1/p ] ─── (Skipped when G=0)
      │             │
      └──────►( + )◄┘
             │
      [ Output x_{i+1} ]

Datasets

  • Pre-training: A concatenated corpus of English Wikipedia and BookCorpus (~2.8 billion word tokens), tokenized using WordPiece with a 30,528-token vocabulary (matching standard BERT pre-training).
  • Downstream Evaluation: The GLUE (General Language Understanding Evaluation) benchmark, covering 9 natural language understanding tasks spanning sentiment classification, inference, and textual entailment (MNLI, QNLI, QQP, SST-2, CoLA, STS-B, MRPC, RTE).

Key Insights and Ideas

  • PostLN vs. PreLN Gradient Dynamics: PostLN gradient norms decay sharply toward lower layers, making it brittle to dropped connections. PreLN preserves near-constant gradient norms across layers and inputs, providing the stability needed for aggressive learning rates and stochastic sub-networks.
  • Transformers as Unrolled Iterative Refiners: Layer-to-layer cosine similarity reveals that as training progresses, higher layers in PreLN models refine existing representations rather than creating completely new feature spaces. Consequently, omitting deeper layers occasionally injects slight noise without corrupting subsequent representations.
  • Implicit Regularization via Ensembling: By dynamically sampling sub-networks during pre-training, PLD forces individual residual branches to learn useful representations independently. This acts as an ensembling regularizer, explaining why models pre-trained with PLD often outperform full-depth baselines on downstream tasks.

Key Results

  • Pre-training Efficiency:
  • Achieves a 24% wall-clock time reduction per sample on $64\times\text{V100}$ GPUs.
  • Reaches the baseline's final validation loss (1.75) at epoch 87 instead of epoch 186—a 53% reduction in training samples.
  • End-to-End Speedup: Reaches the baseline’s downstream GLUE performance 2.5× faster (15.56 hours vs. 39.15 hours).
  • Downstream Accuracy:
  • When trained for the same number of epochs (186), PLD achieves an average GLUE score of 83.2, outperforming the BERT baseline (82.1) and original BERT-base (80.7).
  • Checkpoint 100 of PLD already outperforms the baseline checkpoint 186 (82.3 vs. 82.1).
  • Stability: Unlike standard PostLN BERT—which diverged when scaling learning rates from $1\text{e-}4$ to $1\text{e-}3$—PLD trained stably at higher learning rates.

Limitations and Future Work

  • Minimum Keep Ratio Bounds: Training can diverge if the target keep ratio $\bar{\theta}$ is pushed too low (e.g., $\bar{\theta} \le 0.3$); effective retention needs to stay roughly within $0.5 \le \bar{\theta} \le 0.9$.
  • Full-Precision Requirements for Fixed Schedules: The authors noted that without the smooth temporal schedule, 16-bit mixed precision training encountered numerical instabilities (NaNs), requiring 32-bit fallback.
  • Scope of Architecture Exploration: Experiments focused on BERT-base (12 layers). While the authors suggest that the approach generalizes to autoregressive models (GPT-2/3) and larger configurations, these were not evaluated experimentally in the paper.

Summary updated

BibTeX
@inproceedings{zhang2020accelerating,
  author = {Minjia Zhang and Yuxiong He},
  title = {{Accelerating Training of Transformer-Based Language Models with Progressive Layer Dropping}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=VHmq7VqJoKQ},
}
Figure