Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Nystr\"omformer: A Nystr\"om-Based Algorithm for Approximating Self-Attention

About

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\"{o}mformer -- a model that exhibits favorable scalability as a function of sequence length. Our idea is based on adapting the Nystr\"{o}m method to approximate standard self-attention with $O(n)$ complexity. The scalability of Nystr\"{o}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\"{o}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\"{o}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• 2021

Related benchmarks

TaskDatasetResultRank
Language ModelingWikiText-103 (test)
Perplexity34.29
524
Natural Language UnderstandingGLUE (dev)
SST-2 (Acc)91.4
504
Language ModelingWikiText-103 (val)
PPL33.15
180
Natural Language UnderstandingGLUE (val)
SST-291.4
170
Long-range sequence modelingLong Range Arena (LRA)
Text Accuracy65.75
164
Long-range sequence modelingLong Range Arena (LRA) (test)--
158
Long sequence classificationLRA (Long Range Arena) (test)
Average Accuracy65.75
92
Long-sequence modelingLong Range Arena (LRA) v1 (test)
ListOps37.15
66
ClassificationLRA ListOps N=2000 (test)
Accuracy37.34
39
Sequence ModelingLong Range Arena (val)
ListOps Accuracy37.15
26
Showing 10 of 21 rows

Other info

Code

Follow for update