Raw textto LL [B, T, 50257]

Specification
Attention
12 heads, each with its own keys and values; 64 features per headconfig.jsonmodel.py 102–108
Feed-forward
GELU MLP, 3,072 hidden features (4 × width)config.jsonmodel.py 115–128
Context
1,024 positions, the learned position tableconfig.json
Parameters124,439,808

124,439,808 parameters in GPT-2 Small

ComponentCalculationParameters
Token embedding50,257 × 76838,597,376
Position embedding table1,024 × 768786,432
Layer7,087,872 × 1285,054,464
Final LayerNorm768 + 7681,536
Model total124,439,808

Counted from the pinned configuration and code. The token embedding is counted once; the tied vocabulary projection adds nothing. Not checked against the checkpoint’s tensors.

Weights · whole model

GPT-2 small · float32474.7 MiB
Tied embedding · float32147.2 MiB
With untied readout · float32621.9 MiB

4 bytes per parameter. The token embedding, 50,257 × 768, is 31.0% of the model; the readout multiplies by its transpose, so it owns none, and a separate readout would add the embedding’s bytes again.

config.jsonmodel.py 154–155, 171
Sources

Direct evidence

The released forward pass provides contextual evidence for input IDs, embedding states, the independently addressed layer loop, final normalization, and tied vocabulary logits.

model.py 147–174 ↗ · openai/gpt-2 @ 9b63575ef427

Excerpt
        h = tf.gather(wte, X) + tf.gather(wpe, positions_for(X, past_length))

… lines 158–162 omitted …

        for layer, past in enumerate(pasts):
            h, present = block(h, 'h%d' % layer, past=past, hparams=hparams)

… lines 165–166 omitted …

        h = norm(h, 'ln_f')

… lines 168–170 omitted …

        logits = tf.matmul(h_flat, wte, transpose_b=True)

The Small configuration supports a derived exact total of 124,439,808 parameters, with the token embedding counted once. 124M is a rounded size label; checkpoint tensors have not been independently counted.

config.json $ ↗ · openai-community/gpt2 @ 607a30d783df