Subsection 2.7 Model Size and Training Time
Large Language Models (LLMs) are often described by their parameter count, which is the number of learnable numbers in the model. The larger the model, the more parameters it has, and the more complex its behavior can be.
GPT-2 small has about 124 million parameters, accounted for as follows:
| Part of the model | Calculation | Parameters |
|---|---|---|
| Token embeddings | 50,257 tokens ร 768 dimensions | 38,597,376 |
| Position embeddings | 1,024 positions ร 768 dimensions | 786,432 |
| Self-attention: query, key, and value projections | 12 blocks ร (768 ร 2,304 weights + 2,304 biases) | 21,261,312 |
| Self-attention: output projection after merging heads | 12 blocks ร (768 ร 768 weights + 768 biases) | 7,087,104 |
| Feed-forward network: expand to 3,072 dimensions | 12 blocks ร (768 ร 3,072 weights + 3,072 biases) | 28,348,416 |
| Feed-forward network: project back to 768 dimensions | 12 blocks ร (3,072 ร 768 weights + 768 biases) | 28,320,768 |
| Layer normalization | Two per block, plus one final normalization | 38,400 |
| Total | 124,439,808 |
When stored with 32 bits per parameter, the 124 million parameters of GPT-2 small require approximately 500MB of storage. The weights can be stored with less precision (16 bits or even 8 bits) to reduce the storage requirements, but doing this decreases the modelโs performance (quite significantly in the case of 8-bit storage).
Larger versions of the GPT-2 model, have wider dimensions and more blocks. Of course, more dimensions and more blocks means more parameters. The largest version of GPT-2 has over 1.5 billion parameters. The following diagram shows the four main sizes of GPT-2:

Each of those millions or billions of parameters start with initial values, and GPT-2 processes batches of text tokens, predicting the next token at each position. It compares those predictions with the actual tokens, then uses an algorithm to calculate how the parameters should change to reduce the error. This cycle repeats across many batches.
The amount of work depends on how many tokens the model trains on, as well as its parameter count. One experimenter managed to train a GPT-2-small reproduction using 10 billion input tokens. A common rough estimate of training work is six arithmetic operations per parameter per token. That gives about \(6 \times 124,439,808 \times 10,000,000,000 = 7.5 \times 10^{18}\) operations.
Even if you could do one million math operations every second, without a break, the arithmetic alone required to perform this amount of work would take about 240,000 years. Fortunately, much of this work can be parallelized across multiple processors or GPUs. The reproduction of GPT-2 that was built using those 10 billion tokens was trained in just 90 minutes on eight A100 GPUs, each of which was capable of approximately 312 trillion operations per second.