Lune

ACL2021Top-tier venue

H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequences

Zhenhai Zhu, Radu Soricut

2021Year
24Top-tier citations

Abstract

We describe an efficient hierarchical method to compute attention in the Transformer architecture. The proposed attention mechanism exploits a matrix structure similar to the Hierarchical Matrix (H-Matrix) developed by the numerical analysis community, and has linear run time and memory complexity. We perform extensive experiments to show that the inductive bias embodied by our hierarchical attention is effective in capturing the hierarchical structure in the sequences typical for natural language and vision tasks. Our method is superior to alternative sub-quadratic proposals by over +6 points on average on the Long Range Arena benchmark. It also sets a new SOTA test perplexity on One-Billion Word dataset with 5x fewer model parameters than that of the previous-best Transformer-based models. Computing the similarity matrix S in Eq. ( 4 ) and the attention matrix A in Eq. ( 3 ) takes O(L 2 d) time and O(L 2 ) memory. Similarly, computing AV in Eq. (2) takes O(L 2 d) time, and computing A • 1 L in Eq. (5) takes O(L 2 ) time. The O(L 2 d) and O(L 2 ) complexities are the bottlenecks for applying the attention mechanism over very long sequences.

Ask about this paper

Your agent reads all of it.

Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.

Questions to start from

Your agent calls

Luneget_paper_fulltext

Ask in Lune

Free to start. No credit card required.

lune papers fulltext 20d46a70-ef83-4b77-b034-e6c7798a904f

Cited by top-tier papers24

Ask how each one uses it

Builds on7

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines