Machine LearningWikiPaths

Transformer Variants

Beyond vanilla attention. Explore fine-grained Mixture-of-Experts (MoE), linear attention, Mamba, Gated DeltaNet, and Byte-Latent Transformers.

Estimated time: ~120 min

Study this path with flashcards
8 cards
Study →
  1. Step 1
    Attention 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.
  2. Step 2
    A 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.
  3. Step 3
    A 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.
  4. Step 4
    Modern 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.
  5. Step 5
    Linear 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.
  6. Step 6
    State 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.
  7. Step 7
    Gated 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.
  8. Step 8
    Byte-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.