Skip to main content
QUICK REVIEW

[Paper Review] ZipLM: Inference-Aware Structured Pruning of Language Models

Eldar Kurtic, Elias Frantar|arXiv (Cornell University)|Feb 7, 2023
Topic ModelingComputer Science7 citations
TL;DR

ZipLM is a novel inference-aware structured pruning framework that iteratively removes model components based on their loss-runtime trade-off, enabling state-of-the-art accuracy-speedup trade-offs across both one-shot and gradual compression settings for BERT and GPT models. It guarantees target inference speedups in any environment and produces a full family of compressed models in a single run with minimal computational cost.

ABSTRACT

The breakthrough performance of large language models (LLMs) comes with major computational footprints and high deployment costs. In this paper, we progress towards resolving this problem by proposing a novel structured compression approach for LLMs, called ZipLM. ZipLM achieves state-of-the-art accuracy-vs-speedup, while matching a set of desired target runtime speedups in any given inference environment. Specifically, given a model, a dataset, an inference environment, as well as a set of speedup targets, ZipLM iteratively identifies and removes components with the worst loss-runtime trade-off. Unlike prior methods that specialize in either the post-training/one-shot or the gradual compression setting, and only for specific families of models such as BERT (encoder) or GPT (decoder), ZipLM produces state-of-the-art compressed models across all these settings. Furthermore, ZipLM achieves superior results for a fraction of the computational cost relative to prior distillation and pruning techniques, making it a cost-effective approach for generating an entire family of smaller, faster, and highly accurate models, guaranteed to meet the desired inference specifications. In particular, ZipLM outperforms all prior BERT-base distillation and pruning techniques, such as CoFi, MiniLM, and TinyBERT. Moreover, it matches the performance of the heavily optimized MobileBERT model, obtained via extensive architecture search, by simply pruning the baseline BERT-large model. When compressing GPT2, ZipLM outperforms DistilGPT2 while being 60% smaller and 30% faster. Our code is available at: https://github.com/IST-DASLab/ZipLM.

Motivation & Objective

  • To address the high computational cost and deployment barriers of large language models (LLMs) in resource-constrained environments.
  • To overcome the limitations of existing structured pruning and distillation methods, which often fail to guarantee runtime speedups or require extensive retraining and hyperparameter tuning.
  • To unify one-shot and gradual compression into a single framework that works across both encoder (BERT) and decoder (GPT) architectures without modification.
  • To provide a practical, efficient, and inference-aware method that produces a complete family of compressed models meeting specific target speedups in a single optimization run.

Proposed method

  • ZipLM uses a novel saliency criterion that combines weight magnitude, activation impact, and linear redundancy detection, while accounting for local and global correlations across layers.
  • It introduces an inference-aware pruning strategy that evaluates each component's impact on both model accuracy and runtime, prioritizing removals that yield the best loss-runtime trade-off.
  • The method employs a layer-wise token-level distillation technique that boosts accuracy on small datasets without requiring manual layer matching.
  • It enables end-to-end compression across multiple speedup targets (e.g., 2x, 5x, 10x) in a single run using a unified set of hyperparameters, ensuring consistent performance and speed guarantees.
  • ZipLM is compatible with unstructured pruning and quantization, enabling further compression and performance gains in CPU-based inference environments.
Figure 1 : Illustration of the ZipLM pipeline: 1) inference specifications, 2) runtime benchmarking of candidates for pruning, 3) gradual structured pruning until all speedup targets are met.
Figure 1 : Illustration of the ZipLM pipeline: 1) inference specifications, 2) runtime benchmarking of candidates for pruning, 3) gradual structured pruning until all speedup targets are met.

Experimental results

Research questions

  • RQ1Can structured pruning achieve state-of-the-art accuracy-speedup trade-offs in both one-shot and gradual compression settings without architectural modifications?
  • RQ2Can an inference-aware pruning strategy guarantee target runtime speedups in diverse hardware environments without repeated retraining?
  • RQ3How does the proposed method compare in efficiency and accuracy to distillation-based and prior pruning techniques across BERT and GPT models?
  • RQ4What is the scalability of structured pruning in terms of extreme compression ratios (e.g., 50x) without model collapse?

Key findings

  • ZipLM outperforms all prior distillation and pruning techniques for BERT-base, including CoFi, MiniLM, and TinyBERT, and matches MobileBERT’s performance by pruning BERT-large without architecture search.
  • For GPT2, ZipLM produces a model 60% smaller and 30% faster than DistilGPT2 while achieving superior performance.
  • On BERT-base, ZipLM achieves 87.6 F1 at 1.5x speedup and 84.7 F1 at 2.0x speedup using only 4,096 calibration samples, outperforming Kwon et al. at 2,048 samples.
  • The method requires only 115 total training epochs to compress BERT-base across 14 speedup targets (2x–15x), making it 4.87x more efficient than CoFi, which would require 560 epochs.
  • ZipLM achieves 13x speedup on CPU with full accuracy recovery and up to 50x with maximum compression, outperforming the prior compound pipeline by a factor of 3–10.
  • Scaling laws show that pruned models follow linear accuracy-speedup relationships: F1 ≈ 92.1 − 0.3×speedup for BERT-large and F1 ≈ 90.3 − 0.6×speedup for BERT-base, indicating higher resilience in larger models.
ZipLM: Inference-Aware Structured Pruning of Language Models

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.