Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

xAI · Architecture map

Grok-1

A coarse mixture of experts: only 8 large experts, two chosen per token, in all 64 layers.

Grok-1 open-weights base model (released 2024; month not confirmed from a fetched page) · Grok release timeline

Inside Grok-1

Parameters
314B
Layers
64
Width
6,144
Mixer
Grouped-query
Select a component to explore it.
The complete Grok-1 architectureInput IDs select embeddings. Each layer adds its updates along the residual stream. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context. 8 keys and 8 values of 128 values per token per layer. Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup131,0726,144Input token vectorsCL6,144Transformer layers 1–64Transformer layers 1–64 · 64 repetitions64 layers · one layer shown64RMSNorm before this operation.RMSNormGrouped-query attention: 8 experts of 32,768 wide with a GELU gate (a GeGLU), 2 selected per token. The two chosen weights are raw softmax probabilities and are not renormalised. No shared expert and no dense branch.Grouped-queryattentionRotate query and key position components before attention scores; values are unchanged. 8 experts of 32,768 wide with a GELU gate (a GeGLU), 2 selected per token. The two chosen weights are raw softmax probabilities and are not renormalised. No shared expert and no dense branch.RoPE48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Score cap 30Normalise the branch output before the residual update.RMSNormAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: 8 experts of 32,768 wide with a GELU gate (a GeGLU), 2 selected per token. The two chosen weights are raw softmax probabilities and are not renormalised. No shared expert and no dense branch.MoE2 of 8 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts.Normalise the branch output before the residual update.RMSNormAdd the branch output to the original stream. +2 of 8 expertsResidual streamLast columnCL6,144Final RMSNormReuses the embedding table, transposed.Tied output weights6,144131,072Vocabulary scoresSoftmax131,072Next-token probabilities
Inside grouped-query attention · Transformer layers 1–64
6 query heads per group × 8 K/V groups.

Earlier context dimmed · current token bright · dashed regions contain cached entries.

Grok-1: Transformer layers 1–64 · grouped-query attention48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context. 8 keys and 8 values of 128 values per token per layer.8 KV groups; the front face shows one representative.8 KV groups6 heads / group; the front face shows one representative.6 heads / groupAttention input. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input6,144CLWq. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Wq6,144128Wk. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Wk6,144128Wv. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Wv6,144128RoPE. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.RoPERoPE. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.RoPEK cache. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.K cache128CLV cache. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.V cache128CLQ context. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Earlier context is dimmed; outlined columns are current.Current token computation.Q context128CLScaled query–key scores, masking and softmax. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Cap 30CLCL×. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.×Joined heads. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.48Wo. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Wo6,1446,144Attention output. 48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output6,144CL
Model-specific details
Transformer layers 1–64 · 64 repetitions
8 experts of 32,768 wide with a GELU gate (a GeGLU), 2 selected per token. The two chosen weights are raw softmax probabilities and are not renormalised. No shared expert and no dense branch.
Attention and positions
48 query heads share 8 key/value heads, each 128 wide. Causal attention over a 8,192-token context.
Memory
8 keys and 8 values of 128 values per token per layer.

The original 314B stack

The released JAX implementation applies input and output scales of approximately 78.38 and 0.577.

Explore the components

Sources for this map