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

Sparse Modular Activation for Efficient Sequence Modeling

About

Recent hybrid models combining Linear State Space Models (SSMs) with self-attention mechanisms have demonstrated impressive results across a range of sequence modeling tasks. However, current approaches apply attention modules statically and uniformly to all elements in the input sequences, leading to sub-optimal quality-efficiency trade-offs. To address this limitation, we introduce Sparse Modular Activation (SMA), a general mechanism enabling neural networks to sparsely and dynamically activate sub-modules for sequence elements in a differentiable manner. Through allowing each element to skip non-activated sub-modules, SMA reduces computation and memory consumption of neural networks at both training and inference stages. To validate the effectiveness of SMA on sequence modeling, we design a novel neural architecture, SeqBoat, which employs SMA to sparsely activate a Gated Attention Unit (GAU) based on the state representations learned from an SSM. By constraining the GAU to only conduct local attention on the activated inputs, SeqBoat can achieve linear inference complexity with theoretically infinite attention span, and provide substantially better quality-efficiency trade-off than the chunking-based models. With experiments on a wide range of tasks, including long sequence modeling, speech classification and language modeling, SeqBoat brings new state-of-the-art results among hybrid models with linear complexity, and reveals the amount of attention needed for each task through the learned sparse activation patterns. Our code is publicly available at https://github.com/renll/SeqBoat.

Liliang Ren, Yang Liu, Shuohang Wang, Yichong Xu, Chenguang Zhu, ChengXiang Zhai• 2023

Related benchmarks

TaskDatasetResultRank
Character-level Language Modelingenwik8 (test)
BPC1.02
195
Long-range sequence modelingLong Range Arena (LRA) (test)
Accuracy (Avg)87.62
158
Audio ClassificationSpeech Commands (test)
Accuracy97.35
43
Sparse Retrieval in Continuous DynamicsSRCD
Dynamic MSE0.649
6
Activity RecognitionActivity
Accuracy38.6
4
Irregular Time Series ClassificationMIMIC-III
AUC-ROC0.783
4
Irregular Time Series ClassificationPhysioNet
AUC-ROC0.338
4
Showing 7 of 7 rows

Other info

Code

Follow for update