Compute-optimal training (Chinchilla)
Given C ≈ 6ND, find the split of compute between N and D that minimizes loss. Arrive at roughly 20 tokens per parameter, and size a compute-optimal model for a given FLOP budget.
What the animation says
One budget, two appetites
You have a fixed compute budget for training. Call it C, counted in floating point operations. Training costs about six times the number of parameters times the number of tokens. So every parameter you add leaves fewer tokens you can afford. A huge model that reads little text stays undertrained. A small model fed endless text runs out of capacity. Warm-up: keep the budget fixed and make the model one percent bigger. What happens to the tokens?
Shift until the gains cancel
About one percent fewer tokens. The six never changes, so parameters and tokens trade percent for percent. Is that trade worth it? The bigger model lowers the loss. The smaller dataset raises it. The fitted loss has three parts: a floor E, a parameter term, and a data term. A, B, alpha and beta are just fitted constants. Keep shifting budget toward whichever side saves more loss, until a one percent step either way saves the same. That balance point: alpha times the parameter term equals beta times the data term.
Twenty tokens per parameter
Both terms are power laws, so the balance point moves predictably as the budget grows. Optimal size grows as C to the power beta over alpha plus beta. Tokens grow as C to alpha over alpha plus beta. Chinchilla's fits found alpha and beta nearly equal, so both exponents are about one half. Parameters and tokens then grow by the same factor, at about twenty tokens per parameter. Now quadruple the compute. How much bigger should the optimal model be?
Which plan is balanced?
Two times bigger. Size is the square root of C over one hundred twenty, so four times compute doubles both parameters and tokens. Now a real budget: five point eight eight times ten to the twenty-three FLOPs. Here are three plans. Every one spends exactly this budget. Only one sits near twenty tokens per parameter. Divide tokens by parameters, then tap it.
Sizing it, and the wrong turn
Let's derive that plan. Divide the budget by one hundred twenty: four point nine times ten to the twenty-one. Its square root is seven times ten to the ten: seventy billion parameters. Tokens are twenty times that: one point four trillion. Six times both gives the budget back. Spend the same budget on two hundred eighty billion parameters, and only three hundred fifty billion tokens remain. That's one and a quarter tokens per parameter. Badly undertrained, with a clearly higher loss.
Remember
At fixed compute, loss is lowest when the parameter term and the data term are balanced. In practice, grow parameters and tokens together, at about twenty tokens per parameter. For ten to the twenty-four FLOPs, that's about ninety-one billion parameters on one point eight trillion tokens. One caveat: this minimizes training compute only. It ignores the cost of running the model afterwards.
Shift budget until the gains cancel
The optimum from the fitted scaling law
The ~20 tokens per parameter rule
Sizing a model for 5.88×10²³ FLOPs
Remember
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.
Bytewise
All courses