[Paper Review] A Fast Post-Training Pruning Framework for Transformers
A pruning framework for Transformers that achieves significant FLOPs and latency reductions without retraining, using Fisher-based mask search, rearrangement, and mask tuning to prune heads and FFN filters while preserving accuracy.
Pruning is an effective way to reduce the huge inference cost of Transformer models. However, prior work on pruning Transformers requires retraining the models. This can add high training cost and high complexity to model deployment, making it difficult to use in many practical situations. To address this, we propose a fast post-training pruning framework for Transformers that does not require any retraining. Given a resource constraint and a sample dataset, our framework automatically prunes the Transformer model using structured sparsity methods. To retain high accuracy without retraining, we introduce three novel techniques: (i) a lightweight mask search algorithm that finds which heads and filters to prune based on the Fisher information; (ii) mask rearrangement that complements the search algorithm; and (iii) mask tuning that reconstructs the output activations for each layer. We apply our method to BERT-base and DistilBERT, and we evaluate its effectiveness on GLUE and SQuAD benchmarks. Our framework achieves up to 2.0x reduction in FLOPs and 1.56x speedup in inference latency, while maintaining < 1% loss in accuracy. Importantly, our framework prunes Transformers in less than 3 minutes on a single GPU, which is over two orders of magnitude faster than existing pruning approaches that retrain the models.
Motivation & Objective
- Motivate practical, retraining-free compression of Transformer models for deployment under FLOPs/latency constraints.
- Develop a three-stage pruning pipeline (mask search, rearrangement, tuning) guided by information theory to select heads and FFN filters to prune.
- Enable rapid pruning on a small sample of data, avoiding full retraining while maintaining accuracy within a tight budget.
Proposed method
- Represent pruning as a constrained mask optimization over MHA heads and FFN filters with binary masks.
- Use a Fisher information-based mask search to select which heads/filters to prune under a FLOPs/latency budget.
- Apply a mask rearrangement stage to capture intra-layer interactions via a block-diagonal Fisher approximation.
- Perform a mask tuning stage that reconstructs layer activations by solving a layer-wise linear least squares problem.
- Extend the approach to latency constraints by approximating latency with a piece-wise linear model and adapting the search accordingly.
- Demonstrate pruning on BERT_BASE and DistilBERT, evaluating on GLUE and SQuAD with minimal accuracy loss.
Experimental results
Research questions
- RQ1Can Transformer models be pruned to meet FLOPs/latency constraints without retraining?
- RQ2How can we identify which heads and FFN filters to prune so as to minimize accuracy loss under a given resource constraint?
- RQ3Does a post-training pruning pipeline with mask search, rearrangement, and tuning outperform retraining-based pruning methods in efficiency and accuracy trade-offs?
- RQ4What is the practical speedup achievable on real hardware when using retraining-free pruning on common benchmarks?
Key findings
- The framework achieves up to 2.0× reduction in FLOPs and up to 1.56× speedup in inference latency with less than 1% accuracy loss.
- Pruning can be completed in under 3 minutes on a single GPU, which is over two orders of magnitude faster than retraining-based pruning methods.
- On GLUE and SQuAD, pruning BERT_BASE and DistilBERT with 1% accuracy loss yields substantial FLOPs reductions (60–70% of original FLOPs for BERT_BASE on several tasks; ~50% for DistilBERT).
- Latency experiments on NVIDIA V100 show average speedups around 1.47× to 1.56× at batch size 256 under a 1% accuracy constraint.
- The proposed Fisher-based mask search, rearrangement, and tuning stages each contribute to recovering or preserving accuracy, with mask tuning playing a critical role in accuracy restoration.
- Compared to prior structured pruning methods, the retraining-free approach achieves comparable or better FLOPs-accuracy trade-offs with substantially lower pruning costs (end-to-end pruning times under a minute).
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.