NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Short Study on Compressing Decoder-Based Language Models

Tianda Li, Yassir El Mesbahi, Ivan Kobyzev, Ahmad Rashid, Atif Mahmud, Nithin Anchuri, Habib Hajimolahoseini, Yang Liu, Mehdi RezagholizadeharXiv 2021

Abstract

Pre-trained Language Models (PLMs) have been successful for a wide range of natural language processing (NLP) tasks. The state-of-the-art of PLMs, however, are extremely large to be used on edge devices. As a result, the topic of model compression has attracted increasing attention in the NLP community. Most of the existing works focus on compressing encoder-based models (tiny-BERT, distilBERT, distilRoBERTa, etc), however, to the best of our knowledge, the compression of decoder-based models (such as GPT-2) has not been investigated much. Our paper aims to fill this gap. Specifically, we explore two directions: 1) we employ current state-of-the-art knowledge distillation techniques to improve fine-tuning of DistilGPT-2. 2) we pre-train a compressed GPT-2 model using layer truncation and compare it against the distillation-based method (DistilGPT2). The training time of our compressed model is significantly less than DistilGPT-2, but it can achieve better performance when fine-tuned on downstream tasks. We also demonstrate the impact of data cleaning on model performance.

Introduction

While model compression for encoder-based models like BERT is well-studied, decoder-based models (like GPT-2) have remained relatively unexplored. Large-scale Pre-trained Language Models (PLMs) like GPT-3 and RoBERTa are too massive for deployment on edge devices such as phones and IoT hardware. To address this, researchers typically use Knowledge Distillation (KD), where a smaller "student" model learns from a larger "teacher." However, the current standard for decoders, DistilGPT2, requires a lengthy and resource-intensive pre-training process. This study investigates whether decoder compression can be made faster and more effective by rethinking model initialization and training data quality.

Methodology

The research explores three primary avenues for optimizing the compression of decoder-based models:

1. Initialization via Layer Truncation

Instead of training a student model from scratch, the authors "truncate" a large teacher model. Two strategies were compared:

  • Uniform Selection: Selecting layers at regular intervals.
  • Pseudo-uniform Selection (Psudo): Ensuring the first and last layers of the teacher are always included, with the remaining layers selected uniformly. This preserves the critical "anchor" points of the original architecture.

2. Knowledge Distillation (KD) Techniques

The authors benchmarked several state-of-the-art distillation techniques during fine-tuning:

  • Annealing-KD: Gradually shifts focus from the teacher's output to ground-truth labels.
  • MATE-KD: Uses a generator to create adversarial examples, forcing the student to learn more robust features.
  • RAIL-KD: Transfers knowledge from the teacher’s intermediate layers to the student.
Comparison of Annealing-KD, MATE-KD, and RAIL-KD architectures.

3. Data Cleaning

An automated pipeline was implemented to clean the OpenWebText corpus by stripping HTML, removing noisy sentences, and eliminating duplicates. This reduced the dataset size by 65.5%, focusing the training on high-quality signals.

Results and Discussion

Efficiency Gains

The most striking result is the efficiency of the proposed approach. As shown in the table below, the compressed model (GPT2-Psudo) achieved competitive perplexity (PPL) in a fraction of the time required for DistilGPT2.

Pretraining efficiency comparison across different strategies and dataset fractions.

Specifically, the GPT2-Psudo model was trained in just 42 hours on a cleaned dataset, compared to the 768 hours required for the original DistilGPT2—representing a nearly 18x speedup.

Performance and Zero-Shot Capabilities

Despite the significantly reduced training time, the 6-layer model initialized with pseudo-uniform truncation outperformed DistilGPT2 on 5 out of 7 downstream tasks in the GLUE and SuperGLUE benchmarks. Furthermore, in zero-shot perplexity tests on Wikitext103, the model achieved a score of 45.19 using only 50% of the training data, surpassing DistilGPT2’s score of 45.26 which utilized the full dataset.

Insights on Decoder Distillation

The study found that decoder-based models like GPT-2 respond differently to KD than encoder-based models. While intermediate layer distillation (RAIL-KD) is often superior for BERT, data-augmentation-based methods like MATE-KD proved more effective for GPT-2. This suggests that decoders may benefit more from seeing diverse, "difficult" examples during the distillation process.

Conclusion

This research demonstrates that highly efficient 6-layer GPT-2 models can be created through pseudo-uniform layer truncation and rigorous data cleaning. These models not only train faster but also achieve superior performance on downstream tasks compared to traditional distillation methods. Future work will explore a unified approach that combines these initialization and cleaning strategies with advanced KD methods during the pre-training phase to further push the limits of decoder compression.

Summary updated

BibTeX
@misc{li2021short,
  author = {Tianda Li and Yassir El Mesbahi and Ivan Kobyzev and Ahmad Rashid and Atif Mahmud and Nithin Anchuri and Habib Hajimolahoseini and Yang Liu and Mehdi Rezagholizadeh},
  title = {{A Short Study on Compressing Decoder-Based Language Models}},
  year = {2021},
  eprint = {2110.08460},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.08460},
}
Figure