about
Linformer: Self-Attention with Linear Complexity (arxiv.org)
2 points by blopeur on Jun 10, 2020 | hide | past | pdf | discuss on HN

In plain words: Standard attention compares every word with every other word, so cost grows with the square of sequence length; this shows the comparison can be squeezed into a few summary positions instead. It matches a normal transformer's accuracy while memory and time grow with length.

Abstract

Large transformer models have shown extraordinary success in achieving state-of-the-art results in many natural language processing applications. However, training and deploying these models can be prohibitively costly for long sequences, as the standard self-attention mechanism of the Transformer uses $O(n^2)$ time and space with respect to sequence length. In this paper, we demonstrate that the self-attention mechanism can be approximated by a low-rank matrix. We further exploit this finding to propose a new self-attention mechanism, which reduces the overall self-attention complexity from $O(n^2)$ to $O(n)$ in both time and space. The resulting linear transformer, the \textit{Linformer}, performs on par with standard Transformer models, while being much more memory- and time-efficient.

Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, Hao Ma
arXiv:2006.04768 · cs.LG, stat.ML · submitted Jun 8, 2020 · updated Jun 14, 2020
abstract · pdf · html

add comment on HN