Adaptive Computation Pruning for the Forgetting Transformer
Abstract
The recently proposed Forgetting Transformer (FoX) incorporates a forget gate into softmax attention and has shown consistently better or on-par performance compared to the standard RoPE-based Transformer. Notably, many attention heads in FoX tend to forget quickly, causing their output at each timestep to rely primarily on the local context. Based on this observation, we propose Adaptive Computation Pruning (ACP) for FoX, a method that dynamically prunes computations involving input-output dependencies that are strongly decayed by the forget gate. This is achieved using a dynamically set pruning threshold that ensures that the pruned attention weights remain negligible. We apply ACP to language model pretraining with FoX and show it consistently reduces the number of FLOPs in softmax attention by around 70% across different model sizes and context lengths, resulting in a roughly 10% to 35% improvement in training throughput. Furthermore, longer context lengths yield greater computational savings. All these speed improvements are achieved without any performance degradation. We also perform several analyses to provide deeper insights into our method, such as examining the pruning patterns and analyzing the distribution of FLOP savings across different attention heads. Our code is available at https://github.com/zhixuan-lin/arctic-fox.
Community
This method is designed to speed up the previously proposed Forgetting Transformer (FoX) without any performance degradation. FoX adds a forget gate to the Transformer, and the resulting attention mechanism can also be seen as a data-dependent and learnable version of ALiBi, as follows:
The core idea of Adaptive Computation Pruning (ACP) is simple: we don't need to waste compute on things that we forget. Concretely, if $D_{ij}$ is far below zero (e.g., -1000), then the term $\exp(q_i^\top k_j + D_{ij})$ is likely to be zero after normalization, and thus any computation involved in this term could be pruned. Due to the special structure of the matrix $D$, this can be done by identifying a pruning boundary across the FlashAttention computation grid and only performing the computation on the right of the pruning boundary:
Summary of results:
- In this work, we focus on pretraining, though in principle it could also be used during inference (i.e., prefilling and decoding)
- ACP consistently prunes around 70% of the attention FLOPs, resulting in a roughly 10%-35% improvement in training throughput, depending on the model size and context length.
- All the speed improvements are achieved without any performance degradation. This is because we dynamically set the threshold for $D_{ij}$ in a way that ensures the total pruned attention weights are bounded by a small number (in practice, bounded by $e^{-10} < 0.00005$).
Code: https://github.com/zhixuan-lin/arctic-fox. We have more results coming in the future. Stay tuned!
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- Forgetting Transformer: Softmax Attention with a Forget Gate (2025)
- Saliency-driven Dynamic Token Pruning for Large Language Models (2025)
- Neural Attention Search (2025)
- XAttention: Block Sparse Attention with Antidiagonal Scoring (2025)
- Sliding Window Attention Training for Efficient Large Language Models (2025)
- Multi-Token Attention (2025)
- Attention Condensation via Sparsity Induced Regularized Training (2025)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper