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


  • Yunyang Xiong University of Wisconsin-Madison
  • Zhanpeng Zeng University of Wisconsin-Madison
  • Rudrasis Chakraborty UC Berkeley
  • Mingxing Tan Google Brain
  • Glenn Fung American Family Insurance
  • Yin Li University of Wisconsin-Madison
  • Vikas Singh University of Wisconsin-Madison


Language Models


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.




How to Cite

Xiong, Y., Zeng, Z., Chakraborty, R., Tan, M., Fung, G., Li, Y., & Singh, V. (2021). Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention. Proceedings of the AAAI Conference on Artificial Intelligence, 35(16), 14138-14148. Retrieved from https://ojs.aaai.org/index.php/AAAI/article/view/17664



AAAI Technical Track on Speech and Natural Language Processing III