Linformer: Self-Attention with Linear Complexity

Authors: Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, Hao Ma

Submitted to arXiv on 08 Jun. 2020
Abstract

Large transformer models have shown extraordinary success in achieving state-of-the-art results in many natural language processing applications. However, training and deploying these models can be prohibitively costly for long sequences, as the standard self-attention mechanism of the Transformer uses $O(n^2)$ time and space with respect to sequence length. In this paper, we demonstrate that the self-attention mechanism can be approximated by a low-rank matrix. We further exploit this finding to propose a new self-attention mechanism, which reduces the overall self-attention complexity from $O(n^2)$ to $O(n)$ in both time and space. The resulting linear transformer, the \textit{Linformer}, performs on par with standard Transformer models, while being much more memory- and time-efficient.

The papers around it, by date and closeness

Higher is closer to this paper; left is older. Lines join papers close to each other: groups of lines are sub-topics. Select a point to see why it is there. Back to the summary of this paper

How to read this map? Illustrated guide

Closest papers Prior work it builds on Papers that cite it

Papers around this one

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close
    Revisiting Linformer with a modified self-attention with linear complexity
    Madhusudan Verma · 2020 · arXiv.org · preprint, not peer reviewed · cited 11 times · Not summarized yet
    Abstract

    Although Transformer models such as Google's BERT and OpenAI's GPT-3 are successful in many natural language processing tasks, training and deploying these models are costly and inefficient.Even if pre-trained models are used, deploying these models still remained a challenge due to their large size. Apart from deployment, these models take higher time during inference restricting user-friendliness. The main bottleneck is self-attention which uses quadratic time and space with respect to the sequence length. In order to reduce the quadratic time complexity of the self-attention mechanism, Linformer by Facebook's AI research team was introduced where they showed that the self-attention mechan…

  2. Very close Cites this paper
    Linear transformer: ReLU-based linear attention for O(n) complexity
    Yujie Zhu · 2026 · International Conference on Computer Vision, Algorithms, and Communication · Not summarized yet
    Abstract

    Transformer architecture is a dominant foundation for NLP, vision, and multimodal learning, but their standard softmax self-attention forms an n × n similarity matrix, causing O(n2) time and memory growth with sequence length and limiting long-context training and generation. This paper introduces a ReLU-based true linear attention operator that replaces only the score-and-normalization step inside the multihead attention sublayer while keeping projections, residual Add and Norm blocks, the FFN, and training/inference procedures unchanged. The method rewrites query–key interactions via a decomposable, softmax-free feature mapping and reorders computation into two linear stages: a query-indep…

  3. Very close
    Singularformer: Learning to Decompose Self-Attention to Linearize the Complexity of Transformer
    Yi-Fan Wu, Shi-Chao Kan, Min Zeng et al. · 2023 · International Joint Conference on Artificial Intelligence · cited 18 times · Not summarized yet
    Abstract

    Transformers achieve excellent performance in a variety of domains since they can capture long-distance dependencies through the self-attention mechanism. However, self-attention is computationally costly due to its quadratic complexity and high memory consumption. In this paper, we propose a novel Transformer variant (Singularformer) that uses neural networks to learn the singular value decomposition process of the attention matrix to design a linear-complexity and memory-efficient global self-attention mechanism. Specifically, we decompose the attention matrix into the product of three matrix factors based on singular value decomposition and design neural networks to learn these matrix fac…

  4. Very close
    Linear Log-Normal Attention with Unbiased Concentration
    Yury Nahshan, Dor-Joseph Kampeas, E. Haleva · 2023 · International Conference on Learning Representations · cited 14 times · Not summarized yet
    Abstract

    Transformer models have achieved remarkable results in a wide range of applications. However, their scalability is hampered by the quadratic time and memory complexity of the self-attention mechanism concerning the sequence length. This limitation poses a substantial obstacle when dealing with long documents or high-resolution images. In this work, we study the self-attention mechanism by analyzing the distribution of the attention matrix and its concentration ability. Furthermore, we propose instruments to measure these quantities and introduce a novel self-attention mechanism, Linear Log-Normal Attention, designed to emulate the distribution and concentration behavior of the original self-…

  5. Very close
    Linearizing Transformer with Key-Value Memory Bank
    Yizhe Zhang, Deng Cai · 2022 · Computation and Language · cited 7 times · AI summary available
    Abstract

    Transformer has brought great success to a wide range of natural language processing tasks. Nevertheless, the computational overhead of the vanilla transformer scales quadratically with sequence length. Many efforts have been made to develop more efficient transformer variants. A line of work (e.g., Linformer) projects the input sequence into a low-rank space, achieving linear time complexity. However, Linformer does not suit well for text generation tasks as the sequence length must be pre-specified. We propose MemSizer, an approach also projects the source sequence into lower dimension representation but can take input with dynamic length, with a different perspective of the attention mech…

  6. Very close Cited by this paper Used in depth by this paper A method it uses
    Reformer: The Efficient Transformer
    Nikita Kitaev, Łukasz Kaiser, Anselm Levskaya · 2020 · Machine Learning · cited 3,187 times · AI summary available
    Abstract

    Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its complexity from O($L^2$) to O($L\log L$), where $L$ is the length of the sequence. Furthermore, we use reversible residual layers instead of the standard residuals, which allows storing activations only once in the training process instead of $N$ times, where $N$ is the number of layers. The resulting model, the Reformer, performs on par with Transforme…

  7. Close
    Nyströmformer: A Nyström-Based Algorithm for Approximating Self-Attention
    Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty et al. · 2021 · Computation and Language · cited 815 times · AI summary available
    Abstract

    Transformers have emerged as a powerful tool for a broad range of natural language processing tasks. A key component that drives the impressive performance of Transformers is the self-attention mechanism that encodes the influence or dependence of other tokens on each specific token. While beneficial, the quadratic complexity of self-attention on the input sequence length has limited its application to longer sequences -- a topic being actively studied in the community. To address this limitation, we propose Nyströmformer -- a model that exhibits favorable scalability as a function of sequence length. Our idea is based on adapting the Nyström method to approximate standard self-attention wit…

  8. Close
    Self-Attention and Transformers: Driving the Evolution of Large Language Models
    Qing Luo, Weizhen Zeng, Manni Chen et al. · 2023 · IEEE International Conference on Electronic Information and Communication Technology · cited 41 times · Not summarized yet
    Abstract

    Transformers, originally introduced for machine translation, and built upon the Self-Attention mechanism, have undergone a remarkable evolution, establishing themselves as the bedrock of large language models (LLMs). Their unparalleled capacity to model intricate relationships and capture extensive dependencies within sequences has propelled their prominence. This article, presented in a popular science format, serves as an introduction to the transformer architecture, elucidating its innovative structure that enables efficient processing of long sequences and capturing dependencies over extended distances. We believe that this resource will prove valuable to college students or youth resear…

Prior work it builds on

  1. Close Used in depth by this paper A method it uses
    Generating Long Sequences with Sparse Transformers
    Rewon Child, Scott Gray, Alec Radford et al. · 2019 · Machine Learning · preprint, not peer reviewed · cited 2,780 times · AI summary available
    Abstract

    Transformers are powerful sequence models, but require time and memory that grows quadratically with the sequence length. In this paper we introduce sparse factorizations of the attention matrix which reduce this to $O(n \sqrt{n})$. We also introduce a) a variation on architecture and initialization to train deeper networks, b) the recomputation of attention matrices to save memory, and c) fast attention kernels for training. We call networks with these changes Sparse Transformers, and show they can model sequences tens of thousands of timesteps long using hundreds of layers. We use the same architecture to model images, audio, and text from raw bytes, setting a new state of the art for dens…

  2. Close
    Attention Is All You Need
    Ashish Vaswani, Noam Shazeer, Niki Parmar et al. · 2017 · Computation and Language · cited 201,655 times · AI summary available
    Abstract

    The dominant sequence transduction models are based on complex recurrent or convolutional neural networks in an encoder-decoder configuration. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task, improving over the existing best results, including ense…

  3. Related Used in depth by this paper A method it uses
    DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter
    Victor Sanh, Lysandre Debut, Julien Chaumond et al. · 2019 · arXiv.org · preprint, not peer reviewed · cited 10,981 times · Not summarized yet
    Abstract

    As Transfer Learning from large-scale pre-trained models becomes more prevalent in Natural Language Processing (NLP), operating these large models in on-the-edge and/or under constrained computational training or inference budgets remains challenging. In this work, we propose a method to pre-train a smaller general-purpose language representation model, called DistilBERT, which can then be fine-tuned with good performances on a wide range of tasks like its larger counterparts. While most prior work investigated the use of distillation for building task-specific models, we leverage knowledge distillation during the pre-training phase and show that it is possible to reduce the size of a BERT m…

  4. Related A method it uses
    Distilling the Knowledge in a Neural Network
    Geoffrey E. Hinton, O. Vinyals, Jeffrey Dean · 2015 · arXiv.org · preprint, not peer reviewed · cited 27,596 times · AI summary available
    Abstract

    A very simple way to improve the performance of almost any machine learning algorithm is to train many different models on the same data and then to average their predictions. Unfortunately, making predictions using a whole ensemble of models is cumbersome and may be too computationally expensive to allow deployment to a large number of users, especially if the individual models are large neural nets. Caruana and his collaborators have shown that it is possible to compress the knowledge in an ensemble into a single model which is much easier to deploy and we develop this approach further using a different compression technique. We achieve some surprising results on MNIST and we show that we …

  5. Related A method it uses
    Blockwise Self-Attention for Long Document Understanding
    Jie-Zhong Qiu, Hao Ma, Omer Levy et al. · 2019 · Findings · cited 285 times · Not summarized yet
    Abstract

    We present BlockBERT, a lightweight and efficient BERT model for better modeling long-distance dependencies. Our model extends BERT by introducing sparse block structures into the attention matrix to reduce both memory consumption and training/inference time, which also enables attention heads to capture either short- or long-range contextual information. We conduct experiments on language model pre-training and several benchmark question answering datasets with various paragraph lengths. BlockBERT uses 18.7-36.1% less memory and 12.0-25.1% less time to learn the model. During testing, BlockBERT saves 27.8% inference time, while having comparable and sometimes better prediction accuracy, com…

Papers that cite it

  1. Close
    Efficient Transformers: A Survey
    Yi Tay, Mostafa Dehghani, Dara Bahri et al. · 2022 · ACM Computing Surveys · cited 1,402 times · Not summarized yet
    Abstract

    Transformer model architectures have garnered immense interest lately due to their effectiveness across a range of domains like language, vision, and reinforcement learning. In the field of natural language processing for example, Transformers have become an indispensable staple in the modern deep learning stack. Recently, a dizzying number of “X-former” models have been proposed—Reformer, Linformer, Performer, Longformer, to name a few—which improve upon the original Transformer architecture, many of which make improvements around computational and memory efficiency . With the aim of helping the avid researcher navigate this flurry, this article characterizes a large and thoughtful selectio…

  2. Close
    Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting
    Haoyi Zhou, Shanghang Zhang, Jieqi Peng et al. · 2021 · Proceedings of the AAAI Conference on Artificial Intelligence · cited 8,044 times · Not summarized yet
    Abstract

    Many real-world applications require the prediction of long sequence time-series, such as electricity consumption planning. Long sequence time-series forecasting (LSTF) demands a high prediction capacity of the model, which is the ability to capture precise long-range dependency coupling between output and input efficiently. Recent studies have shown the potential of Transformer to increase the prediction capacity. However, there are several severe issues with Transformer that prevent it from being directly applicable to LSTF, including quadratic time complexity, high memory usage, and inherent limitation of the encoder-decoder architecture. To address these issues, we design an efficient tr…

  3. Close Uses this paper in depth
    Compression Techniques for Large-Scale Transformer Models: A Comprehensive Survey
    Hai-Yang Li, Si-Yu Huang, Rundao Li et al. · 2026 · Proceedings of the 2026 7th International Conference on Computer Information and Big Data Applications · Not summarized yet
    Abstract

    In recent years, deep learning models based on the Transformer architecture have achieved remarkable success in natural language processing and computer vision. However, these models typically contain hundreds of millions or even billions of parameters, posing enormous computational and storage challenges for practical deployment. Model compression technology has become a key solution to this problem by reducing model redundancy and lowering computational resource requirements while maintaining performance. This paper systematically reviews the four core technologies of Transformer model compression: model quantization, knowledge distillation, model pruning, and low-rank approximation, and a…

  4. Close
    Beyond Attention Complexity: A Survey of Efficient and Frugal Transformers for Long-Context Deployment
    Ziad Hassain, Asmaa Ouhmida, M. Mestari · 2026 · 2026 6th International Conference on Innovative Research in Applied Science, Engineering and Technology (IRASET) · Not summarized yet
    Abstract

    Transformer models are now the most common way to model sequences in natural language processing, vision, and multimodal learning. In recent years, their use has quickly moved to long-context situations, where the length of the input has grown from a few thousand tokens to hundreds of thousands or even millions of tokens. This change has completely changed how efficient Transformers are. Early research focused mostly on making self-attention less computationally complex. However, recent large-scale deployments have shown that memory usage during inference, especially due to key-value (KV) caching, is now the main problem for scalability, latency, and energy efficiency. This survey looks at m…

  5. Close
    On The Application of Linear Attention in Multimodal Transformers
    Armin Gerami, Seyedehanita Madani, R. Duraiswami · 2026 · arXiv.org · preprint, not peer reviewed · Not summarized yet
    Abstract

    Multimodal Transformers serve as the backbone for state-of-the-art vision-language models, yet their quadratic attention complexity remains a critical barrier to scalability. In this work, we investigate the viability of Linear Attention (LA) as a high-efficiency alternative within multimodal frameworks. By integrating LA, we reduce the computational overhead from quadratic to linear relative to sequence length while preserving competitive performance. We evaluate our approach across ViT-S/16, ViT-B/16, and ViT-L/16 architectures trained on the LAION-400M dataset, with validation focused on ImageNet-21K zero-shot accuracy. Our systematic evaluation demonstrates that Linear Attention not only…

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 6 November 2026.

The illustrated guide to the papers around a paper