Nyströmformer: A Nyström-Based Algorithm for Approximating Self-Attention
arXiv:2102.03902
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 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.
AAAI 2021; Code and supplement available at https://github.com/mlpen/Nystromformer
References in corpus (7)
- Language Models are Few-Shot Learners
- Linformer: Self-Attention with Linear Complexity
- Generating Long Sequences with Sparse Transformers
- Reformer: The Efficient Transformer
- Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Long Range Arena: A Benchmark for Efficient Transformers
- LambdaNetworks: Modeling Long-Range Interactions Without Attention
Cited by in corpus (9)
- XCiT: Cross-Covariance Image Transformers
- UFO-ViT: High Performance Linear Vision Transformer without Softmax
- The Sensory Neuron as a Transformer: Permutation-Invariant Neural Networks for Reinforcement Learning
- Scatterbrain: Unifying Sparse and Low-rank Attention Approximation
- Pixelated Butterfly: Simple and Efficient Sparse training for Neural Network Models
- FMMformer: Efficient and Flexible Transformer via Decomposed Near-field and Far-field Attention
- Linear Self-Attention Approximation via Trainable Feedforward Kernel
- Beyond Nyströmformer -- Approximation of self-attention by Spectral Shifting
- Detect the Interactions that Matter in Matter: Geometric Attention for Many-Body Systems