Adaptive Computation Pruning for the Forgetting Transformer

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Lin, Zhixuan, Obando-Ceron, Johan, He, Xu Owen, Courville, Aaron
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866912532733624320
author Lin, Zhixuan
Obando-Ceron, Johan
He, Xu Owen
Courville, Aaron
author_facet Lin, Zhixuan
Obando-Ceron, Johan
He, Xu Owen
Courville, Aaron
contents 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 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. In particular, our method performs provably safe pruning via a dynamically set pruning threshold that guarantees the pruned attention weights are negligible. We apply ACP to language model pretraining with FoX and show it consistently reduces the number of FLOPs and memory accesses in softmax attention by around 70% across different model sizes and context lengths, resulting in a roughly 50% to 70% reduction in attention runtime (or a 2-3$\times$ speedup) and a roughly 10% to 40% increase in end-to-end training throughput. Furthermore, longer context lengths yield greater computational savings. All these speed improvements are achieved without any performance degradation. Our code is available at https://github.com/zhixuan-lin/forgetting-transformer.
format Preprint
id arxiv_https___arxiv_org_abs_2504_06949
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Adaptive Computation Pruning for the Forgetting Transformer
Lin, Zhixuan
Obando-Ceron, Johan
He, Xu Owen
Courville, Aaron
Machine Learning
Artificial Intelligence
Computation and Language
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 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. In particular, our method performs provably safe pruning via a dynamically set pruning threshold that guarantees the pruned attention weights are negligible. We apply ACP to language model pretraining with FoX and show it consistently reduces the number of FLOPs and memory accesses in softmax attention by around 70% across different model sizes and context lengths, resulting in a roughly 50% to 70% reduction in attention runtime (or a 2-3$\times$ speedup) and a roughly 10% to 40% increase in end-to-end training throughput. Furthermore, longer context lengths yield greater computational savings. All these speed improvements are achieved without any performance degradation. Our code is available at https://github.com/zhixuan-lin/forgetting-transformer.
title Adaptive Computation Pruning for the Forgetting Transformer
topic Machine Learning
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2504.06949