Step 8 · Scaling laws and the compute budget
How to decide model size and dataset size before spending money. Move the sliders and watch the bill.
In 60 seconds
Step 8 · Scaling laws and the compute budget
How to decide model size and dataset size before spending money. Move the sliders and watch the bill.
The three numbers you need
| Quantity | Formula | Note |
|---|---|---|
| Training compute | C ≈ 6 · N · D | N parameters, D tokens. Forward is 2ND, backward is 4ND |
| Compute-optimal ratio | D ≈ 20 · N | The Chinchilla result — roughly 20 tokens per parameter |
| Inference compute | ≈ 2 · N per token | Which is why serving cost favours smaller models |
Interactive · compute budget
Why nobody actually trains compute-optimal any more
- 1
Compute-optimal
A 70B model on 1.4T tokens. Best loss for the training budget. Expensive to serve forever. - 2
Inference-optimised
An 8B model on 15T tokens. Worse loss per training dollar, far past "optimal" — and dramatically cheaper to run, small enough to fit on one GPU, and fast. - 3
The industry chose the second
Nearly every widely deployed open model today is deliberately over-trained relative to Chinchilla. The training cost is paid once; the inference cost is paid forever.
Estimating memory before you rent a GPU
def memory_gb(n_params, bytes_per_param=2, optimizer="adamw", train=True):
weights = n_params * bytes_per_param # bf16 weights
if not train:
return weights / 1e9 * 1.2 # + KV cache and activations
grads = n_params * bytes_per_param
# AdamW keeps two fp32 moments, plus an fp32 master copy of the weights
opt_state = n_params * 12 if optimizer == "adamw" else 0
total = weights + grads + opt_state
return total / 1e9 * 1.25 # + activations, fragmentation
print(memory_gb(7e9)) # ~ 100 GB -> will NOT fit on one 80GB card
print(memory_gb(7e9, train=False)) # ~ 17 GB -> inference fits easily
print(memory_gb(1.5e9)) # ~ 22 GB -> trainable on one 24GB cardEmergence, and why the curve is not the whole story
Watch and read more
Lab
A compute budget defended against a real alternative.
The problem
You are done when
Hard questions
Try to answer before you reveal. If you can answer these, you understood the lesson.
Q1Your inference-optimised plan trains a 3B model on 300B tokens — 100 tokens per parameter, far past Chinchilla. Justify it in cost terms.Reveal
Questions people ask
Does the 6ND formula include attention cost?
It ignores the quadratic attention term, which is a good approximation while sequence length is small relative to model width. At very long context it understates the true cost substantially.
Are scaling laws still holding?
For loss versus compute, broadly yes, within the ranges that have been published. What has changed is that the binding constraints have moved to data availability, energy and inference economics rather than the curve itself.
Can I predict my final loss before training?
Approximately, by fitting a scaling law on a series of small runs at your own data mixture, then extrapolating. Labs do exactly this before committing to a large run, and it is a good habit at any scale.
What does one training run actually cost?
Rough orders of magnitude at 2026 cloud prices: a 100M model, tens of dollars. A 1B model, hundreds to low thousands. A 7B model trained properly, hundreds of thousands. Frontier scale, hundreds of millions.
Lesson test
5 questions. Get 3 right (60%) to pass and complete this lesson.
Sign in with your phone number to take the test and save your progress