Antivision · Latent Rehearsal
07

Scale
and budget

What it costs to reach GPT-3 scale, why VRAM is almost never the limit, and the formula that says which size to train with the money you have.

Chapter 07 Prerequisite: chapter 08 of the GPT-2 course

1 First, undo a misunderstanding

The GPT-3 weights were never published. The openai/gpt-3 repository has text samples and corpus statistics — no weights. There is no such thing as "downloading GPT-3".

And architecturally it is, in essence, a bigger GPT-2: same blocks, same causal attention, with alternating sparse-attention layers. What separates the two is scale, not invention.

So "reaching GPT-3" means climbing size steps. And the paper defines eight of them, not one — the 175 B is the last, not the only one.

2 The law that organizes everything

Chinchilla (Hoffmann et al., 2022) measured the relationship between parameters, data and compute. The rule of thumb: ~20 training tokens per parameter.

The cost in floating-point operations to train N parameters on D tokens is approximately:

C = 6 · N · D

The factor 6 comes from two multiplications per parameter in the forward pass and four in the backward pass. Substituting D = 20N:

C = 120 · N²   ⟹   N = √C / 120
The practical consequence

Given a budget, there is one optimal size. Training bigger leaves the model undertrained — it has capacity that was never filled. Training smaller wastes compute on something that has already converged.

"I'll take the biggest model that fits in VRAM" is the wrong heuristic, and it is the most common one.

3 The ladder, with prices

On a rented RTX 5090 (32 GB, US$ 0.678/h), at 60 effective TFLOP/s:

The GPT-3 family from the paper, plus our presets. "Text" assumes ~4 characters per token.
ModelParamsTokensTextVRAMHoursCost
our mini ✓7 M0.1 B1 GB0.2 GB——
our grande97.5 M1.9 B7 GB2.1 GB5.3US$ 2
GPT-3 Small125 M2.5 B9 GB2.7 GB8.7US$ 4
GPT-3 Medium350 M7.0 B26 GB7.6 GB68US$ 31
GPT-3 Large760 M15.2 B57 GB16.6 GB321US$ 145
GPT-3 XL1.3 B26 B97 GB28.3 GB939US$ 424
GPT-3 2.7B2.7 B54 B201 GB58.8 GB ✗4,050US$ 1,831
GPT-3 175B175 B3.5 T13 TB3,814 GB ✗1,942 yearsUS$ 7.7 M

Three readings that change the plan

VRAM is almost never the limit. Up to GPT-3 Large fits in the 32 GB. Only from 2.7 B on does the card become too small — and at that point the problem stops being renting one and becomes parallelizing across several, which is a different kind of engineering.

The limit is the corpus. We have 310.6 M tokens. GPT-3 Small asks for 2.5 billion: 8× more text than we have. No card solves that.

The 175 B is not a question of your money. Almost two thousand years on one card. That was done with thousands of GPUs in parallel for months — another category of undertaking, not the next step.

4 Where each number comes from

VRAM

Training requires more than the weights. With AdamW: the weights, the gradients, and two moments per parameter. In fp32 that is 16 bytes per parameter; with mixed bf16, ~18 counting the master copy. We add ~30% for activations:

VRAM ≈ N × 18 bytes × 1.3

A 1 B model asks for ~24 GB just for the optimizer state. That is why the 2.7 B row overflows a 32 GB card — not because of the weights, which are 5.4 GB.

Throughput, and honesty about it

The 60 effective TFLOP/s are an estimate, not a measurement. We calibrated against a real data point: nanoGPT trains the 124 M GPT-2 on 8×A100 at ~870 k tok/s, or ~110 k per card. Our formula gives ~117 k for an equivalent model — it matches.

Where the estimate does not hold

On small models, it lies upward. A 3 M parameter model saturates no card at all: the bottleneck becomes kernel launches and data feeding, not computation. That is why the table marks with ? the rows that hit the conservative ceiling of 400 k tok/s.

The solution is not to estimate: cloud/calibrate.py runs a few real steps at each size, measures, and only then recommends. It costs ~4 cents.

5 What seven hours of a card buy

A small budget in this rental range buys on the order of 7.4 hours of one card. Applying N = √C/120:

The compute-optimal size for the budget, under two throughput hypotheses.
Effective throughputBudget in FLOPsOptimal size
40 TFLOP/s (conservative)1.07 × 10¹⁸94 M
60 TFLOP/s (optimistic)1.60 × 10¹⁸115 M

Our grande preset has 97.5 M. GPT-3 Small has 125 M. Seven hours of a single card buy exactly that range — trained to the optimal point, not halfway.

What it requires is ~2 billion tokens, or ~8 GB of text. That is the missing step, and it is one of data, not money.

6 Where the money leaks

Three kinds of waste appear when preparing a rental — all found by reading the code before running it.

None would have shown up in a local test: on CPU everything works, just slowly.
LeakCauseCost
Training on the rented machine's CPUthe training script never moves the model to the GPUevery hour contracted
Serial tokenizationtok.encode one document at a time runs on one thread~35% of the budget
Unrecoverable weightscheckpoint saved with CUDA tensorsall the work

The second is the most instructive. Swapping tok.encode(one_text) for tok(list_of_texts) triggers the parallelism of the Rust backend:

one by one :   0.80 M chars/s
batched    :   6.35 M chars/s   ->  7.9x faster

8 GB corpus:  178.2 min one by one  vs  22.5 min batched

35% of the budget, in one line of code. And on a machine billed by the hour, data preparation costs as much as training — the GPU sits idle while the CPU tokenizes.

Three more rules of economy

  1. Download the corpus on the rented machine, not locally. It has 6.5 Gbps; uploading 8 GB over a home connection would take hours — and those hours are billed.
  2. Reliability matters more than price. An offer at 97.8% fails every ~45 machine-hours; at 99.9%, every ~1,200. For a 9 h training run, the price difference does not pay for the risk.
  3. Only destroy stops the billing. stop pauses the GPU and keeps charging for the disk.

7 The path

In dependency order. Step 4 costs less than a lunch — and requires step 2.
#StepCostUnlocks
1train pequeno to convergencefree (4 h of CPU)first serious model
2corpus to ~10 GBdownload timeGPT-3 Small becomes viable
3rent and train grande~US$ 2scale of the base GPT-2
4GPT-3 Small with our tokenizer~US$ 4scale parity
5GPT-3 Medium~US$ 31sensible ceiling for a personal project
The conclusion that guides the project

Reaching GPT-3 Small scale costs less than eight hours of a single GPU. What is missing is not card time: it is text. That is why the priority is the corpus, and why chapter 01 insists so much on the tokenizer — every token saved is training budget given back.

Open questions

With the arithmetic done, chapter 08 shows the bench: where all of this is operated
— serving, X-raying and training, without leaving the browser.