Skip to main content
QUICK REVIEW

[Paper Review] On the Effect of Dropping Layers of Pre-trained Transformer Models

Hassan Sajjad, Fahim Dalvi|arXiv (Cornell University)|Apr 8, 2020
Topic ModelingComputer Science8 citations
TL;DR

This paper proposes a method to drop layers from pre-trained Transformer models (BERT, RoBERTa, XLNet, ALBERT, DistilBERT) to achieve efficient transfer learning without retraining. By systematically pruning top, bottom, middle, or alternate layers, the authors achieve up to 40% model size reduction while preserving up to 98.2% of original performance on GLUE tasks, matching knowledge distillation results without fine-tuning or training a new model.

ABSTRACT

Transformer-based NLP models are trained using hundreds of millions or even billions of parameters, limiting their applicability in computationally constrained environments. While the number of parameters generally correlates with performance, it is not clear whether the entire network is required for a downstream task. Motivated by the recent work on pruning and distilling pre-trained models, we explore strategies to drop layers in pre-trained models, and observe the effect of pruning on downstream GLUE tasks. We were able to prune BERT, RoBERTa and XLNet models up to 40%, while maintaining up to 98% of their original performance. Additionally we show that our pruned models are on par with those built using knowledge distillation, both in terms of size and performance. Our experiments yield interesting observations such as, (i) the lower layers are most critical to maintain downstream task performance, (ii) some tasks such as paraphrase detection and sentence similarity are more robust to the dropping of layers, and (iii) models trained using a different objective function exhibit different learning patterns and w.r.t the layer dropping.

Motivation & Objective

  • To investigate whether all layers in pre-trained Transformer models are necessary for downstream NLP tasks.
  • To identify which layers are most critical for maintaining performance after pruning.
  • To develop efficient, retraining-free strategies for reducing model size while preserving performance.
  • To compare the effectiveness of layer dropping against knowledge distillation and other compression techniques.
  • To analyze how different pre-training objectives (auto-encoding vs. auto-regressive) affect layer importance and learning dynamics.

Proposed method

  • The authors evaluate multiple layer-dropping strategies: removing top, bottom, middle, or alternating layers from pre-trained models.
  • They use activation patterns and weight statistics to identify and remove the least contributing layers.
  • The method is applied to BERT, RoBERTa, XLNet, ALBERT, and DistilBERT, with fine-tuning only on the remaining layers.
  • Performance is evaluated on the GLUE benchmark across multiple NLP tasks including SST-2, MNLI, QNLI, QQP, and STS-B.
  • The approach is compared against knowledge distillation and other pruning methods, including greedy layer pruning (GLP) and LayerDrop.
  • The authors also test fine-tuning the pruned model after layer removal to assess if task-specific adaptation improves performance.

Experimental results

Research questions

  • RQ1Can significant model compression be achieved by dropping layers from pre-trained Transformers without retraining?
  • RQ2Which layers—top, bottom, middle, or alternating—are most critical for maintaining downstream task performance?
  • RQ3How does the performance of pruned models compare to knowledge distillation-based models in terms of accuracy, size, and inference speed?
  • RQ4Do different pre-training objectives (e.g., auto-encoding vs. auto-regressive) lead to different layer importance patterns and learning dynamics?
  • RQ5Can distilled models like DistilBERT be further pruned, and what performance trade-offs are involved?

Key findings

  • Up to 40% of the layers can be dropped from BERT, RoBERTa, and XLNet while maintaining up to 98.2% of the original performance on GLUE tasks.
  • Pruning top layers consistently preserves performance across models and tasks, outperforming or matching models trained with LayerDrop and greedy pruning.
  • The lower layers are most critical for downstream task performance, with some tasks requiring only 3 of 12 layers to stay within 1% of original performance.
  • Pruned models perform on par with knowledge distillation models in accuracy, model size, and inference speed, but without the need for retraining or a teacher model.
  • DistilBERT can be further pruned, with one-third of its layers removed at an average performance drop of only 0.75 GLUE points.
  • Models like RoBERTa and XLNet learn task-specific knowledge earlier in the network than BERT, making them more robust to layer dropping.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.