about
Nyströmformer: A Nyström-Based Algorithm for Approximating Self-Attention (arxiv.org)
85 points by tmfi on Feb 11, 2021 | hide | past | pdf | 2 comments on HN

In plain words: Self-attention compares each word with all others, so the work grows with the square of sequence length. Nyströmformer estimates them with a matrix shortcut that scales linearly, matching or beating regular attention on standard tasks, and outperforming other efficient attention tricks on long ones.

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 with $O(n)$ complexity. The scalability of Nyströmformer enables application to longer sequences with thousands of tokens. We perform evaluations on multiple downstream tasks on the GLUE benchmark and IMDB reviews with standard sequence length, and find that our Nyströmformer performs comparably, or in a few cases, even slightly better, than standard self-attention. On longer sequence tasks in the Long Range Arena (LRA) benchmark, Nyströmformer performs favorably relative to other efficient self-attention methods. Our code is available at https://github.com/mlpen/Nystromformer.

Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, Vikas Singh
arXiv:2102.03902 · cs.CL, cs.LG · submitted Feb 7, 2021 · updated Mar 31, 2021
abstract · pdf · html · AAAI 2021; Code and supplement available at https://github.com/mlpen/Nystromformer

add comment on HN

Here's a nice video by Yannick Kilcher explaning the Nystromformer: https://www.youtube.com/watch?v=m-zrcmRd7E4

The benefits over regular transformers is that it is more efficient (does less operations), as the original transformer has a quadratic complexity in the number of input tokens.

It also links to a comparison that is not in the paper, against Performer, Linformer and Reformer:

https://twitter.com/tanmingxing/status/1359301186734620675