Skip to main content
QUICK REVIEW

[Paper Review] Fastformer: Additive Attention is All You Need

Chuhan Wu, Fangzhao Wu|arXiv (Cornell University)|Aug 20, 2021
Topic ModelingComputer Science20 references3 citations
TL;DR

Fastformer proposes a linear-complexity Transformer variant using additive attention to model global context efficiently, replacing quadratic self-attention with a two-stage process: global context encoding followed by token-specific context interaction. It achieves state-of-the-art performance on long sequences with significantly improved inference speed over standard Transformers.

ABSTRACT

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

  • To address the quadratic computational complexity of standard Transformers in long sequence modeling.
  • To develop an efficient attention mechanism that maintains strong performance on long-context tasks.
  • To replace pair-wise token interactions with a global context modeling approach for improved scalability.

Proposed method

  • Replace standard self-attention with an additive attention mechanism to model global context representations.
  • First, compute global context representations using additive attention over all tokens.
  • Then, each token's representation is updated by attending to the global context via a learnable transformation.
  • The method achieves linear complexity by avoiding full pairwise attention computation.
  • The architecture is trained end-to-end with standard objectives, maintaining compatibility with existing Transformer frameworks.

Experimental results

Research questions

  • RQ1Can additive attention be used to model global context efficiently while preserving sequence modeling performance?
  • RQ2Does replacing quadratic self-attention with a two-stage additive process maintain or improve performance on long sequences?
  • RQ3Can the resulting model achieve linear complexity without sacrificing accuracy compared to standard Transformers?

Key findings

  • Fastformer achieves linear complexity in computation, significantly reducing inference time on long sequences compared to standard Transformers.
  • On five benchmark datasets, Fastformer matches or exceeds the performance of standard Transformers in long text modeling tasks.
  • The model demonstrates superior efficiency, especially on long sequences, without compromising on accuracy.
  • The additive attention mechanism enables effective global context encoding while avoiding the quadratic cost of full self-attention.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.