// Stage 4 · Transformers & LLMs
MoE & Beyond-Transformer Architectures
Sparse experts, load balancing, Mamba/SSMs, linear attention and hybrid architectures, diffusion language models.
about 10 hours18 algorithms5 paperslesson text in progress
01Goals
- Understand top-k routing and expert parallelism
- Distinguish total and active parameters
- Compare the complexity of Transformers and SSMs
Do these first: Modern LLM Architecture
02Algorithms to master
Each card has the original paper, prerequisites and resources.
03Must-read papers
- Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer ↗2017 ✓ verified in Essentials
- Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity ↗2021 ✓ verified
- DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models ↗2024 ✓ verified
- Mamba: Linear-Time Sequence Modeling with Selective State Spaces ↗2023 ✓ verified in Essentials
- Gated Delta Networks: Improving Mamba2 with Delta Rule ↗2024 ✓ verified
04Courses & videos
- Mixture of Experts Explained ↗ExplainersEN
- Get on the SSM train ↗ExplainersEN
- The Annotated S4 ↗ExplainersEN
- fla-org/flash-linear-attention ↗Reference codeEN
05Hands-on: project, code & exercises
Free, official or author-published pages. Most run in the browser or on a free Colab GPU.
PROJECT
Implement an 8-expert, top-2 MoE feed-forward layer to replace your small GPT’s FFN and watch the expert load distribution.
- 1fla-org/flash-linear-attention ↗Reference code
Swap a small model’s attention for linear-attention / Gated DeltaNet layers and compare.
- 2github.com ↗Reference code
Install Mamba, run the official example and compare inference speed with a Transformer.
06Self-test
Answer in your head, then open to check.
Why does MoE save compute but cost memory at inference?
Only a few experts run, but all expert weights must be loaded.
Why does Mamba need no KV cache at inference?
It uses a fixed-size recurrent state.
Why do hybrid architectures keep a few attention layers?
They provide precise retrieval and copying.
On these routes: Algorithm Researchers