Transformer Variants
Beyond vanilla attention. Explore fine-grained Mixture-of-Experts (MoE), linear attention, Mamba, Gated DeltaNet, and Byte-Latent Transformers.
Study this path with flashcards
8 cards
- Step 1Attention computes a context-dependent weighted combination of values, where the weights come from similarities between queries and keys. It lets a model focus on the most relevant parts of an input instead of compressing everything into one fixed vector.
- Step 2A sparse mixture-of-experts layer replaces one dense feed-forward block with many expert subnetworks, but routes each token to only a small subset such as top-1 or top-2 experts. This increases parameter count and specialization without increasing per-token compute proportionally.
- Step 3A sparsely-gated Mixture of Experts (MoE) layer routes each token to only a small subset of expert networks, so model capacity can grow much faster than compute per token. Its central challenge is routing and load balancing: without auxiliary losses, a few experts tend to monopolize traffic.
- Step 4Modern Mixture-of-Experts architectures replace a handful of coarse experts (such as 8× top-2 in Mixtral) with dozens or hundreds of fine-grained routed experts alongside always-active shared experts, and replace gradient-distorting auxiliary load-balancing losses with a dynamic per-expert router bias updated outside the computational graph.
- Step 5Linear attention is the family of attention mechanisms that rewrites or approximates softmax attention so sequence processing scales roughly linearly instead of quadratically with length. The benefit is efficiency on long contexts, but the tradeoff is that exact softmax behavior is usually lost.
- Step 6State space models such as Mamba process sequences by evolving a learned hidden state through recurrence rather than full quadratic attention. Their main appeal is linear-time sequence processing with strong long-context efficiency, especially when selective state updates let the model decide what to remember.
- Step 7Gated DeltaNet combines the exponentially gated memory decay of Mamba-2 with the associative delta update rule in a matrix-valued recurrent state. Whereas Mamba-style state spaces uniformly decay all state channels and uncalibrated delta rules cannot rapidly flush obsolete context, their product gives linear-time sequence models both fast global context resets and targeted key-value associative replacement — powering the 3:1 hybrid attention stacks in Qwen3-Next and Kimi Linear.
- Step 8Byte-Latent Transformers (BLT) eliminate fixed subword vocabularies (BPE/SentencePiece) by grouping raw UTF-8 bytes into variable-length patches bounded by next-byte entropy spikes. Lightweight local byte encoders and decoders bridge raw bytes to a heavy latent Transformer that runs only once per patch, allocating compute dynamically to unpredictability rather than static orthographic frequency.