[Paper Review] PoWER-BERT: Accelerating BERT Inference via Progressive Word-vector Elimination
PoWER-BERT reduces BERT inference time by progressively eliminating redundant word-vectors (intermediate encoder outputs) guided by self-attention, achieving up to 4.5x speedup with <1% accuracy loss on GLUE tasks, and up to 6.8x on ALBERT with similar accuracy loss.
We develop a novel method, called PoWER-BERT, for improving the inference time of the popular BERT model, while maintaining the accuracy. It works by: a) exploiting redundancy pertaining to word-vectors (intermediate encoder outputs) and eliminating the redundant vectors. b) determining which word-vectors to eliminate by developing a strategy for measuring their significance, based on the self-attention mechanism. c) learning how many word-vectors to eliminate by augmenting the BERT model and the loss function. Experiments on the standard GLUE benchmark shows that PoWER-BERT achieves up to 4.5x reduction in inference time over BERT with <1% loss in accuracy. We show that PoWER-BERT offers significantly better trade-off between accuracy and inference time compared to prior methods. We demonstrate that our method attains up to 6.8x reduction in inference time with <1% loss in accuracy when applied over ALBERT, a highly compressed version of BERT. The code for PoWER-BERT is publicly available at https://github.com/IBM/PoWER-BERT.
Motivation & Objective
- Motivate reducing BERT inference time without retraining or changing model size.
- Identify a new redundancy type: word-vectors (intermediate encoder outputs) that diffusion creates.
- Develop a dynamic, attention-guided method to select and retain word-vectors across encoders.
- Learn a retention configuration that specifies how many word-vectors to keep per encoder while preserving accuracy.
Proposed method
- Leverage diffusion of information in BERT’s self-attention to justify progressive word-vector elimination across encoders.
- Define a retention configuration (ell_1,...,ell_{12}) specifying how many word-vectors to retain at each encoder.
- Compute word-vector significance scores using attention: Sig_h(w)=sum_w' A_h[w',w], Sig(w)=sum_h Sig_h(w).
- Introduce a soft-extract layer that learns retention parameters r_j[k] (in [0,1]) to softly scale word-vectors by their sorted significance positions.
- Train in three steps: (1) fine-tune BERT; (2) configuration-search with soft-extract layers and lambda-regularized loss to derive mass and retention; (3) replace with hard extract and re-train.
- Query the loss: L(Θ,r) + λ * sum_j j * mass(j;r), where mass(j;r)=sum_k r_j[k], to obtain a monotone retention configuration.
Experimental results
Research questions
- RQ1Can word-vectors, as opposed to whole encoders, be safely eliminated to speed up inference without hurting accuracy?
- RQ2Does attention-derived significance accurately identify word-vectors whose removal minimally impacts predictions?
- RQ3Can a learned retention configuration adaptively determine how many word-vectors to keep per encoder across inputs?
- RQ4How does PoWER-BERT compare to encoder-pruning baselines and to compressed models (e.g., ALBERT) in accuracy-time trade-offs?
Key findings
- PoWER-BERT achieves up to 4.5x faster inference than BERT BASE with <1% accuracy loss on GLUE tasks.
- On ALBERT, PoWER-BERT yields up to 6.8x speedup with <1% accuracy loss on GLUE tasks.
- Dynamic, attention-based word-vector selection (Attn-WS) outperforms static (Head-WS, Rand-WS) strategies, especially on longer inputs.
- The learned retention configuration progressively removes word-vectors across encoders, while preserving the CLS-based decision pathway (CLS is not eliminated).
- Compared to DistilBERT, BERT-PKD, and Head-Prune, PoWER-BERT offers superior Pareto frontiers in accuracy vs. inference time across multiple GLUE datasets.
- Code is publicly available, enabling reproducibility and integration with production pipelines.
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.