Mamba: Linear-Time Sequence Modeling with Selective State Spaces (Paper Explained)

#mamba #s4 #ssm OUTLINE: 0:00 - Introduction 0:45 - Transformers vs RNNs vs S4 6:10 - What are state space models? 12:30 - Selective State Space Models 17:55 - The Mamba architecture 22:20 - The SSM layer and forward propagation 31:15 - Utilizing GPU memory hierarchy 34:05 - Efficient computation via prefix sums / parallel scans 36:01 - Experimental results and comments 38:00 - A brief look at the code Paper: https://arxiv.org/abs/2312.00752 Abstract: Foundation models, now powering most of the exciting applications in deep learning, are almost universally based on the Transformer architecture and its core attention module. Many subquadratic-time architectures such as linear attention, gated convolution and recurrent models, and structured state space models (SSMs) have been developed to address Transformers' computational inefficiency on long sequences, but they have not performed as well as attention on important modalities such as language. We identify that a key weakness of such models is their inability to perform content-based reasoning, and make several improvements. First, simply letting the SSM parameters be functions of the input addresses their weakness with discrete modalities, allowing the model to selectively propagate or forget information along the sequence length dimension depending on the current token. Second, even though this change prevents the use of efficient convolutions, we design a hardware-aware parallel algorithm in recurrent mode. We integrate these selective SSMs into a simplified end-to-end neural network architecture without attention or even MLP blocks (Mamba). Mamba enjoys fast inference (5× higher throughput than Transformers) and linear scaling in sequence length, and its performance improves on real data up to million-length sequences. As a general sequence model backbone, Mamba achieves state-of-the-art performance across several modalities such as language, audio, and genomics. On language modeling, our Mamba-3B model outperforms Transformers of the same size and matches Transformers twice its size, both in pretraining and downstream evaluation. Authors: Albert Gu, Tri Dao Links: Homepage: https://ykilcher.com Merch: https://ykilcher.com/merch YouTube:    / yannickilcher   Twitter:   / ykilcher   Discord: https://ykilcher.com/discord LinkedIn:   / ykilcher   If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannick... Patreon:   / yannickilcher   Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n

Intuition behind Mamba and State Space Models | Enhancing LLMs!
▶︎

Intuition behind Mamba and State Space Models | Enhancing LLMs!

Retentive Network: A Successor to Transformer for Large Language Models (Paper Explained)
▶︎

Retentive Network: A Successor to Transformer for Large Language Models (Paper Explained)

Reinventing Entropy | Compression is Intelligence Part 1
▶︎

Reinventing Entropy | Compression is Intelligence Part 1

RWKV: Reinventing RNNs for the Transformer Era (Paper Explained)
▶︎

RWKV: Reinventing RNNs for the Transformer Era (Paper Explained)

Mastering Nonlinear & Polynomial Regression
▶︎

Mastering Nonlinear & Polynomial Regression

Flow Matching for Generative Modeling (Paper Explained)
▶︎

Flow Matching for Generative Modeling (Paper Explained)

MedAI #41: Efficiently Modeling Long Sequences with Structured State Spaces | Albert Gu
▶︎

MedAI #41: Efficiently Modeling Long Sequences with Structured State Spaces | Albert Gu

MAMBA from Scratch: Neural Nets Better and Faster than Transformers
▶︎

MAMBA from Scratch: Neural Nets Better and Faster than Transformers

Transformers, the tech behind LLMs | Deep Learning Chapter 5
▶︎

Transformers, the tech behind LLMs | Deep Learning Chapter 5

State Space Models (SSMs) and Mamba
▶︎

State Space Models (SSMs) and Mamba

MAMBA and State Space Models explained | SSM explained
▶︎

MAMBA and State Space Models explained | SSM explained

V-JEPA: Revisiting Feature Prediction for Learning Visual Representations from Video (Explained)
▶︎

V-JEPA: Revisiting Feature Prediction for Learning Visual Representations from Video (Explained)

Visualizing transformers and attention | Talk for TNG Big Tech Day '24
▶︎

Visualizing transformers and attention | Talk for TNG Big Tech Day '24

Mamba, Mamba-2 and Post-Transformer Architectures for Generative AI with Albert Gu - 693
▶︎

Mamba, Mamba-2 and Post-Transformer Architectures for Generative AI with Albert Gu - 693

Electro thermal Model of Lithium Battery Under Parametric Uncertainty
▶︎

Electro thermal Model of Lithium Battery Under Parametric Uncertainty

TokenFormer: Rethinking Transformer Scaling with Tokenized Model Parameters (Paper Explained)
▶︎

TokenFormer: Rethinking Transformer Scaling with Tokenized Model Parameters (Paper Explained)

Training Sand to Think: Artificial General Intelligence & Future of Physics
▶︎

Training Sand to Think: Artificial General Intelligence & Future of Physics

But what is a neural network? | Deep learning chapter 1
▶︎

But what is a neural network? | Deep learning chapter 1

Do we need Attention? - Linear RNNs and State Space Models (SSMs) for NLP
▶︎

Do we need Attention? - Linear RNNs and State Space Models (SSMs) for NLP

Mamba and S4 Explained: Architecture, Parallel Scan, Kernel Fusion, Recurrent, Convolution, Math
▶︎

Mamba and S4 Explained: Architecture, Parallel Scan, Kernel Fusion, Recurrent, Convolution, Math