GPT-2 Small

Pinned implementation and paper LDLM @ e18c42a, not yet public · arXiv:2605.07933v1 · OpenWebText · 1024 · checkpoint, tokenizer and saved statistics not verified · How to read

GPT-2 Small

Frozen GPT-2

×

frozen · not trained

GPT-2 Small, frozen, with two token rows added, for [PAD] and <mask>; the hidden state at index -3 of its 13 is taken.

hraw=GPT-2⁡(I)[−3]{\htmlData{light=raw gpt2}{h^{\mathrm{raw}}}}=\operatorname{GPT\text{-}2}({\htmlData{light=ids}{I}})_{[-3]}
in
II [B batch, T positions]
out
hrawh^{\mathrm{raw}} [B batch, T positions, 768 d]
parameters
124,441,344

The model is loaded by name, gpt2, with no revision of its weights pinned. In the transformers library’s list of GPT-2’s hidden states the first entry is the embedding’s output, the last is the last block’s output after the final LayerNorm, and the one before it the output of block 11; so index −3 is the output of block 10, and blocks 11 and 12 and the final LayerNorm are owned and loaded while what they compute is not used. The implementation pins transformers 4.48.0; no excerpt of that library is recorded here.

Parameters

124,441,344 parameters owned by this component

Exact per-instance accounting
ComponentCalculationParameters
table50,259×76850{,}259 \times 76838,598,912
table1,024×7681{,}024 \times 768786,432
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
weights + bias768×2,304+2,304768 \times 2{,}304 + 2{,}3041,771,776
weights + bias768×768+768768 \times 768 + 768590,592
gain + bias768+768768 + 7681,536
weights + bias768×3,072+3,072768 \times 3{,}072 + 3{,}0722,362,368
weights + bias3,072×768+7683{,}072 \times 768 + 7682,360,064
gain + bias768+768768 + 7681,536
Per-instance total124,441,344

Derived from the pinned implementation’s constructors and configuration. The checkpoint’s tensors have not been counted. 306,011,162 of these parameters are trained; frozen GPT-2 and the decoder’s mask vector, 124,442,112, are not.

124,441,344 parameters, none of them updated: a token table of 50,259 rows, a position table of 1,024, 12 blocks and a final LayerNorm.

Explanation

GPT-2’s own architecture is drawn in the atlas under GPT-2 Small. It is causal: the feature at a position depends on that position and the ones before it.

Sources6

Direct evidence

The feature model is wrapped to return one entry of its hidden states, chosen by index; GPT-2’s token table is resized to the configured vocabulary.

The implementation, pinned at revision e18c42acdfb7, not yet public

Direct evidence

With an extraction layer other than −1 the encoder loads the wrapped feature model; when it is frozen it is put in evaluation mode and takes no gradient.

The implementation, pinned at revision e18c42acdfb7, not yet public

Direct evidence

With the feature model frozen, its hidden state is computed without gradient, standardized, and passed to the encoder; the same tensor is the target of the feature loss.

The implementation, pinned at revision e18c42acdfb7, not yet public

Direct evidence

The feature model is GPT-2, frozen; the hidden state at index −3 is extracted; the encoder and the decoder are of the Perceiver kind; the file’s vocabulary size and mask token ID are defaults that the trainer overwrites with the tokenizer’s; there are as many latents as positions, of 768 features.

The implementation, pinned at revision e18c42acdfb7, not yet public

Direct evidence

Before any network is built, the configured vocabulary size and mask token ID are overwritten with the tokenizer’s.

The implementation, pinned at revision e18c42acdfb7, not yet public

Direct evidence

The implementation pins torch 2.4.1 and transformers 4.48.0.

The implementation, pinned at revision e18c42acdfb7, not yet public