---
title: "Nyströmformer — paper by Xiong et al. (2021)"
description: "How Nyströmformer approximates self-attention with landmarks, reduces sequence-length costs, and performs in language and long-context tests."
canonical: "https://research.elamur.ai/free/en/papers/xiong-2021-nystromformer-nystrom-based-algorithm-approximating/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/xiong-2021-nystromformer-nystrom-based-algorithm-approximating/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2021](https://md.research.elamur.ai/free/en/papers/2021/) / Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention

# Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention

Paper · 2021 · Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty et al.

**Authors:** [Yunyang Xiong](https://md.research.elamur.ai/free/en/authors/yunyang-xiong/), Zhanpeng Zeng, Rudrasis Chakraborty, [Mingxing Tan](https://md.research.elamur.ai/free/en/authors/mingxing-tan/), Glenn Fung, [Yin Li](https://md.research.elamur.ai/free/en/authors/yin-li/) and Vikas Singh · **Year:** 2021 · **Venue:** Proceedings of the AAAI Conference on Artificial Intelligence · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**361** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W3173365702) · [Proceedings of the AAAI Conference on Artificial Intelligence](https://openalex.org/S4210191458) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/2102.03902)
- [DOI 10.1609/aaai.v35i16.17664](https://doi.org/10.1609/aaai.v35i16.17664)
- [arXiv 2102.03902](https://arxiv.org/abs/2102.03902)
- [OpenAlex](https://openalex.org/W3173365702)

Citations: OpenAlex, 2026-10-14.

## Deep dive: Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention

How Nyströmformer approximates self-attention with landmarks, reduces sequence-length costs, and performs in language and long-context tests. · about 33 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

Self-attention lets each position in a sequence draw information from every other position. That flexibility is useful, but it creates a computational problem: extending the sequence expands the set of pairwise comparisons quadratically. Nyströmformer addresses this bottleneck by replacing the full attention calculation with an approximation built around a smaller collection of representative queries and keys, called landmarks. The aim is to preserve the behavior of ordinary attention while making its memory use and computation grow linearly with sequence length when the landmark count remains fixed.

The paper adapts the Nyström method, a numerical technique for reconstructing a large matrix from smaller pieces. Applying that technique directly to attention would not solve the efficiency problem. Attention weights are normalized across complete rows, so even obtaining selected columns of the normalized matrix requires information from the full matrix of query–key scores. The authors move the approximation earlier: they construct landmarks before normalization, calculate smaller attention-like matrices involving those landmarks, and combine the results through a pseudoinverse. Their architecture also adds a convolutional connection from the values to help training.

The experiments examine both ordinary language-processing workloads and tasks with longer inputs. The authors replace attention inside BERT-based architectures, pretrain on BookCorpus and English Wikipedia, and then fine-tune on language-understanding tasks. They report behavior comparable to standard attention in pretraining and competitive downstream results. On Long Range Arena, their average classification accuracy exceeds standard attention by the reported +0.18%, while exceeding Reformer, Linformer, and Performer by +3.91%, +3.36%, and +5.32%, respectively. These are the authors’ reported comparisons; they do not establish that the approximation is equally suitable for every kind of long-context computation.

The practical contribution is a carefully arranged computation as much as a matrix approximation. Landmarks come from inexpensive segment averages, the pseudoinverse is approximated using matrix multiplications, and the factors are applied without constructing a full sequence-by-sequence matrix. The evidence supports a useful efficiency–accuracy tradeoff in the tested settings. It leaves open how landmark selection, approximation quality, and downstream behavior interact on substantially different data, architectures, and attention patterns.

### Ideas worth borrowing

Approximate before an expensive normalization. The central design choice is to introduce landmarks before the full softmax matrix exists. This works around a dependency that would otherwise preserve the original computational cost: a selected normalized entry still depends on the other scores in its row. The broader lesson applies whenever a supposedly cheap approximation needs costly intermediate quantities. Engineers should inspect the dependencies required to obtain the sampled object, instead of judging efficiency solely from the size of the final sample.

Use inexpensive representatives. Segment averages provide landmarks through a scan of the sequence, avoiding a separate clustering procedure inside every training batch. They sacrifice the flexibility of a more elaborate selection algorithm, but make their own cost predictable. This idea is useful when a representative set must be recomputed repeatedly and the selection procedure could become a bottleneck. A simple summary can be preferable when the surrounding learned system can adapt to its regularities.

Choose operations for the execution environment. The pseudoinverse is mathematically a familiar matrix operation, but the authors avoid relying on singular value decomposition during the main computation because it is inefficient on GPUs in their setting. They instead use an iterative approximation expressed through matrix products. This connects numerical method design to [GPU and parallel computing](https://md.research.elamur.ai/free/en/topics/gpu-parallel-computing/): mathematically equivalent or related procedures can have very different practical costs when mapped to a particular machine.

Preserve the factorization through execution. Writing attention as a product of smaller matrices is insufficient if an implementation multiplies those factors into a full attention matrix before applying the values. Nyströmformer’s complexity argument depends on arranging the multiplications so that the large intermediate never appears. The same principle applies to other factored computations: implementation order is part of the algorithm, because it determines which intermediate arrays must be stored and processed.

Combine global approximation with a direct path. Nyströmformer adds a depthwise convolutional connection from the values alongside the landmark-based calculation. The authors introduce it to assist training. As a reusable architectural idea, a compressed global operation can be paired with a simpler path that handles information more directly. The paper does not isolate the contribution of this connection, so it supports borrowing the design as a hypothesis instead of treating its benefit as separately established.

Evaluate quality and resources together. The paper examines prediction quality, runtime, and memory instead of assuming that favorable asymptotic complexity guarantees a useful system. It also tests both conventional language tasks and longer-sequence benchmarks. This approach is valuable throughout [efficient systems and compression](https://md.research.elamur.ai/free/en/topics/efficient-models/): the relevant question is whether a resource saving survives contact with the workload while preserving the behavior that matters.

Separate numerical fidelity from task usefulness. An approximation can resemble ordinary attention numerically, support similar pretraining behavior, and still require downstream evaluation. The authors offer several kinds of evidence instead of using an attention visualization as a substitute for task results. Researchers can reuse this separation when changing a learned component: inspect the immediate numerical effect, then test whether the complete system retains its useful capabilities.

### How Mova uses it

For Mova, the small transparent language system written in Rust, Nyströmformer offers a possible design for sequence-wide interaction under a limited computational budget. Its relevance is conditional: if a component needs each position to gather information from a long input, landmarks could provide a cheaper route than calculating every pairwise interaction. The paper gives a concrete candidate for that component, but it does not establish that Mova currently contains a Nyström attention implementation.

A transparent implementation could expose the segment boundaries, the query and key landmarks, and the smaller matrices used to produce an output. These objects have a clear computational role. A reader could follow how input positions contribute to segment summaries, how those summaries interact, and how their information returns to individual positions. That would make the approximation inspectable as a numerical procedure.

Such visibility should not be confused with a complete explanation of linguistic behavior. A landmark is an average of learned vectors, not an explicitly labeled grammatical category or a human-readable claim. Similarly, a matrix connecting positions to landmarks records a computational relationship, but does not by itself establish why a linguistic judgment is correct. For Mova’s emphasis on transparency, the useful distinction is between exposing the calculation and explaining the meaning of what the calculation represents. The paper primarily helps with the former.

The segment-mean design is particularly relevant to an implementation that values simple, explicit operations. It needs a sequence scan and arithmetic averages rather than an internal clustering loop. The inverse approximation also follows an inspectable sequence of matrix products. These are possible engineering advantages, not evidence about performance in Rust: the paper’s experiments use other implementation settings and do not benchmark Mova.

A sensible adaptation would retain an exact attention calculation as a reference for manageable inputs. The landmark version could then be examined for numerical agreement, task behavior, memory requirements, and runtime under the same conditions. This follows the paper’s distinction between approximation quality and practical usefulness. It would also reveal whether the cost of the landmark core and its pseudoinverse is justified for Mova’s actual sequence lengths.

The additional convolutional path would deserve separate scrutiny. It belongs to the reported architecture, yet its individual effect is not established by an isolated comparison. Mova could explore the full design and a version without that path, while recording the architectural distinction clearly. That is a proposed investigation, not a feature demonstrated by this paper.

The most useful borrowing may therefore be the decomposition itself: summarize a long sequence, compute interactions among the summaries, and apply the result without materializing a full pairwise matrix. Whether Mova should adopt this particular decomposition depends on its workload and on measurements within its own implementation. Nyströmformer supplies a plausible mechanism and a set of evaluation questions, rather than evidence that the mechanism has already been integrated.

### The problem and its context

#### Why attention becomes expensive

The [Transformer and attention](https://md.research.elamur.ai/free/en/concepts/transformer/) architecture gives a sequence position access to information throughout an input. Each position has a query describing what it seeks, while positions also provide keys and values. Queries are compared with keys to determine how strongly the corresponding values should contribute to an output.

This arrangement avoids restricting communication to nearby positions. A position can place substantial weight on another position even when they are far apart in the sequence. The paper treats that broad interaction pattern as a central source of attention’s usefulness in [natural language processing](https://md.research.elamur.ai/free/en/concepts/natural-language-processing/).

The difficulty is that ordinary self-attention evaluates interactions across the complete set of position pairs. As sequence length increases, both the score matrix and the normalized attention matrix grow quadratically. The same mechanism that makes distant interactions readily available therefore creates a substantial memory and computation burden.

The authors situate the problem in the success of Transformer-based systems across translation, inference, paraphrase detection, classification, and [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/). They cite [Attention Is All You Need](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/) as a foundational attention-based architecture and [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/) as an important pretrained system. Their motivation is to make the attention component more economical while retaining the behavior that made these architectures useful.

The paper gives a training-cost example to convey the scale of the problem: BERT-large would require 4 months on a single Tesla V100 GPU, compared with 4 days on a 4x4 TPU pod. These figures concern a complete training workload. They motivate resource efficiency, but they do not mean that changing attention alone removes all the other costs of training.

The introduction also identifies a sequence length of 2048 as an example where ordinary attention becomes expensive. The relevant obstacle is not that such a sequence lacks useful information. It is that providing unrestricted pairwise access to that information becomes costly.

#### Earlier routes to efficiency

The paper distinguishes changes to attention from other ways of reducing Transformer resource requirements. Parameter pruning, factorization, quantization, and distillation can make a system smaller or cheaper in different ways. The cited examples include [Are Sixteen Heads Really Better than One?](https://md.research.elamur.ai/free/en/papers/michel-2019-sixteen-heads-really-better-than/), [ALBERT](https://md.research.elamur.ai/free/en/papers/lan-2019-albert-lite-bert-self-supervised/), and [DistilBERT](https://md.research.elamur.ai/free/en/papers/sanh-2019-distilbert-distilled-version-bert-smaller/). These approaches provide context for efficiency work, but they do not all address the sequence-by-sequence attention matrix through the same mechanism.

Other techniques change the training process or the arrangement of computation. The authors mention micro-batching and gradient checkpointing, as well as approaches involving different pretraining objectives and memory structures. This matters because attention approximation is one intervention within a larger system. It can complement other efficiency techniques without replacing their roles.

Within attention itself, sparse methods reduce the set of interactions that are explicitly evaluated. The paper describes [Sparse Transformers](https://md.research.elamur.ai/free/en/papers/child-2019-generating-long-sequences-sparse-transformers/) as using a sparse factorization to reduce complexity. It describes [Reformer](https://md.research.elamur.ai/free/en/papers/kitaev-2020-reformer-efficient-transformer/) as using locality-sensitive hashing to reduce the number of relevant dot products. These approaches change how positions are grouped or connected so that the computation does not cover every possible pair directly.

[Longformer](https://md.research.elamur.ai/free/en/papers/beltagy-2020-longformer-long-document-transformer/) combines attention within local windows with global attention selected for the task. [Big Bird](https://md.research.elamur.ai/free/en/papers/zaheer-2020-big-bird-transformers-longer-sequences/) also uses a sparse attention pattern. In the authors’ account, these methods address long inputs by restricting or structuring the interactions that receive explicit computation.

A different family approximates the attention calculation algebraically. Linformer uses a projection along the sequence dimension. Other linearized approaches separate query and key computations through feature representations. The paper notes that some such approximations can depart substantially from the ordinary softmax matrix.

The concurrent [Performer](https://md.research.elamur.ai/free/en/papers/choromanski-2020-rethinking-attention-performers/) work uses positive orthogonal random features to approximate the softmax kernel. Nyströmformer belongs to the broader effort to avoid a dense attention computation, but its chosen mechanism is a landmark-based matrix reconstruction.

#### Why the Nyström method is a promising starting point

The classical Nyström idea is to reconstruct a large matrix using information from a smaller sampled part. A compact matrix captures relationships among representative points; additional factors describe how the remaining points relate to those representatives.

The paper reviews variants that change how representative points are selected or how the reconstruction is corrected. Its closest mathematical influences include methods for approximating general matrices from selected rows and columns. This general-matrix setting matters because the attention matrix is not assumed to have the symmetry of the kernel matrices associated with some familiar Nyström applications.

At first, attention appears well suited to this strategy. If its important structure can be summarized through a modest landmark set, there may be no need to calculate every interaction independently. The paper connects this possibility to earlier observations suggesting that attention can have low-rank structure.

The complication is normalization. The matrix that attention actually uses is obtained after applying softmax across each query’s complete set of scores. A selected entry is therefore connected to scores outside the selected submatrix. Directly sampling the normalized matrix does not automatically provide a cheap way to obtain those samples.

Nyströmformer’s contribution lies in adapting the numerical idea to this dependency. The authors preserve the form of a landmark reconstruction while changing how its smaller factors are constructed. That adaptation creates the efficiency opportunity, and it also defines the approximation whose behavior must be tested.

### The method, step by step

#### Start with exact self-attention

Let the input be a sequence represented by a matrix. Its rows correspond to positions, and its columns contain the features available at each position.

```
Q = XW_Q
```

Here, X is the input matrix with n rows and d feature columns. W_Q is a learned projection with d input dimensions and d_q output dimensions. Q contains the resulting query vectors, with one query for each sequence position.

```
K = XW_K
```

W_K is the learned key projection, and K contains the key vectors. The paper uses matching query and key dimensions, so d_k equals d_q. This makes a query–key dot product well defined.

```
V = XW_V
```

W_V is the learned value projection. V contains the information that attention combines, and its feature dimension is d_v. Queries and keys determine the weights; values supply the content being weighted.

The normalized attention matrix is then:

```
S = softmax(QKᵀ / √d_q)
```

S has n rows and n columns. Kᵀ denotes the transpose of K, and √d_q scales the dot products. Softmax operates separately across each row. Within a row, it exponentiates the scores and normalizes them using their combined total.

The attention output is:

```
D(Q, K, V) = SV
```

D denotes the attention operation. Multiplying S by V forms a weighted combination of value vectors for every query position. The full matrix S represents the expensive part of the standard calculation: it connects the entire sequence to itself.

The important dependency is within a row of S. Knowing a query’s score against a selected key does not suffice to recover the corresponding normalized weight. The normalization also depends on that query’s scores against the remaining keys.

#### Understand the direct Nyström construction

To introduce the numerical method, the paper partitions the attention matrix around selected rows and columns.

```
S = [ A_S  B_S ; F_S  C_S ]
```

The bracket notation represents a block matrix, with the semicolon separating block rows. A_S is the m-by-m intersection of the selected rows and columns. B_S connects selected rows to the remaining columns. F_S connects the remaining rows to selected columns, while C_S covers the unsampled remainder.

A singular value decomposition of the small intersection is:

```
A_S = UΛRᵀ
```

U and R are orthogonal matrices, and Λ contains the singular values on its diagonal. The letter R is used here for the right singular vectors so that it remains distinct from the value matrix V. This decomposition provides a way to construct the Moore–Penrose pseudoinverse.

The reconstruction has the form:

```
Ŝ = [ A_S ; F_S ] A_S⁺ [ A_S  B_S ]
```

Ŝ denotes the approximation to S, and A_S⁺ is the pseudoinverse of A_S. The left factor contains selected columns; the right factor contains selected rows. The middle factor adjusts for their shared intersection.

The missing block is reconstructed through:

```
Ĉ_S = F_S A_S⁺ B_S
```

Ĉ_S is the estimate of C_S. This equation expresses the basic approximation: relationships in the unobserved part are inferred from connections through the sampled part.

The pseudoinverse extends the role of an inverse to matrices that may be singular. That is useful because representative points can produce redundant relationships, so invertibility should not be assumed without qualification.

However, this reconstruction is not yet an efficient attention algorithm. To obtain the selected normalized columns, one still needs each relevant row’s normalization across the full key sequence. The apparent saving in reconstruction does not eliminate the cost of obtaining the inputs to that reconstruction.

#### Move the representatives before softmax

Nyströmformer constructs representative queries and representative keys directly from Q and K. Denote their matrices by Q̃ and K̃. Each has m rows rather than n rows.

The first factor connects every original query to the key landmarks:

```
F = softmax(QK̃ᵀ / √d_q)
```

F is an n-by-m matrix. Its rows are normalized across the m key landmarks. It is calculated directly from queries and key representatives, so it does not require a normalized submatrix of the complete attention matrix.

The central factor connects query landmarks to key landmarks:

```
A = softmax(Q̃K̃ᵀ / √d_q)
```

A is an m-by-m matrix. It plays the role of the small landmark core. Though it resembles the sampled intersection in the classical construction, it is formed from landmark vectors before softmax, rather than extracted from the full normalized attention matrix.

The final factor connects query landmarks to all original keys:

```
B = softmax(Q̃Kᵀ / √d_q)
```

B has m rows and n columns. Its rows are normalized across the complete key sequence. There are only m such rows, so this calculation avoids the full set of n query rows.

The resulting approximation is:

```
Ŝ = FA⁺B
```

F maps original query positions into the landmark calculation. A⁺ adjusts that calculation through the pseudoinverse of the landmark core. B connects the landmark queries back to the original key positions.

This is the essential change from direct Nyström sampling. The smaller factors have their own normalization domains. They are not simply the corresponding entries of S obtained more cheaply. Their product is intended to approximate S, and its usefulness depends on how well that altered construction preserves the relevant relationships.

Computing Nyströmformer attention The steps in order.

#### How the feature derivation leads to the product

The paper derives the matrix product through feature representations associated with the landmarks. For an individual query, its similarities to key landmarks provide a compact vector. For an individual key, the corresponding column from landmark-query attention provides another compact vector.

The singular value decomposition of the landmark core is:

```
A = UΛRᵀ
```

A is the landmark-to-landmark softmax matrix. U and R again contain left and right singular vectors, while Λ contains singular values. This is the same decomposition pattern used in the classical construction, now applied to the landmark-generated core.

For a query q, the compact feature representation can be written as:

```
φ_K̃(q) = Λ⁻¹ᐟ²Rᵀκ_K̃(q)ᵀ
```

φ_K̃(q) is the query’s transformed landmark feature vector. κ_K̃(q) is the row of softmax weights between q and the key landmarks. The transpose turns that row into a column, and Λ⁻¹ᐟ² rescales the singular directions.

The matching key feature is:

```
φ_Q̃(k) = Λ⁻¹ᐟ²Uᵀκ_Q̃(k)
```

φ_Q̃(k) is the transformed feature for key k. κ_Q̃(k) denotes the corresponding column associated with k in the landmark-query factor B. Its entries therefore come from the row-normalized landmark-to-key calculation.

An approximate attention entry is obtained from:

```
Ŝ_ij = φ_K̃(q_i)ᵀφ_Q̃(k_j)
```

The indices i and j identify an original query and an original key. The inner product combines their compact feature vectors. Expanding this expression introduces the inverse of the landmark core when that inverse exists.

Replacing the ordinary inverse with a pseudoinverse gives the general factorized construction. This derivation explains why the central correction appears: the outer factors alone do not account for how the landmark relationships overlap.

The operational algorithm does not need to build these feature vectors through a singular value decomposition at every step. The derivation supplies the mathematical connection, while the implementation uses an iterative pseudoinverse approximation.

#### Select landmarks with segment averages

The authors consider clustering as a possible way to obtain representative points. In particular, they mention K-means. Its repeated assignment and update operations, however, are inconvenient inside mini-batch training.

Their chosen alternative is Segment-means. The sequence is divided into contiguous segments, and queries within a segment are averaged to obtain a query landmark. Keys are averaged in the corresponding way to obtain key landmarks.

The nominal segment length is:

```
l = n / m
```

Here, l is the length of a segment, n is the input length, and m is the number of landmarks. The description assumes divisibility and notes that padding can provide it.

Averaging is inexpensive because the algorithm can accumulate the required segment summaries while scanning the input. It also preserves a connection to sequence position: each landmark summarizes a contiguous region rather than an arbitrary cluster scattered across the sequence.

This design introduces a clear approximation pressure. Different positions within a segment may have different roles, yet their query or key vectors contribute to the same average. Whether the resulting representative retains what a task needs is an empirical question.

The authors report that 64 landmarks frequently provide a useful approximation, while explicitly qualifying that observation by application. It is a practical setting, not a guarantee that every sequence or task can be summarized adequately by that landmark count.

There is also a notation issue in the printed segment-mean equation: its summation range and divisor use m even though the accompanying definition introduces l as the segment length. The verbal procedure is contiguous-segment averaging. An implementation needs to resolve that mismatch consistently with the intended procedure.

#### Approximate the pseudoinverse with matrix products

A singular value decomposition can calculate a pseudoinverse, but the authors regard it as inefficient on GPUs for their setting. They instead use an iterative method whose main operations are matrix multiplications.

The update is:

```
Z_(j+1) = ¼ Z_j(13I − AZ_j(15I − AZ_j(7I − AZ_j)))
```

Z_j is the current approximation to A⁺, and Z_(j+1) is the next approximation. A is the landmark core. I is the identity matrix with matching dimensions. The nested polynomial refines the inverse estimate through repeated multiplication with A.

The initialization is:

```
Z_0 = Aᵀ / (‖A‖₁‖A‖∞)
```

Z_0 is the starting estimate. Aᵀ is the transpose of A. The matrix norm ‖A‖₁ is the largest absolute column sum, and ‖A‖∞ is the largest absolute row sum. Their product scales the transpose before iteration.

The convergence statement uses a condition on the starting approximation:

```
‖AA⁺ − AZ_0‖ < 1
```

A⁺ is the target pseudoinverse, and the norm measures the discrepancy between AA⁺ and AZ_0. Under the stated condition, the cited iteration converges with third-order behavior.

For a nonsingular core, the paper relates the condition to the identity matrix. For the more general case, the authors support their initialization with experimental behavior rather than a universal guarantee for every possible landmark matrix.

They report using about 6 iterations to obtain a satisfactory approximation in their experiments. This introduces another approximation layer: even after choosing the landmark construction, the pseudoinverse is represented by a finite iterative result.

The practical attraction is that the iteration uses operations already central to deep-learning computation. The paper also notes that gradients can be propagated through the resulting matrix-product calculation.

#### Apply the approximation without constructing it

With the final inverse estimate denoted by Z⋆, approximate attention becomes:

```
ŜV = FZ⋆BV
```

ŜV is the output approximation. F and B are the outer softmax factors, Z⋆ approximates the pseudoinverse of the landmark core, and V is the original value matrix.

This expression should be evaluated through smaller intermediate products. The paper first forms a product involving F and Z⋆, and separately combines B with V. Those results are then multiplied to produce the output.

The point is operationally important. Constructing Ŝ explicitly would create an n-by-n matrix and surrender the main memory saving. The factorization is useful because it can act on V without ever becoming a dense attention matrix.

The architecture adds a parallel connection based on V, implemented with a depthwise convolution along the sequence. The authors describe this as helping training. It is part of the proposed system, even though the mathematical approximation can be described independently of it.

#### What the complexity claim assumes

The full time expression reported in the analysis is:

```
O(n + m³ + nm² + mnd_v + m³ + nmd_v)
```

n is sequence length, m is landmark count, and d_v is value dimension. The terms account for landmark construction, the inverse-related work, and the matrix products. The repeated cubic contribution reflects the accounting given in the paper.

The corresponding storage expression is:

```
O(md_q + nm + m² + mn + nd_v)
```

d_q is the query and key dimension. Storage includes the landmark vectors, the smaller attention factors, and arrays associated with the output computation.

These expressions make the meaning of linear scaling precise. If m and the feature dimensions are held fixed while n increases, the sequence-dependent terms grow linearly. The landmark core still has costs controlled by m, including a cubic inverse-related cost.

Hence, the method does not make all dimensions equally cheap to increase. Raising the landmark count can improve representational capacity, but it changes the resource tradeoff. The paper’s efficiency claim concerns growth with sequence length under a suitably small landmark configuration.

#### Pretrain and adapt the architecture

The authors test the component by substituting it for ordinary attention inside BERT-based architectures. They retain a transfer-learning procedure: large-corpus pretraining comes first, followed by supervised adaptation to individual tasks.

The pretraining corpus combines BookCorpus with English Wikipedia. The authors divide it into 80% training data and 20% validation data. They evaluate masked-language prediction and sentence-order prediction on the validation portion.

Masked-language prediction asks the system to recover hidden text elements from their context. Sentence-order prediction adds an objective concerning sentence ordering. The paper follows the combination associated with ALBERT rather than relying on masked prediction alone.

The optimizer is Adam, with batch size 256, learning rate 1e-4, β₁ set to 0.9, and β₂ set to 0.999. The reported L2 weight decay is 0.01. The learning rate warms up during the first 10,000 steps and then follows linear decay.

For the small architecture, pretraining lasts 0.1M steps. The base-size comparison uses 0.5M steps for both the baseline and Nyströmformer trained from scratch. Another Nyströmformer run starts from pretrained BERT-base and continues for approximately 0.25M steps.

The authors publish an official code repository and refer to supplementary material for additional implementation details. The experimental procedure is consequently presented as an implemented replacement for attention within a complete training pipeline, rather than solely as a matrix approximation evaluated in isolation.

### Experiments and results

#### What the evaluation is designed to establish

The experiments address related but distinct questions. Pretraining tests whether the replacement can support language-learning objectives. Downstream fine-tuning tests whether the resulting representations remain useful for supervised language tasks. Long Range Arena examines behavior on longer inputs, while a separate module benchmark measures runtime and memory.

These forms of evidence should be read together. A faster attention module would be of limited use if it seriously degraded prediction quality. Comparable task scores alone would also be insufficient to establish resource savings. The paper seeks a favorable combination instead of treating either side as enough.

The baselines vary by experiment. The small pretraining comparison includes ordinary attention, an ELU-based linearized alternative, and Linformer. The downstream comparison focuses on BERT-base. The long-sequence benchmark compares attention mechanisms within a shared Transformer configuration.

#### Language pretraining

BERT-small has 4 layers in the paper’s setup. The authors use it to compare pretraining behavior across attention alternatives without the full cost of the base architecture.

The reported validation curves track masked-language-modeling accuracy and sentence-order-prediction accuracy. Nyströmformer is described as competitive with ordinary attention and better than the tested linear alternatives in this comparison.

For the base architecture, the authors again report comparable pretraining behavior. They compare a baseline trained from scratch, Nyströmformer trained from scratch, and Nyströmformer initialized from pretrained standard BERT-base.

The initialization comparison matters because changing an attention mechanism need not require discarding all previously learned parameters. The paper observes faster progress when starting from the pretrained baseline. This is evidence about the tested adaptation route, rather than proof that any pretrained system can accept the substitution without further learning.

The training budgets are deliberately constrained. The authors state that a BERT-base run with 1M updates takes more than a week on 8 V100 GPUs. Their from-scratch base comparisons therefore use 0.5M steps.

This supports the fairness of comparing the baseline and replacement under the same stated budget. It also limits what can be concluded about performance under substantially longer training. The experiment establishes competitive behavior within the chosen regime.

#### Runtime and memory of the attention module

The efficiency benchmark generates random inputs and passes them through attention modules. Sequence lengths are 512, 1024, 2048, 4096, and 8192. All methods are measured on the same machine using a Nvidia 1080Ti.

The measured quantities are average runtime in milliseconds and memory consumption in megabytes for an input instance. These measurements concern the attention component. They should not be read as complete end-to-end training costs for an entire language system.

The configurations include Nyströmformer with 64 landmarks and with 32 landmarks. Linformer uses projection dimension 256. Longformer uses a sliding window of 257.

At sequence length 8192, the paper reports 1.2× memory savings and 3× speedup against Longformer. Against Linformer at that length, it reports 1.7× memory savings with similar runtime.

These comparisons show why the exact implementation and configuration matter. Methods with linear sequence-length complexity can still differ materially in memory consumption and execution time. Their smaller internal dimensions, intermediate arrays, and supported operations affect practical performance.

The random-input benchmark also has a specific role. It isolates resource use under controlled shapes. It does not measure how much useful information a real document contributes, or whether a particular long-context task requires more landmarks to maintain its quality.

#### Downstream language understanding

The supervised language evaluation draws from [GLUE](https://md.research.elamur.ai/free/en/papers/wang-2018-glue-multi-task-benchmark-analysis/) and an IMDB review-classification task. The paper includes SST-2 and MRPC, together with QNLI, QQP, and MNLI.

These tasks test different kinds of sentence-level behavior. SST-2 and the review task concern [sentiment analysis](https://md.research.elamur.ai/free/en/topics/sentiment-emotion/). The paraphrase tasks examine relationships between differently worded text, while the inference-related tasks test other aspects of language understanding.

The authors fine-tune on each task’s training data and report validation-set performance. MRPC and QQP use F1; the other reported tasks use accuracy. These metrics should not be conflated: an F1 result for paraphrase classification is not the same quantity as an accuracy result for another task.

For the larger fine-tuning datasets, the reported procedure uses batch size 32, AdamW, learning rate 3e-5, and 4 epochs. MRPC receives a separate hyper-parameter search because the authors consider the smaller dataset more sensitive to the fine-tuning setup.

The MRPC search considers batch sizes 8, 16, and 32. Candidate learning rates are 2e-5, 3e-5, 4e-5, and 5e-5. The selected result is the best validation outcome under that search.

The paper characterizes Nyströmformer as competitive with BERT-base across the downstream tasks. Its main claim is preservation of useful performance while replacing the expensive attention mechanism. The discussion does not provide a basis for claiming a uniform improvement on every measure.

The authors also compare longer input settings for fine-tuning. They describe IMDB validation accuracy as nearly unchanged between sequence lengths 1024 and 512, reporting 93.0 and 93.2 respectively.

IMDB validation accuracy by Nyströmformer input length The longer input setting produces almost the same validation accuracy.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Nyströmformer, length 1024 | 93.0 |
| Nyströmformer, length 512 (this paper) | 93.2 |

This comparison supports a narrow conclusion: the longer setting does not materially alter the reported review-classification outcome. It does not establish that longer inputs are always unhelpful, or that this task requires the full extra context to make its predictions.

#### Long Range Arena

Long Range Arena broadens the evaluation beyond conventional sentence-level language tasks. The benchmark includes ListOps, byte-level review classification, and byte-level document retrieval. It also includes image classification over pixel sequences and Pathfinder.

These tasks create different kinds of demands on a sequence-processing architecture. Some involve text, while others represent visual inputs as sequences. The common concern is whether efficient attention can support useful computation when inputs are long.

The reported metric is classification accuracy for each task, together with an average across tasks. The authors follow the benchmark’s train/test divisions and evaluation procedure.

Their implementation choice is important. The official benchmark uses Jax/Flax, while the attention baselines in this study use PyTorch. To compare methods within a common setting, the authors reimplement the benchmark in PyTorch and check its behavior.

Every method in this comparison uses an architecture with 2 layers, embedding dimension 64, hidden dimension 128, and 2 attention heads. Mean pooling produces the sequence-level representation used by the task output.

The attention alternatives receive explicit internal settings. Reformer uses 2 hashes. Linformer has projection dimension 256, and Performer uses random feature dimension 256. These details identify the configurations to which the reported comparisons apply.

Nyströmformer’s average accuracy is reported as +0.18% relative to standard attention. The corresponding reported advantages over Reformer, Linformer, and Performer are +3.91%, +3.36%, and +5.32%.

These figures support the paper’s claim that its approximation retains useful behavior across the tested long-sequence tasks. They also show a stronger average result than the selected efficient alternatives under the shared setup.

The authors flag a discrepancy with earlier benchmark results: retrieval accuracy is higher for all methods in their reimplementation. That qualification matters. It suggests that the internal comparison is more directly interpretable than treating these numbers as interchangeable with results from a different implementation.

The long-range results and the module benchmark are complementary, but they are not identical experiments. The former measures task quality within shared architectures; the latter measures resource use on controlled random inputs. Together they support the proposed tradeoff without constituting a complete measurement of every task’s end-to-end cost.

### What the ablations show

The paper does not present a systematic component-by-component ablation study; it instead offers configuration comparisons, training analyses, an approximation illustration, and an idealized mathematical result.

#### Changing the landmark count

The efficiency study includes versions with 32 and 64 landmarks. This comparison makes landmark count an explicit resource setting rather than an invisible implementation detail.

More landmarks enlarge the factors that connect the sequence to its representatives. They also enlarge the central matrix whose pseudoinverse must be approximated. The complexity analysis explains why changing this setting affects costs beyond the sequence scan.

The authors’ statement that 64 landmarks often suffice is useful practical guidance, but it does not replace a task-by-task sensitivity analysis. The paper does not establish a general rule mapping sequence length or task difficulty to a necessary landmark count.

The distinction matters for interpretation. A fixed landmark count creates favorable sequence-length scaling, while preserving accuracy may sometimes motivate changing that count. The reported experiments show that useful settings exist in their workloads, not that landmark capacity can remain unchanged under every distribution shift.

#### Starting from pretrained parameters

The base-size pretraining comparison includes a Nyströmformer initialized from standard pretrained BERT-base. Its faster training progress suggests that the replacement can make use of parameters learned before the attention mechanism is changed.

This is a meaningful controlled comparison because it concerns a practical adaptation strategy. It asks whether the numerical replacement can fit into an existing pretraining trajectory rather than requiring every parameter to be relearned from the beginning.

However, the training durations differ between initialization regimes. The approximately 0.25M-step continuation is not the same experiment as a 0.5M-step run from scratch. The result is evidence for a useful starting point, rather than an isolated measurement of attention quality independent of training history.

#### Increasing the input length

The IMDB comparison examines sequence lengths 1024 and 512. Its nearly unchanged validation accuracy shows stability for that task under the longer input setting.

This result is weaker than a demonstration that the architecture uses difficult long-distance evidence. An input-length change can test compatibility with longer sequences without proving that the task’s decisions depend on information near the end of those sequences.

Long Range Arena supplies a broader long-input evaluation, but the paper does not use the IMDB comparison to identify exactly which relationships are preserved or lost by segment averaging.

#### Visual and mathematical evidence

An attention illustration places the approximation alongside ordinary attention. The patterns appear similar, supporting the intuition that the landmark construction can preserve recognizable structure.

A visualization has a limited evidential role. It cannot establish how frequently close agreement occurs across layers, heads, inputs, and tasks. The paper does not turn that example into a comprehensive distribution of numerical approximation errors.

The mathematical lemma describes an idealized coverage condition: if the landmarks include representatives matching all original queries and keys, the approximate computation recovers exact attention behavior. This is a consistency result for a sufficiently complete landmark set.

It does not establish an error guarantee for a small set of segment means. In that practical setting, the representatives need not coincide with the original vectors. The authors connect possible accuracy to spectral structure and earlier low-rank observations, while leaving stronger guarantees as a possibility.

Finally, the convolutional value connection is included to assist training, but its effect is not separately isolated. The experiments assess the proposed architecture as a whole. They cannot identify how much of its downstream performance should be attributed to that connection alone.

### Limitations

#### Limits the authors acknowledge

The authors explicitly constrain the breadth of their efficiency comparisons. They describe the rapidly expanding set of attention alternatives and the computational burden of an exhaustive evaluation. Their runtime and memory study therefore covers selected methods instead of the entire efficient-attention field.

They also limit the pretraining budget. The base-size systems trained from scratch receive 0.5M updates because of compute costs. This is a reasonable experimental choice, but it defines the setting in which the reported parity with ordinary attention is observed.

Landmark adequacy is another stated qualification. The authors say that 64 landmarks frequently work well, while noting that suitability depends on the application. The paper therefore does not prescribe a universal landmark count.

The pseudoinverse discussion also distinguishes mathematical conditions from empirical practice. The convergence statement requires an appropriate initialization. The authors provide a clearer argument in the nonsingular case and report satisfactory experimental behavior more generally.

Finally, the PyTorch Long Range Arena reimplementation produces higher retrieval results than the earlier benchmark for all compared systems. The authors disclose that difference. It limits direct comparisons across implementations even though it does not invalidate comparisons performed within their common setup.

#### Limits visible in the experimental design

A careful reader should distinguish linear sequence-length scaling from a guarantee about complete-system speed. The complexity analysis concerns the approximate attention calculation. Projection layers, feed-forward computation, optimization, and task-specific processing remain part of a complete system.

The efficiency measurements use attention modules with random inputs on a particular GPU. They provide evidence about those implementations and shapes. They do not establish identical savings on every device, under every batch arrangement, or during every stage of training and inference.

Likewise, the language evaluation is based on BookCorpus and English Wikipedia pretraining followed by selected downstream tasks. It does not test multilingual transfer, specialized scientific language, or every form of document-level reasoning. Those would require additional evidence rather than extrapolation from the reported validation scores.

The reported downstream numbers are validation results. In MRPC, validation performance also guides hyper-parameter selection. That procedure should remain visible when interpreting the results: a selected validation outcome has a different role from a final evaluation kept separate from all tuning.

The long-range benchmark uses a compact shared architecture. This helps isolate the attention mechanism, but it also sets the scale of the comparison. Results from that architecture do not automatically describe what happens when depth, width, training data, or the output objective changes substantially.

#### Approximation capacity is finite

The landmark count is a capacity choice. A long sequence may contain many distinct relationships, while the approximation routes its interaction structure through a much smaller core.

Segment averaging also introduces an assumption about what can be summarized together. Adjacent positions contribute to the same representative even when their learned vectors differ substantially. The paper’s results show that this can work, but they do not characterize all cases where averaging removes important distinctions.

The idealized exactness lemma does not resolve this issue. Its coverage condition is much stronger than having a modest collection of averages. Exact recovery under complete representative coverage should not be mistaken for a bound on the practical approximation error.

There are also distinct sources of numerical discrepancy. The landmark construction differs from exact attention, and the finite inverse iteration differs from an exact pseudoinverse. The paper combines them successfully in its experiments without presenting a broad analysis that separates their error contributions.

The notation inconsistencies in parts of the derivation deserve practical attention. In addition to the segment-mean indexing issue, individual-vector expressions can obscure which normalization is intended for a column of the landmark-to-key matrix. The full matrix construction makes the operational meaning clearer: softmax is applied across rows of each factor. Implementations should follow a dimensionally consistent reading of that construction.

#### What competitive accuracy does not establish

A comparable average benchmark score does not prove that the approximation preserves every behavior of standard attention. Different mechanisms may succeed on the same classification task while attending to different evidence or making different errors.

The paper does not offer a detailed error taxonomy showing which linguistic or structural cases improve or deteriorate. It also does not isolate a universal reason for its advantage over each efficient baseline. The comparisons demonstrate outcomes under selected configurations, rather than a complete causal account of those outcomes.

Likewise, the convolutional path complicates attribution. It may be a useful part of the architecture, but without a comparison that removes it, the results cannot establish how the landmark approximation alone would perform.

There is no evaluation of Mova, and no Rust performance study. Any application to that system remains a proposal requiring implementation and measurement. The paper provides an algorithmic option, not evidence of an existing integration.

The strongest supported conclusion is therefore specific: landmark-based attention, constructed before full softmax and evaluated through smaller matrix products, can preserve competitive task performance while reducing the measured resource requirements of attention in the authors’ experiments. Broader claims require broader tests.

### What came after

Later citations place Nyströmformer within several continuing research questions: how to mediate access to large inputs, how to balance recall against throughput, how to organize efficient language architectures, and how to adapt pretraining to a domain. A citation establishes that a work engages with the research context. It does not on its own establish that the later architecture implements the landmark construction.

#### Attention through a smaller interface

[Perceiver: General Perception with Iterative Attention](https://md.research.elamur.ai/free/en/papers/jaegle-2021-perceiver-general-perception-iterative-attention/) belongs to the later citation record. Its title identifies general perception and iterative attention as its focus.

That makes it relevant to the broad question Nyströmformer raises: how can attention support access to large or varied inputs without making unrestricted pairwise interaction the only available design? The citation relationship connects the works historically. It is not enough to conclude that Perceiver uses segment means, the same pseudoinverse iteration, or the same softmax factorization.

The distinction preserves the specificity of Nyströmformer’s contribution. A smaller computational interface can be a shared concern across research while the mechanism for constructing and using that interface differs.

#### Long context and retrieval

[Retrieval meets Long Context Large Language Models](https://md.research.elamur.ai/free/en/papers/xu-2023-retrieval-meets-long-context-large/) brings long context together with retrieval. Its title points toward a question adjacent to attention efficiency: what information should a language system access, and through which route?

Nyströmformer primarily addresses the cost of processing a sequence already supplied to the architecture. Retrieval concerns access to relevant information. These questions can interact, but the citation does not establish that the later work adopts Nyströmformer’s internal attention factors.

[Simple linear attention language models balance the recall-throughput tradeoff](https://md.research.elamur.ai/free/en/papers/arora-2024-simple-linear-attention-language-models/) names a tradeoff that is especially relevant to reading Nyströmformer carefully. Throughput concerns processing efficiency, while recall concerns retaining useful access to information.

Nyströmformer demonstrates favorable task outcomes under its chosen compression mechanism. The later title points toward continued examination of what efficient attention preserves as well as how quickly it runs. No specific result or landmark-based implementation can be inferred from the citation alone.

#### Efficient language architectures

[A Survey of Small Language Models](https://md.research.elamur.ai/free/en/papers/nguyen-2024-survey-small-language-models/) cites Nyströmformer within a broader literature concerned with smaller language systems. That connection fits the paper’s resource-efficiency motivation.

However, reducing attention’s sequence-length cost and reducing an architecture’s parameter count are distinct interventions. Nyströmformer directly addresses the former. Its presence in a survey of small systems should not be read as evidence that its approximation automatically supplies every benefit associated with a smaller system.

[PanGu-π: Enhancing Language Model Architectures via Nonlinearity Compensation](https://md.research.elamur.ai/free/en/papers/wang-2023-pangu-pi-enhancing-language/) identifies another architectural direction in the later citation record. Its title emphasizes nonlinearity compensation rather than Nyström reconstruction.

The relevant connection is the continued search for architectural changes that improve the balance between computation and useful behavior. The citation establishes engagement with that literature, while leaving the precise technical relationship to the later work’s own account.

#### Domain-specific pretraining

[The Word and the Way: Strategies for Domain-Specific BERT Pre-Training in German Medical NLP](https://md.research.elamur.ai/free/en/papers/he-2026-word-way-strategies-domain-specific/) places the citation in a domain-specific pretraining context. Its title identifies German medical language processing and BERT pretraining strategies as the subject.

Nyströmformer’s own experiments also use a BERT-based transfer-learning procedure, but on the English corpora and tasks described earlier. That shared architectural context helps explain why attention efficiency can be relevant to later pretraining research without establishing a direct implementation link.

Taken together, these later citations show the range of questions in which Nyströmformer remains relevant. The durable idea is concrete: a representative set can mediate sequence-wide interaction, provided the approximation is introduced early enough to avoid the expensive full computation. The paper’s lasting evaluation question is equally concrete: what useful behavior survives that change, and under which resource and training conditions?

## Cite

Cite as Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li and Vikas Singh. 2021. Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention. Proceedings of the AAAI Conference on Artificial Intelligence.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.1609/aaai.v35i16.17664](https://doi.org/10.1609/aaai.v35i16.17664) · [arXiv 2102.03902](https://arxiv.org/abs/2102.03902)

```bibtex
@inproceedings{xiong2021nystromformer,
  title = {{Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention}},
  author = {Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li and Vikas Singh},
  booktitle = {Proceedings of the AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i16.17664},
  eprint = {2102.03902},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1609/aaai.v35i16.17664}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
