[Paper Review] Fastformer: Additive Attention Can Be All You Need
Fastformer presents an efficient Transformer variant that uses additive attention to summarize global context and linear-time interactions with keys and values, achieving competitive long-sequence modeling with reduced complexity.
Transformer is a powerful model for text understanding. However, it is inefficient due to its quadratic complexity to input sequence length. Although there are many methods on Transformer acceleration, they are still either inefficient on long sequences or not effective enough. In this paper, we propose Fastformer, which is an efficient Transformer model based on additive attention. In Fastformer, instead of modeling the pair-wise interactions between tokens, we first use additive attention mechanism to model global contexts, and then further transform each token representation based on its interaction with global context representations. In this way, Fastformer can achieve effective context modeling with linear complexity. Extensive experiments on five datasets show that Fastformer is much more efficient than many existing Transformer models and can meanwhile achieve comparable or even better long text modeling performance.
Motivation & Objective
- Motivate the need for efficient long-sequence transformers due to quadratic self-attention complexity.
- Propose Fastformer, an additive-attention-based architecture that achieves linear-time context modeling.
- Demonstrate Fastformer’s efficiency and competitive accuracy on classification, recommendation, and summarization tasks.
- Provide analysis on interaction functions and parameter sharing to guide practical deployment.
Proposed method
- Transform input embeddings into Q, K, V via three linear projections per attention head.
- Summarize the query matrix with additive attention to obtain a global query vector q.
- Compute interaction with each key via element-wise product q * k_i to form p_i, then summarize p_i with additive attention to get global key k.
- Compute interaction between global key k and each value via element-wise product k * v_i, followed by a linear projection to r_i.
- Add the transformed r_i to the original query q to form the output; stack heads and optionally share parameters to reduce memory.
Experimental results
Research questions
- RQ1Can additive attention-based global context modeling scale linearly with sequence length while preserving performance?
- RQ2Does interaction via element-wise product between global context and per-token representations improve contextual modeling over additive/concatenation approaches?
- RQ3What is the impact of parameter sharing strategies on speed, memory, and accuracy in Fastformer?
- RQ4How does Fastformer perform on sentiment/topic classification, news recommendation, and text summarization compared to other efficient Transformers?
Key findings
- Fastformer achieves linear-time complexity O(N·d) compared to quadratic O(N^2·d) of standard Transformers.
- Fastformer attains competitive or superior accuracy and macro-F scores on Amazon, IMDB, and MIND tasks versus several efficient Transformers.
- In news recommendation, Fastformer outperforms several baselines and benefits further from PLM-NR integration, with ensemble achieving top results on the MIND leaderboard.
- In text summarization, Fastformer yields competitive ROUGE scores, often outperforming other linear or sparse-attention variants.
- Compared to vanilla Transformer, Fastformer provides substantial speedups in training and inference, while maintaining strong performance.
- Abstraction of interactions via element-wise product is favored over addition/concatenation for richer context modeling.
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.