What Happens When You Make It Bigger — Scaling and Pre-training
Everything through Chapter 7 built the tools for making one model and training it. This chapter's question sits a level up: when more compute becomes available, what do you spend it on?
There are two choices: a bigger model (parameters ) or more data (tokens ). Both are available; both at once is not, because the budget is fixed.
So first, derive the budget equation by counting it ourselves. Then solve the allocation.
1. Counting the compute
The weights in one Transformer block were counted in Chapter 7 (with ):
| weights | |
|---|---|
| attention () | |
| FFN (two layers) | |
| one block |
From there, the cost per token:
- Forward: one multiply and one add per weight — 2 FLOPs — so in total.
- Backward: gradients flow to both the inputs and the weights, roughly twice the forward pass, so (Chapter 3, equations (3) and (4)).
Together, per token, and over tokens:
This equation uses nothing beyond this book's arithmetic. Putting it to work:
2. Where breaks
Equation (1) counts only the computation that passes through weights. The attention table from Chapter 6 is not a weight, so it is not in there. A division says when it starts to matter.
Per layer per token, the weight term is , and the table term ( and ) is :
Once the context length passes , the table outweighs the weights.
| k | k | k | k | ||
|---|---|---|---|---|---|
| 512 | 3,072 | 0.33 | 1.33 | 5.33 | 21.33 |
| 1,024 | 6,144 | 0.17 | 0.67 | 2.67 | 10.67 |
| 4,096 | 24,576 | 0.04 | 0.17 | 0.67 | 2.67 |
At and k the table already costs 1.33× the weights. is a short-context approximation; in long-context models Chapter 6's comes back.
3. Splitting the budget
Fix and choosing fixes . All that remains is to pick the that minimises the loss — which requires knowing how the loss depends on and .
Here we assume a form:
The first term is the cost of the model being small, the second of the data being scarce, and is a floor neither can remove (the role played in Chapter 0-4).
Solving at under that assumption gives , and . Varying the budget moves the optimum like this.
| optimal | optimal | |
|---|---|---|
Ten times the budget, times each. They grow equally.
Comments
Sign in to comment