Layer-wise Pruning of Transformer Attention Heads for Efficient Language Modeling

Kyuhong Shim, Iksoo Choi, Wonyong Sung, Jungwook Choi
10/7/2021
cs.CL
transformer-attentionquantization-pruning

Official code: aiha-lab/Attention-Head-Pruning (22 stars, Python, GPL-3.0, last commit 2022-02-22).

Abstract

While Transformer-based models have shown impressive language modeling performance, the large computation cost is often prohibitive for practical use. Attention head pruning, which removes unnecessary attention heads in the multihead attention, is a promising technique to solve this problem.

Show full abstract

However, it does not evenly reduce the overall load because the heavy feedforward module is not affected by head pruning. In this paper, we apply layer-wise attention head pruning on All-attention Transformer so that the entire computation and the number of parameters can be reduced proportionally to the number of pruned heads. While the architecture has the potential to fully utilize head pruning, we propose three training methods that are especially helpful to minimize performance degradation and stabilize the pruning process. Our pruned model shows consistently lower perplexity within a comparable parameter size than Transformer-XL on WikiText-103 language modeling benchmark.

View on arXivView PDF

Code Implementations(1)

GPL-3.0

Layer-wise Pruning of Transformer Heads for Efficient Language Modeling

222PythonFeb 18, 20224 years agoGPL-3.0

Similar Papers

Cite this paper

@article{shim2021layerwise,
  title  = {Layer-wise Pruning of Transformer Attention Heads for Efficient Language Modeling},
  author = {Kyuhong Shim and Iksoo Choi and Wonyong Sung and Jungwook Choi},
  year   = {2021},
  eprint = {2110.03252},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2110.03252}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2110.03252.svg)](https://codeofpaper.com/paper/2110.03252)

Discussion