Skip to content
StackDecode
LLM Library
Dense decoderOpen weightsArchitecture animation

GPT-2

The decoder-only model that showed scale gives surprising abilities.

At a glance

Made by
OpenAI
Released
2019
Type
Dense decoder
Access
Open weights
Parameters
124M to 1.5B
Context window
1,024 tokens
Attention
Multi-head causal attention

How it works

GPT-2 is a stack of causal transformer blocks trained on web text to predict the next token. It popularised the decoder-only recipe that later models follow.

Architecture, step by step

A token travels from text in to prediction out. The boxed layers repeat many times.

× N layersText inTokenizerEmbedding + positionNormCausal self-attentionAdd (residual)NormFeed-forward (MLP)Add (residual)Final normLM head (vocabulary scores)Softmax, then sample next token

Raw text enters the system, for example "The cat sat on the".

stage:
1/12
part:
Text in
1/12

The green dot is one token travelling through the model. The boxed section repeats for every layer.

What stands out

  • Decoder-only
  • Learned absolute position embeddings
  • Open weights make it a favourite for teaching

Keep in mind

Small by today's standards and short context.

Related models