Nyströmformer is a method that builds "landmarks" from the sequence and approximates the attention matrix by a product of three small matrices that go through the landmarks. Xiong et al. at the University of Wisconsin–Madison proposed it in 2021 in the paper "Nyströmformer: A Nyström-Based Algorithm for Approximating Self-Attention" (AAAI 2021).
Standard multi-head attention computes weights for every pair of tokens in a sequence of length , so its computation and memory grow in proportion to . Nyströmformer applies the Nyström method, a numerical technique that reconstructs a large matrix from a subset of its rows and columns, to the softmax matrix of attention. If the number of landmarks is fixed far below , computation and memory grow in proportion to .
As an analogy: instead of building a table of how well every pair of students in a class ( students) get along, pick a representative from each group ( students), build only three tables, "students vs. representatives," "representatives vs. representatives," and "representatives vs. students," and combine them to estimate the table for the whole class.
The right side of the figure at the top of the article shows this approximation. The matrix is never built; instead, three matrices of size , , and are multiplied together.

