The Rabbit Hole / AI / Model architectures
OpenAI · Architecture map GPT-2 The original decoder-only transformer recipe: layer norm, learned positions and multi-head attention.
GPT-2, 2019 · GPT release timeline
Representative Established a widely adopted decoder-only Transformer baseline with learned positional embeddings and autoregressive next-token training; not the first decoder-only Transformer.
Architecture map What to notice Component articles Compare with another model Sources Inside GPT-2
Parameters 124M
Layers 12
Width 768
Mixer Multi-head
Parameters 1.5B
Layers 48
Width 1,600
Mixer Multi-head Select a component to explore it. Inside multi-head attention · Transformer layers 1–12 12 heads. Earlier context dimmed · current token bright · dashed regions contain cached entries.
GPT-2: Transformer layers 1–12 · multi-head attention 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Keys and values for all 12 heads, 64 values each, per token per layer. 12 heads; the front face shows one representative. 12 heads Attention input. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier context is dimmed; outlined columns are current. Current token computation. Attention input 768 CL Wq. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wq 768 64 Wk. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wk 768 64 Wv. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wv 768 64 K cache. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier columns are cached; outlined columns are newly computed. Cached positions from earlier decoding steps. Current token computation. K cache 64 CL V cache. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier columns are cached; outlined columns are newly computed. Cached positions from earlier decoding steps. Current token computation. V cache 64 CL Q context. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier context is dimmed; outlined columns are current. Current token computation. Q context 64 CL Scaled query–key scores, masking and softmax. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. CL CL ×. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. × Joined heads. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. 12 Wo. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wo 768 768 Attention output. 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier context is dimmed; outlined columns are current. Current token computation. Attention output 768 CL Model-specific details Transformer layers 1–12 · 12 repetitions One dense feed-forward network per layer with a GELU activation (hidden size 3072, four times the width), used by every token. Attention and positions 12 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Memory Keys and values for all 12 heads, 64 values each, per token per layer. Select a component to explore it. Inside multi-head attention · Transformer layers 1–48 25 heads. Earlier context dimmed · current token bright · dashed regions contain cached entries.
GPT-2: Transformer layers 1–48 · multi-head attention 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Keys and values for all 25 heads, 64 values each, per token per layer. 25 heads; the front face shows one representative. 25 heads Attention input. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier context is dimmed; outlined columns are current. Current token computation. Attention input 1,600 CL Wq. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wq 1,600 64 Wk. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wk 1,600 64 Wv. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wv 1,600 64 K cache. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier columns are cached; outlined columns are newly computed. Cached positions from earlier decoding steps. Current token computation. K cache 64 CL V cache. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier columns are cached; outlined columns are newly computed. Cached positions from earlier decoding steps. Current token computation. V cache 64 CL Q context. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier context is dimmed; outlined columns are current. Current token computation. Q context 64 CL Scaled query–key scores, masking and softmax. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. CL CL ×. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. × Joined heads. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. 25 Wo. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Wo 1,600 1,600 Attention output. 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Earlier context is dimmed; outlined columns are current. Current token computation. Attention output 1,600 CL Model-specific details Transformer layers 1–48 · 48 repetitions One dense feed-forward network per layer with a GELU activation (hidden size 6400, four times the width), used by every token. Attention and positions 25 heads of 64 values, each with its own keys and values; causal attention over a 1,024-token context. Memory Keys and values for all 25 heads, 64 values each, per token per layer. Learned positions and a dense stack
Position embeddings are added at the input, with a 1,024-position table.
Each layer uses pre-LayerNorm, full multi-head attention and a dense GELU network.
Input and output embeddings are tied; attention heads are 64 coordinates wide.
The picker includes the 124M and 1.5B checkpoints. All GPT-2 sizes use the 1,024-token training context.
Explore the components Sources for this map