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

Luna: Linear Unified Nested Attention

About

The quadratic computational and memory complexities of the Transformer's attention mechanism have limited its scalability for modeling long sequences. In this paper, we propose Luna, a linear unified nested attention mechanism that approximates softmax attention with two nested linear attention functions, yielding only linear (as opposed to quadratic) time and space complexity. Specifically, with the first attention function, Luna packs the input sequence into a sequence of fixed length. Then, the packed sequence is unpacked using the second attention function. As compared to a more traditional attention mechanism, Luna introduces an additional sequence with a fixed length as input and an additional corresponding output, which allows Luna to perform attention operation linearly, while also storing adequate contextual information. We perform extensive evaluations on three benchmarks of sequence modeling tasks: long-context sequence modeling, neural machine translation and masked language modeling for large-scale pretraining. Competitive or even better experimental results demonstrate both the effectiveness and efficiency of Luna compared to a variety

Xuezhe Ma, Xiang Kong, Sinong Wang, Chunting Zhou, Jonathan May, Hao Ma, Luke Zettlemoyer• 2021

Related benchmarks

TaskDatasetResultRank
Image ClassificationCIFAR-100 (test)
Accuracy23.38
3518
Image ClassificationCIFAR-10 (test)
Accuracy47.86
3381
Long-range sequence modelingLong Range Arena (LRA)
Text Accuracy65.78
164
Long-range sequence modelingLong Range Arena (LRA) (test)
Accuracy (Avg)61.95
158
Long sequence classificationLRA (Long Range Arena) (test)
Average Accuracy61.24
92
Long-sequence modelingLong Range Arena (LRA) v1 (test)
ListOps37.98
66
Sequence ModelingLong Range Arena (val)
ListOps Accuracy37.25
26
Hierarchical ReasoningListOps Long Range Arena (test)
Accuracy37.25
26
Hierarchical reasoning on symbolic sequencesLong ListOps (test)
Accuracy37.25
22
Image ClassificationTriangle (test)
Accuracy57.26
14
Showing 10 of 10 rows

Other info

Follow for update