[Paper Review] LazyFormer: Self Attention with Lazy Update
LazyFormer proposes a lightweight Transformer architecture that reduces self-attention computation by computing the attention distribution only once per block of multiple layers and reusing it in subsequent layers, achieving 1.3x faster inference than standard BERT without performance drop, while enabling larger models and better long-sequence efficiency under the same compute budget.
Improving the efficiency of Transformer-based language pre-training is an important task in NLP, especially for the self-attention module, which is computationally expensive. In this paper, we propose a simple but effective solution, called \emph{LazyFormer}, which computes the self-attention distribution infrequently. LazyFormer composes of multiple lazy blocks, each of which contains multiple Transformer layers. In each lazy block, the self-attention distribution is only computed once in the first layer and then is reused in all upper layers. In this way, the cost of computation could be largely saved. We also provide several training tricks for LazyFormer. Extensive experiments demonstrate the effectiveness of the proposed method.
Motivation & Objective
- To reduce the quadratic computational cost of self-attention in Transformers, especially for long sequences.
- To explore whether self-attention distributions remain stable across adjacent layers, enabling reuse.
- To design an efficient Transformer variant that maintains performance while significantly reducing FLOPs.
- To enable training larger models or longer sequences within the same pre-training budget.
Proposed method
- LazyFormer organizes Transformer layers into 'lazy blocks', each containing m stacked layers.
- In each lazy block, self-attention is computed only in the first layer and reused in all upper layers of the block.
- The method reduces total self-attention FLOPs from O(kn²) to O(kn²/m), where m is the number of layers per block.
- The model uses wider layers (increased hidden/dense dimensions) to maintain model capacity despite reduced parameter count from shared attention computation.
- Dropout is removed from the self-attention module to further improve efficiency without harming performance.
- The architecture is trained with standard pre-training objectives, using a modified BERT-based setup with adjusted width and depth.
Experimental results
Research questions
- RQ1Can self-attention distributions be reused across multiple Transformer layers without significant performance degradation?
- RQ2Does infrequent self-attention computation lead to measurable efficiency gains in pre-training and inference?
- RQ3Can LazyFormer train larger models or longer sequences under the same computational budget?
- RQ4How does removing dropout from self-attention affect efficiency and performance in the context of lazy attention?
Key findings
- LazyFormer achieves 1.3x faster inference than standard BERT with identical model capacity and no performance drop.
- With the same pre-training cost, a larger LazyFormer model (M2x6) outperforms BERT by 1.0 point on the GLUE average score.
- Using only 50% of the pre-training cost, LazyFormer achieves a better GLUE score than BERT, demonstrating strong efficiency gains.
- The model converges faster during pre-training, with M2x6-S reaching competitive performance in half the training steps of BERT.
- Speedup increases with sequence length, achieving nearly 2x speedup on long sequences due to the O(n²) dominance in computation.
- Removing dropout from self-attention improves efficiency by ~10% with a slight performance gain, confirming its non-essential role in this setting.
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.