The Rabbit Hole / AI / Model architectures
Google DeepMind · Architecture mapGemma 4 E2B
A Gemma 3 style local and global stack that adds wider global heads and shared keys and values, plus per-layer embeddings.
Gemma 4 E2B, April 2026 · Gemma release timeline
Inside Gemma 4 E2B
Inside multi-query attention · Local layers (own keys and values)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside multi-query attention · Global layers (own keys and values)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside multi-query attention · Local layers (shared keys and values)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside multi-query attention · Global layers (shared keys and values)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Model-specific details
- Local layers (own keys and values) · 12 repetitions
- Sliding-window attention over 512 tokens, then a dense gated feed-forward network 6,144 wide.
- Per-layer embedding
- A 256-wide vector looked up per token for this layer, gated, projected and added after the feed-forward network.
- Global layers (own keys and values) · 3 repetitions
- Full attention over the context, then a dense gated feed-forward network 6,144 wide.
- Per-layer embedding
- A 256-wide vector looked up per token for this layer, gated, projected and added after the feed-forward network.
- Local layers (shared keys and values) · 16 repetitions
- Sliding-window attention over 512 tokens, then a dense gated feed-forward network 12,288 wide (double width). Keys and values come from an earlier layer; this layer computes none of its own.
- Reuses keys and values of layer 14
- Layers 16 to 35 compute no keys or values. They read those of the last earlier layer of the same type.
- Per-layer embedding
- A 256-wide vector looked up per token for this layer, gated, projected and added after the feed-forward network.
- Global layers (shared keys and values) · 4 repetitions
- Full attention over the context, then a dense gated feed-forward network 12,288 wide (double width). Keys and values come from an earlier layer; this layer computes none of its own.
- Reuses keys and values of layer 15
- Layers 16 to 35 compute no keys or values. They read those of the last earlier layer of the same type.
- Per-layer embedding
- A 256-wide vector looked up per token for this layer, gated, projected and added after the feed-forward network.
- Attention and positions
- 8 query heads. Local layers use 1 key/value head of 256 values over a 512-token window. Global layers use 512-wide heads, also with 1 key/value head and their own value projection (keys are not reused as values). Global layers rotate only a quarter of each head. The last 20 layers compute no keys or values of their own.
- Memory
- Local layers: keys and values for 1 head of 256 values over the last 512 tokens. Global layers: 1 head of 512 values. Layers 16 to 35 hold no cache: they read the keys and values of layer 14 (local) and layer 15 (global), so only 15 layers keep one.
Shared caches in the small stack
- Thirty-five layers: four local, then one global, with a 512-token window.
- The final 20 layers reuse keys and values from layer 14 for local attention and layer 15 for global attention.
- Those 20 layers also double feed-forward intermediate width to 12,288.
- Eight query heads share one key/value head: width 256 locally, 512 globally.
- Per-layer embeddings add 256 coordinates per token per layer.
The checkpoint has about 5.1B parameters including embeddings, 2.3B effective, and supports 131,072 tokens.
How it scores
AA Intelligence Index
Version 4.3.2 · higher is better · checked 2026-11-01. Separate from Epoch ECI.
| Checkpoint / size | Result | Evaluation |
|---|---|---|
| Gemma 4 E2B | 8 | AA Index 4.3.2Best evaluated setting |
Explore the components
- Embeddings: giving every token a meaning
- Residual connections: when more layers made things worse
- A whole LLM, layer by layer
- RMSNorm: keeping a token's scale under control
- Grouped-query attention (GQA): sharing keys and values in groups
- Sliding-window attention (SWA): a cache that stops growing
- QK normalisation (QK-Norm) and soft-capping
- RoPE: position as a rotation
- Transformer layers: attention is only half of what you need
- Vision encoders: how can image patches join the text?
- Per-layer embeddings (PLE): could each layer look up the token again?
- The KV cache: why LLMs remember every key and value
- KV sharing across layers: could later layers reuse an earlier cache?
- Audio inputs: how can a language model listen?
- Multi-query attention (MQA): one key and value for every head
- Attention, from scratch