The Mathematics of Scale
Why do bigger models get better so predictably, and how should a budget be split between parameters and data?
The part opens with a fan of runs of Part 11's character model, eleven sizes at up to nine lengths, whose lower edge is a floor plus a straight line on log axes. It first asks what happens as a network grows infinitely wide: its output becomes a Gaussian process, and with neural-tangent step sizes it trains like a fixed kernel and learns no features. muP is derived from one observation, that random sums grow like the square root of the width and aligned updates like the width, and a coordinate check and learning-rate sweeps show one rate serving every width. The critical batch is derived and measured. Then the scaling laws: power laws fitted to the sweep, Chinchilla's formula, and the compute-optimal split found with a Lagrange multiplier under C = 6ND. The part turns to what bends the laws (Kaplan's parameter counting, over-training for inference, repeated data, experts, low precision) and to why they are power laws at all. It ends with emergence against all-or-nothing metrics, grokking and its Fourier circuit, scaling the answer with many tries, and the argument over whether pretraining has stalled.
What you need. Multivariable calculus with Lagrange multipliers, the central limit theorem and the law of large numbers, fitting a line on log axes.
- Mathematics and history
- NTK vs μP, hyperparameter transfer, scaling laws, Chinchilla, over-training, emergence, grokking
What you will be able to do
Undergraduate
- Read a scaling-law plot: name the floor and the slope, and say what a straight line on log axes does and does not promise beyond the measured range.
- Explain with p to the power L why an all-or-nothing score can jump while the per-token score rises smoothly.
Master's
- Derive muP's learning-rate rule from how random sums and aligned updates grow with width, and run a coordinate check.
- Derive the compute-optimal split of C = 6ND for a loss E + A/N^alpha + B/D^beta with a Lagrange multiplier.
- Derive the steps-against-examples hyperbola of the critical batch from a second-order model of one step.
Research
- Define the neural tangent kernel, show that gradient flow at infinite width is kernel regression, and state what the lazy regime cannot learn.
- Derive a power-law exponent from the data manifold's dimension and from the quanta model, and state where each derivation stops matching the measurements.
Engineering
- Transfer a learning rate tuned on a narrow, shallow model to a wide, deep one, and say what copying the rate costs without muP.
- Size a model for its lifetime: trade training compute against inference with 6ND + 2NT, and decide when to raise the batch, repeat data, add experts or quantize.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 13 min · Master's 42 min · Research 51 min · Engineering 22 min.
- 0A straight line on log axesUndergraduate2 min
- 1Infinitely wideResearch3 min
- 2LazyMaster's3 min
- 3muP, derivedMaster's3 min
- 4One learning rate for every widthEngineering1 min
- 5Deeper and deeperMaster's3 min
- 6How big a batch?Engineering3 min
- 7Scaling laws, measuredUndergraduate3 min
- 8Chinchilla's valleyMaster's3 min
- 9What Kaplan missedUndergraduate3 min
- 10Trained for the long runEngineering2 min
- 11When the data runs outMaster's2 min
- 12Experts and bitsEngineering2 min
- 13Why power laws?Research3 min
- 14Emergence, or a mirage?Undergraduate3 min
- 15GrokkingMaster's3 min
- 16Scaling the answerMaster's3 min
- 17Has pretraining stalled?Research3 min
- Recap, problems, and what comes nextAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · 中文 · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
A straight line on log axesUndergraduate2 min
Make a model bigger, train it longer, and it gets better. That much everyone expected. The surprise was how predictably. Here are sizes of part eleven's character model, each trained for up to lengths: completed primary endpoints computed for this series, each drawn at the number of operations it cost. Every size improves, then flattens: it runs out of room. But the bottom edge of the whole fan, the best loss each budget can buy, is a smooth curve. Take away a floor of bits, and what's left falls along a straight line on log axes: a power law, with slope . Curves like this, measured on small models, are how laboratories decide what to build next.
The idea has a history. In 1994, Radford Neal showed that an infinitely wide network is a Gaussian process. In 2001, Banko and Brill found that more data beat a cleverer algorithm. In 2017, a team at Baidu found power laws in translation, language, images and speech. In 2018, the neural tangent kernel. In 2020, OpenAI's scaling laws, and GPT-3 built on them. In 2022, Chinchilla corrected the recipe, mu-P let one learning rate serve every size, and grokking puzzled everyone. In 2023, the limits: data that runs out, and abilities that seem to appear from nowhere. In 2024, scaling moved to the answer: models that think for longer. In 2025, reinforcement learning at the scale of pretraining. And in 2026, laboratories went back to much larger base models.
This is Part 12 of AI, Built, and the end of its second act. In it: what happens to a network as it gets infinitely wide; how to set a learning rate once and keep it as the model grows wider and deeper; the scaling laws, measured on our own models and derived; the trade-offs that bend them; why they are power laws at all; and what is happening at the frontier.
1Infinitely wideResearch3 min
Start a network with random weights, and ask what it computes. One hidden layer of n units; each unit's output is weighted by a random number, and the sum is divided by the square root of n. With one unit, the output at one point, over thousands of random starts, is lumpy and heavy-tailed. With many units it is a sum of many independent terms, and part five's central limit theorem takes over: a Gaussian, with exactly the variance the formula predicts. Not just at one point: the whole function becomes a Gaussian process, a random smooth curve whose covariance, a kernel, is fixed by the architecture. Radford Neal saw this in 1994; in 2018 it was extended to deep networks.
That is the network before training. In 2018, Arthur Jacot, Franck Gabriel and Clément Hongler asked what happens during it. Gradient descent moves the weights along the gradient of the error. By the chain rule, the output at any point x moves by its own gradient times that step. Put the two together and one object appears: the dot product of the gradients at two inputs, the neural tangent kernel. It says how much a step that fixes the output at one input also moves it at another. If the kernel stays put, this is a linear equation, and its solution is kernel regression, part six's method, with this kernel. Their theorem: as the width goes to infinity, the kernel does stay put.
Pause and predict. Make the network a thousand times wider, and train it the same way. Does each weight move more, less, or the same? And the kernel?
Check it, on that one-layer network, trained by gradient descent on ten points, at widths from thirty to thirty thousand. Measure how far the weights travel, relative to where they started: the slope is . And how far the kernel moves: slope . So a wide network trains like its own linearization. Averaging each seed's maximum gap over three seeds gives at a hundred units and at ten thousand. The replay shows seed zero.
The takeaway: with neural-tangent scaling, the infinite-width network is a Gaussian process before training and a kernel machine during it, because its tangent kernel freezes. Next, what a frozen kernel cannot do.
2LazyMaster's3 min
A wide network trained like its linearization has a catch. Take part eleven's character model, make it wider and wider, and train it with the step sizes of the neural tangent kernel. Measure how much its hidden features change: what each hidden unit computes from the input. The wider the network, the less they change: slope -0.35. In 2019, Chizat, Oyallon and Bach called this lazy training, and showed it is not special to wide networks: scale any model's output up and it trains like its linearization. A lazy network can only re-weight the random features it started with. It is a kernel method, like part six's, and the models far bigger than their data that part eight met are, in this limit, exactly its minimum-norm fits.
Pause and predict. Two copies of one wide network, the same data and the same number of steps: one scaled the lazy way, one the mean-field way. Which one learns the hidden direction?
Does it matter? Here is a task where it does. The answer is the square of how far x points along one hidden direction, w-star, minus one, with x in dimensions and examples to learn from. Train a wide two-layer network the lazy way, with the neural tangent kernel's scaling. Now the same network, the same data and the same number of steps, scaled the mean-field way: divide the output by n instead of its square root, and multiply the learning rate by n, so every unit moves by a fixed amount.
What did the rich network learn that the lazy one could not? Draw each hidden unit as a point: how much its weights point along the hidden direction, and how much they point elsewhere. Now replay training. The lazy units hardly move: in all, its final weights are displaced by percent of their starting length. The rich units swing out along w-star, displaced by percent: the network has found the one direction that matters. That is a learned feature, which a fixed starting-kernel regression cannot create. So the infinite-width limit we want is the other one, where features keep moving at every width. For two layers it is called mean field; for any depth, it is mu-P.
The takeaway: in the lazy limit, a network only re-weights the features it started with. To learn features at any width, every unit must keep moving, and that is what mu-P is built to do. Next, its derivation.
3muP, derivedMaster's3 min
Here is the whole idea, in one layer. Its output is a sum of n weights times n inputs. At the start the weights are random, so the n terms have random signs and mostly cancel: by the central limit theorem, the sum grows like the square root of n. Divide the starting weights by the square root of n, and the output stays the same size at any width. Training is different. The gradient of a layer is an outer product: the error signal times the input. Hold that local error signal at order one for this calculation. So the step, applied to that input, gives a sum of n terms that all have the same sign: it grows like n, not its square root. For this layer's update to stay about the same size at any width, the local learning rate must shrink like one over n. A full network must also account for how errors scale through its other layers. Greg Yang and Edward Hu derived those rules for a broad class of networks in 2021, and called it the maximal update parametrization: mu-P.
For Adam, a common language-model optimizer, the recipe is a short table. Inputs and biases learn at the base rate. Hidden matrices learn at the base rate divided by their width, because Adam moves every entry by about the learning rate, so the n aligned terms add up to n times it. The output layer starts much smaller, with variance one over the width squared, and learns at the rate over the width. The usual way, which we'll call SP, uses one rate everywhere. Our width factors equal one at width sixty-four, but initialization differs: only mu-P starts the readout weights at zero.
Pause and predict. Train at widths from sixty-four to four thousand, with one learning rate, the usual way. Which layer's change will grow with the width?
Yang's test for whether a parametrization is right is called a coordinate check: train for a few steps at many widths, with one learning rate, and measure how much each layer's activations change. In the usual parametrization, In mu-P,
The takeaway: random sums grow like the root of n, and aligned updates like n, so mu-P shrinks the hidden learning rates like one over n and starts the output small. Then every layer keeps learning at every width. Next: does one learning rate then serve them all?
4One learning rate for every widthEngineering1 min
Pause and predict. As a model gets wider, the usual way, will its best learning rate go up, go down, or stay put?
Now the test that matters: sweep the learning rate at three widths, sixty-four to a thousand and twenty-four, two seeds each, the usual way first. In mu-P
Here is what that means in practice. Tune the smallest model, and train the largest with its learning rate. At scale, this is what mu-P was built for. In 2022, Yang and colleagues tuned a forty-million-parameter model, copied its settings to a GPT-3 of six point seven billion, and beat the published one, for seven percent of the cost of one training run. In 2024, Everett and colleagues at Google DeepMind showed that the usual parametrization transfers too, with the right learning rate for each layer, and in 2025 Meta set Llama 4's per-layer rates and starting scales this way, transferring them across width, depth, batch size and training length.
The takeaway: in mu-P, a learning rate tuned on a small model carries over to a wide one, which is how large models are tuned without tuning them at full size. Next, the same question for depth.
5Deeper and deeperMaster's3 min
Depth is the other way to grow. A residual network adds each block's output to a running sum, the residual stream of part nine. With L blocks, the stream is a sum of L branches, and how each is scaled decides what happens as L grows. Our factors are relative to the base depth of two. Leave the branches unscaled, and the stream grows with depth. Our comparison still divides the block learning rate by the relative depth. In 2023, two groups found the depth version of mu-P: scale each branch by one over the square root of L, with the learning rate to match. It transfers across depth, but each block's contribution becomes so small that it acts linearly: lazy, now in depth. In 2025, Nolan Dey and colleagues at Cerebras showed that one over L, with the learning rate left alone, keeps every block learning features. They called it CompleteP.
Pause and predict. With no scaling, every new block adds to the residual stream. As the network gets deeper, will its best learning rate rise, or fall?
Our character model again, made deep: and residual blocks, each parametrization swept over nine learning rates, two seeds each. With no depth scaling, With one over root L, the across-depth span is . With CompleteP's one over L, the span is .
Two practical questions. Does depth pay? And what does it cost to tune the shallow model and copy its rate to the deep one? bits with no depth scaling, with one over root L, with CompleteP. At scale, Dey and colleagues measured twelve percent less compute than mu-P for the same loss at one and a half billion parameters, and thirty-four percent for their deepest models. Part nine's careful initialization made ten-thousand-layer networks trainable; this is the same idea, for training them well.
The takeaway: how the residual branches are scaled decides whether a learning rate carries across depth, and whether deep blocks still learn features. Next, the third knob: the batch.
6How big a batch?Engineering3 min
Part eleven showed that a small batch gives a noisy gradient. How big should the batch be? In 2018, Sam McCandlish and colleagues at OpenAI answered with one step of algebra. Expand the loss after one step to second order, assuming independent examples and positive curvature along the gradient. The gradient helps; curvature and noise limit the step. Choose the best step size in this local model. The best gain is the noise-free gain divided by one plus a ratio, the noise scale over the batch: how many examples it takes for the gradient's signal to beat its noise. The resulting empirical model predicts that the number of steps to reach a loss falls as the batch grows, and the number of examples rises. Eliminate the batch, and steps and examples trade off along a hyperbola. Far below the noise scale, doubling the batch halves the steps for free; far above it, it only wastes examples.
Pause and predict. Double the batch. To reach the same loss, will it take half as many steps, just as many, or something in between?
Measure it. Train our character model with batches from to characters, for each batch and target loss choosing the fastest of three learning rates. Estimate the steps and characters needed from the loss checkpoints. To reach bits, the points fall on a hyperbola, with a critical batch of about . To reach lower losses,
Is the critical batch really the noise scale? We can measure the noise scale directly, from the sizes of gradients at two batch sizes, as the loss passes each level. Kaplan's laws found the critical batch growing as the loss falls, and later work found that it grows with the amount of data, not the size of the model. So large runs raise their batch as they go: DeepSeek-V3 grew its batch fivefold, from 3,072 sequences to 15,360, over its first 469 billion tokens.
The takeaway: far below the critical batch, a bigger batch buys fewer steps with little extra data. Above it, step savings diminish as data use grows. Our fitted critical batch grew as the loss fell. Next, the scaling laws themselves.
7Scaling laws, measuredUndergraduate3 min
In 2017, Joel Hestness and colleagues at Baidu measured how the error of networks for translation, language, images and speech falls as the data grows. Each curve had three parts: too little data to learn anything; then a straight line on log axes, a power law; then a floor that more data cannot pass. Better architectures moved the line down, but they barely changed its slope: for language models, about minus 0.07. In 2020, Jared Kaplan, Sam McCandlish and colleagues at OpenAI found the same for parameters, data and compute together, over seven orders of magnitude, and concluded that a model eight times bigger needs only five times the data. Part fourteen will show how that led to GPT-3. Here we measure such laws ourselves.
A scaling law needs many runs, each trained to the end of its own schedule. That is expensive: a run planned for a million characters and stopped halfway is not a good half-million-character run, because its learning rate never came down. So we use a trick from 2024. Train each width once at a constant rate, and at every length we want, branch off and cool the rate to zero over the last fifth. Each branch estimates the result of a full schedule of that length, while the trunk carries on. Agreement is empirical, and must be checked. widths, from to units, lengths from two to the sixteen to two to the twenty-four characters: primary endpoints. The recorded width runs, including seed repeats, took elapsed hours. That includes evaluation and excludes the initial rate search.
Pause and predict. Our models are tiny, and read only eight characters at a time. Will their loss fall faster or slower with size than in Kaplan's language models?
First, one variable at a time, as Kaplan did. Hold the data large, two to the twenty-four characters, and vary the size. The loss falls toward a floor along a power law: L equals plus a constant over N to the . Hold the size large, width , and vary the data: the exponent is . Different seeds land about bits apart, small next to these curves.
The takeaway: loss falls toward a floor along a power law, in size and in data, and the shape carries over from task to task even when the exponents do not. Next, both at once, and how to split a budget between them.
8Chinchilla's valleyMaster's3 min
Pause and predict. Your budget grows tenfold. Should you make the model ten times bigger, train it on ten times the data, or grow both by about three?
In 2022, Jordan Hoffmann and colleagues at DeepMind fitted one formula to all their runs at once: a floor, plus a term that shrinks with the parameters, plus one that shrinks with the data. Fitted to our runs, leaving out the shortest and the narrowest, it misses by bits on average. Now spend a budget. Training costs six operations per parameter per character, so six N D equals C. Which split gives the lowest loss? Add a Lagrange multiplier, as in part four. Set both derivatives to zero. Multiply the first by N and the second by D, and both sides equal six lambda N D. So at the optimum, increasing size or data gives equal marginal loss reduction per added operation. Solve, and the best size grows as the budget to the power beta over alpha plus beta: for our models.
Here is the whole picture: the fitted loss as a surface above the plane of size and data, both on log scales, with our runs as points on it. A budget is a straight line across the plane: where N times D is fixed, more of one means less of the other. Along each line the surface dips into a valley. Too small a model can't hold what it reads: it underfits. Too big a model reads too little to finish learning. Join the lowest points of every valley, and you have the path to follow as the budget grows: the floor of Chinchilla's valley.
Chinchilla read that path three ways, and so can we. One: the lower envelope of all the training curves, the best model at each compute. Two: a parabola through the bottom of each budget's valley. Three: the formula we just solved. Our three estimates of the exponent: , and . Chinchilla's were 0.50, 0.49 and 0.46. In characters per parameter, our optimum is about ; Chinchilla's was about twenty tokens.
The takeaway: at the compute optimum, extra compute spent on size or data gives equal marginal benefit. For language models that means growing size and data together, at about twenty tokens per parameter. Next: why the first scaling laws said otherwise.
9What Kaplan missedUndergraduate3 min
Kaplan's laws said: as the budget grows, put most of it into the model. GPT-3 read under two tokens per parameter, and DeepMind's Gopher, two hundred and eighty billion parameters, read three hundred billion tokens. Chinchilla used the same compute on a model a quarter the size, trained on four times the data. It beat Gopher on almost everything: on the MMLU exam, by more than seven points. And it was four times cheaper to run. So who was wrong, and why?
Pause and predict. Leave the embedding layers out of the parameter count. Will the best model size seem to grow faster, or slower, as the budget grows?
Part of the answer is how you count. Kaplan counted parameters without the embeddings, and at small scale those are a large share of a model. Our own runs show the effect. The same budgets, the same best models: counting all their parameters, the best size grows with slope . Counting only the hidden layers, The same year, Tomer Porian and colleagues found the rest: the cost of the last layer, the length of the warmup, and an optimizer setting left untuned at small batches. Fix all three, and Kaplan's own setup gives Chinchilla's answer.
Chinchilla itself was checked two years later. Its three methods had disagreed slightly: the fitted formula said 0.46, the other two about a half. In 2024, Tamay Besiroglu and colleagues at Epoch AI rebuilt the data from the paper's own figure, two hundred and forty runs, reading each point's loss from its colour, and refitted the formula. They got 0.51, plus or minus 0.02: about twenty tokens per parameter, in agreement with the other two methods. The published fit had been off. And its stated uncertainty was implausibly small: an interval that narrow would take over six hundred thousand runs, and they had run fewer than five hundred. The lesson for us: an exponent is a measurement, and it has an error bar.
The takeaway: small choices, which parameters to count, how long to warm up, which optimizer settings, moved the exponent from 0.73 to about a half, and refits still differ. A scaling law is a measurement, with error bars. Next: when the compute optimum is not what you want.
10Trained for the long runEngineering2 min
Pause and predict. A model half the compute-optimal size, trained longer until it matches the optimal model's loss. How much more training compute will it need: a few percent, double, or ten times?
Chinchilla's optimum minimizes the cost of training. But a model is trained once and then used, maybe billions of times, and every use costs in proportion to its size. So it can pay to train a smaller model for longer. How much longer? The fitted law answers. Ask for the optimal model's loss from a model k times its size, and solve for the data it needs. A model three quarters the size costs percent more training; half the size, percent more; and below of the size, no amount of data is enough: the small model's floor is above the target.
In 2023, Nikhil Sardana and colleagues at MosaicML put the answering into the budget. Training costs six operations per parameter per token, and answering costs two. Fix the quality, and minimize the lifetime cost. The more a model will be used, the smaller and longer trained it should be. On our fitted law: a model that will answer a hundred times more characters than it would be trained on should train on about 763 characters per parameter, at 0.35 of the optimal size, and costs 56 percent less over its life. Sardana's team found quality still improving at ten thousand tokens per parameter, and in 2024 Meta trained Llama 3's eight-billion-parameter model on fifteen trillion tokens: nearly nineteen hundred per parameter, a hundred times Chinchilla's ratio.
The takeaway: when a model will answer enough requests, minimizing lifetime compute can favor a smaller model trained much longer than the training-only optimum. Next: what happens when there are not enough tokens to read.
11When the data runs outMaster's2 min
Pause and predict. Train for the same number of characters, but on a quarter of the text, read four times over. How much worse will it be than a model that read fresh text all the way?
Good text is finite. What happens when a model has read it all and must read it again? Train our character model on million characters every time, but drawn from fewer and fewer distinct ones, from one pass over fresh text down to two hundred and fifty-six passes over a small sample. Sixteen cost .
How much is a repeat worth? In 2023, Niklas Muennighoff and colleagues proposed a simple answer. Suppose each pass over the same text is worth a fixed fraction less than the one before. Then U distinct characters read R more times are worth U plus a sum of shrinking terms, which saturates: however often you repeat, you never get more than U times one plus R-star. Interpolate each three-seed mean final loss onto the fresh seed-zero curve, infer its equivalent new text, and fit R-star: passes. and the ceiling is about times the distinct text.
How close are we? In 2024, Pablo Villalobos and colleagues at Epoch AI projected usable public text at the 2028 crossing at about four times ten to the fourteen tokens, after allowing for quality and repetition, and projected that training sets would reach it between 2026 and 2032, most likely in 2028. Repeating stretches it: Muennighoff's four epochs are nearly free. Alibaba's Qwen3, in 2025, was pretrained on about thirty-six trillion tokens: including synthetic data. Training tokens are not a count of distinct human text. So the field is looking for more: rephrased text, synthetic text and other kinds of data, the subject of part eighteen.
The takeaway: a few passes over the same data are almost as good as new data, but each repeat is worth less, and the total saturates. Next, two other budgets: experts, and bits.
12Experts and bitsEngineering2 min
Dense hidden matrices are used for every character, so enlarging them grows compute and parameters together. A mixture of experts, which part sixteen will build, loosens the link: many experts, and a router that sends each character to one. Add experts of the same width, using one expert matrix per character. The selected-expert work stays fixed, while routing adds overhead. DeepMind measured this in 2022: the loss falls with the number of experts, and the gain shrinks as the base model grows. Since then experts have become smaller and more numerous: DeepSeek-V3 has two hundred and fifty-six of them in each layer, and uses eight for each token.
Pause and predict. Round non-embedding weight matrices to four bits after training. Which suffers more: a model that read a little, or the same model after reading much more?
Parameters also cost memory, and that can be cut by storing them with fewer bits. After training, round the non-embedding weight matrices row by row; embeddings and biases stay unchanged. Measure the loss change. At width 256, Fit the finite changes above 0.002 bits, from lengths of at least two to the seventeen characters. The formula has D exponent , denominator N exponent , and an exponential precision term. In 2024 Tanishq Kumar and colleagues found the same form in four hundred and sixty-five runs: past some point, more training data makes a model worse once it is quantized. And training itself in low precision acts like having fewer parameters. Under their compute-cost model, jointly optimizing size, data and training precision favors about seven to eight bits.
The takeaway: parameters, compute and bits can be traded separately. Experts add parameters with routing overhead; fewer bits save memory, at a price that grows with how much the model has read. Next: why any of these laws should be power laws.
13Why power laws?Research3 min
Why should loss fall as a power law at all? One answer, from Utkarsh Sharma and Jared Kaplan in 2020: assume data lies near a surface of low dimension d, and N parameters provide about N local pieces. Each piece is about N to the minus one over d across. Use a linear Taylor approximation on each piece: the curvature leaves an error of order the piece's size squared. Square again for a squared loss: the loss falls like N to the minus four over d. A power law, with the exponent set by the data's dimension. Check an oracle approximation using a known smooth function and its analytic gradients, in dimensions 1, 2, 4 and 8. This does not train a network. Low-dimensional data, steep laws; language, by this account, is high-dimensional.
A second answer, from Eric Michaud, Max Tegmark and colleagues in 2023: the quantization model. Suppose what a model knows comes in discrete chunks, quanta, each a skill that is either learned or not, and that they are used with Zipf's frequencies, a power law. A model with room for n quanta learns the n most used, and loses the share of the rest. Add up a power-law tail, and you get a power law in n, so in the model's size. They built a task to test it, and we built a small version: 32 subtasks, each the parity of three hidden bits out of twelve, appearing with Zipfian frequencies.
Pause and predict. If every skill is learned suddenly, all or nothing, will the average loss fall in steps, or smoothly?
Here is one network, of width , learning the subtasks. We count a task as learned when its loss is below 0.1 bits. The curves show individual losses through training. By the end it has learned of the . White is the frequency-weighted average of these task losses. Across sizes, wider networks learn more subtasks, Compare average loss against the thresholded task count with an ideal tail that assumes the most frequent tasks are perfectly learned and all others cost one bit.
The takeaway: under their assumptions, local linear approximations of smooth targets, measured with squared error, and ideal Zipfian tails of skills can each produce power laws. Our finite toys illustrate these mechanisms. Next: if skills arrive suddenly, do abilities too?
14Emergence, or a mirage?Undergraduate3 min
In 2022, Jason Wei and colleagues at Google collected abilities that seemed to switch on with scale: absent in smaller models, present in larger ones, and so not predictable from the smaller ones. They called them emergent. In 2023, Rylan Schaeffer, Brando Miranda and Sanmi Koyejo at Stanford pointed at how they were scored. Most were graded all or nothing: is the whole answer exactly right? In a simple model with independent tokens, each right with the same probability p, an answer of L tokens is right with probability p to the L. A steady rise in p becomes, for long answers, a curve that lies flat and then shoots up. Score the same models smoothly, and the jumps disappear: a mirage, they said, made by the metric.
Pause and predict. Our models' accuracy on single characters rises smoothly with size. Score them on getting eight characters exactly right instead. What does that curve look like?
We can watch it happen on our own models. The task: from two thousand places in held-out text, write the next characters exactly. Average teacher-forced accuracy over all eight positions: from to percent across our sizes. Now score greedy prefixes. The one-character score uses only the first position. Two, four and eight characters require increasingly long prefixes to be entirely right. In the independent-token illustration, use the teacher-forced accuracy as p: between and percent. Powers of p shrink with answer length. This is a schematic explanation, not an identity with the greedy-prefix scores.
The quanta toy offers another view. Each subtask has its own continuous loss. Plot each one's final loss against the network's size: Compare these curves with the frequency-weighted average, in white. Averaging can hide sharper changes in individual subtasks. These are sampled widths, not a proof of a discontinuity. Later work made this useful. In 2024 Zhengxiao Du and colleagues found that abilities appear when the pretraining loss falls below a threshold, whatever the size of the model, and Charlie Snell and colleagues showed that fine-tuning brings an ability forward to smaller models, so its arrival can be forecast.
The takeaway: all-or-nothing scores can make steady progress look like a jump. Individual task losses can change more sharply than their average, without demonstrating a mathematical discontinuity. Forecasts need validation beyond the sizes we observed. Next, the strangest jump of all.
15GrokkingMaster's3 min
In 2022, a team at OpenAI noticed something strange. Take a tiny task: addition on a clock with 97 hours, so fifty plus sixty is thirteen. Show a small network forty percent of the addition table, and ask it to fill in the rest.
It memorizes the entries it was shown within about steps, and for a long time it gets the unseen ones no better than chance. Keep training anyway. times as long, at step , accuracy on the unseen entries shoots up to nearly a hundred percent. The network has found the rule. They called it grokking. Weight decay keeps squeezing the weights, and a lookup table of memorized answers costs more weight than the rule.
Pause and predict. With more weight decay, will understanding come sooner, later, or not at all? And with none?
Is weight decay really what drives it? Sweep it, from none to three, three seeds each. Memorizing takes between and steps every time. Generalizing does not.
What rule did it find? Look at the vectors it learned for the numbers, and ask which waves around the clock they contain: their Fourier spectrum. Watch it through training. At first the energy is spread over all frequencies, noise. by the end, percent of the energy sits in five of the . The number vectors are projected onto the final principal directions. Each snapshot is rescaled to compare shapes.
An ideal Fourier circuit represents numbers by angles. Adding two numbers on a clock is adding two angles, and the cosine of a sum is a sum of products of cosines and sines, which the ReLU units can build. Positive waves peak at the correct sum. For the empirical check, subtract each input pair's mean answer logit and fit five separately weighted cosine waves by least squares over all ninety-seven cubed scores. They account for percent of this centred variation. Neel Nanda and colleagues worked this circuit out in 2023, one of the first complete explanations of what a trained network computes; part thirty takes the idea to real models. And chapter two's question returns: is this network lazy?
The takeaway: a network can fit its data long before it finds the rule, and weight decay pushes it toward the rule, which here is a small trigonometric circuit. Part thirty looks for circuits like it inside real models.
16Scaling the answerMaster's3 min
Scaling is often described as bigger models and more data. In 2024, OpenAI's o1 highlighted another axis: accuracy rose smoothly with the logarithm of how long the model thought before answering. Part twenty-eight builds reasoning models. Here, the mathematics of the simplest version: many tries, and a checker. For our held-out prefixes, calculate each model's temperature-one probability of writing the next characters exactly. With independent repeated tries and a perfect exact-answer oracle, compute the expected share solved. These curves compare expected coverage over five orders of magnitude in tries. In 2024, Bradley Brown and colleagues measured sampled coverage with a real model: on a benchmark of real coding problems, two hundred and fifty tries took it from 15.9 to 56 percent.
Pause and predict. For one problem, more tries help exponentially fast. Averaged over a whole benchmark, will the failures also fall exponentially?
Why a power law? For one problem, k independent tries all fail with probability one minus p, all raised to k: that falls exponentially, fast. But the benchmark averages over problems of every difficulty. If very hard problems, with tiny p, are spread like p to the b minus one, the average failure is a gamma integral, and it falls like k to the minus b: a power law, made entirely by the hardest problems. Rylan Schaeffer and colleagues showed this in 2025. The density is an idealization: on a finite benchmark with positive success probabilities, the far tail eventually decays exponentially. Our actual fit uses minus log pass, which approximates failure only near full coverage. For this proxy, For the probability tail,
Use the expected-coverage curves to compare sizes. Interpolate how many tries match the largest model's one try. The smallest that gets there needs about . These are interpolated expectations, not new decoding trials. Whether that is a good trade depends on the price of training the big model, and on having a checker. Reinforcement learning, which trains reasoning models, is being scaled too. In 2025, Devvrit Khatri and colleagues at Meta spent four hundred thousand GPU-hours finding its law: reward rises along a sigmoid toward a ceiling, and fitted early, it predicted a hundred-thousand-GPU-hour run. The same year, xAI said it had run reinforcement learning on Grok 4 at the scale of pretraining.
The takeaway: with an oracle checker, independent tries can trade answer-time compute for model size. A suitable tail of hard problems can produce power-law-like failure decay over a finite range. These assumptions and the useful range need checking on each benchmark. Part twenty-eight builds models that think before they answer.
17Has pretraining stalled?Research3 min
Has pretraining stopped paying? In December 2024, Ilya Sutskever told the field's largest conference that pre-training as we know it will end: compute keeps growing, but we have but one internet. In February 2025, OpenAI released GPT-4.5, its largest model yet, a scale-up of pretraining. The growth moved elsewhere: in July, xAI ran reinforcement learning on Grok 4 at the scale of pretraining, and Epoch AI estimated that GPT-5 had probably used less training compute than GPT-4.5. Then in November, Google's Gemini 3, and Oriol Vinyals wrote that its gain from pretraining was as big as they had ever seen. In July 2026, Sundar Pichai said the next frontier needs much larger base models, and that Gemini 4 was in training. And in October, Microsoft described a mixture of experts with two point eight trillion parameters, its performance forecast in advance from a ladder of smaller models.
Pause and predict. Fit the law on cheaper runs in our fit cohort, and predict runs ten times costlier. Will it miss by a hundredth of a bit, a tenth, or more?
What can a scaling law actually tell us? Test ours the way laboratories use theirs. Fit Chinchilla's formula on the cheaper runs in our -run fit cohort, and predict its other , up to times costlier. On average the prediction is off by bits, at worstFor the simple power-law model with Kaplan's compute exponent, 0.05, halving its loss requires about a million times the compute. Whether each step buys enough capability to justify its compute is an empirical question.
The other side of the ledger is efficiency. In 2024, Anson Ho and colleagues at Epoch AI estimated that the compute needed to reach a given language-model performance halved about every eight months, from better architectures, data and training. The same year, Chaojun Xiao and colleagues at Tsinghua measured a densing law: the capability packed into each parameter of open models doubled about every three months. These studies describe efficiency trends over particular ranges. Pretraining, reinforcement learning and answer-time compute each need their own measurements. Their continuation and the cost of further progress need testing.
The takeaway: measured scaling trends can guide forecasts, but extrapolation needs validation. Efficiency has reduced the cost of fixed performance in the cited studies; the value and cost of the next frontier step remain open questions. Now, the recap.
Recap, problems, and what comes nextAll tracks2 min
Let's take stock. Over measured ranges, loss often follows power laws in size, data and compute; forecasts beyond those ranges need validation. With neural-tangent scaling, an infinitely wide network trains like its own fixed tangent kernel, which learns no new features. Mu-P keeps every layer learning, and lets one learning rate serve every width and, with CompleteP, every depth. A budget should be split between size and data along the floor of Chinchilla's valley, then bent toward smaller models that answer cheaply, and stretched by repeating data, which is worth less each time. Power laws can come from data on a low-dimensional surface, or from many small skills learned at different times, whose losses are averaged. And a network can memorize first and understand much later, by turning clock arithmetic into rotations.
Act two ends here, and all of this comes back. Experts are part sixteen. Part eighteen trains a model with the whole recipe: mu-P, batch sizes, schedules and eight-bit arithmetic. Part nineteen is the cost of answering. Parts twenty-seven and twenty-eight scale reinforcement learning and thinking. Grokking's circuit is a first taste of part thirty, and forecasting what models will be able to do is part thirty-one.
Here are six problems, from the tangent kernel to the power law of many tries. Pause here and work through them; full solutions are in this part's notes.
Next time, act three begins: the transformer era. First, attention: how every word looks back at every earlier word and decides which ones matter, as geometry. And we'll build a small transformer of our own.
The Chinchilla paper is very readable, and Roberts, Yaida and Hanin's book is the deep end on wide networks. Thanks for watching, and see you in part thirteen.
Where it goes next. Part 14 tells the story of GPT-3, Gopher and Chinchilla model by model; experts return in Part 16; Part 18 trains with the whole recipe (muP, batch sizes, schedules, eight-bit arithmetic) and does the FLOP accounting of a real run; the cost of answering is Part 19; Parts 27 and 28 scale reinforcement learning and thinking; grokking's circuit is a first taste of Part 30, and forecasting what models will do is Part 31.
Key results
The part's results in one place, for revision.
Try it
Lab 12 · One learning rate for every width: the coordinate check
Train a two-hidden-layer tanh network for four Adam steps at widths 32 to 512, with gradients from the series' autodiff, and measure how far the output and the hidden coordinates move. With one learning rate for every width (the standard parametrization) the movement grows with width; with muP's rules it does not.
python -m videos.ai.labs 12
needs numpy, scipy, matplotlib · download lab12.py ·
source on GitHubstandard: output moves at width 32 / 512 0.0130 / 0.5120 (slope +1.32 on log axes)
standard: a hidden coordinate moves 0.0028 / 0.0345 (slope +0.89)
muP: output moves at width 32 / 512 0.0100 / 0.0081 (slope -0.06 on log axes)
muP: a hidden coordinate moves 0.0027 / 0.0021 (slope -0.07)
theory random sums grow like n^0.5, aligned updates like n: slope 0 needs lr ~ 1/n
With one learning rate the update to every coordinate is a sum of n aligned terms and grows with the width; muP's 1/n learning rates keep each layer's movement the same size at every width, so a rate tuned on the small model can be reused.
The code (87 lines; it asserts its own result)
"""Lab 12: the coordinate check: four Adam steps at growing width, in the standard parametrization and in muP."""
import numpy as np
from videos.coursekit import labs
from explainer.ai.autodiff import Tensor
TITLE = "One learning rate for every width: the coordinate check"
GOAL = ("Train a two-hidden-layer tanh network for four Adam steps at widths 32 to 512, with gradients from the "
"series' autodiff, and measure how far the output and the hidden coordinates move. With one learning rate for "
"every width (the standard parametrization) the movement grows with width; with muP's rules it does not.")
TASKS = [
"Keep muP's learning rates but start the output layer at the standard size (variance 1/n). What moves now?",
"Replace Adam by plain SGD (step = -lr * gradient). Which muP learning rates must change, and to what power of n?",
"Shrink every learning rate by n ** -0.5 on top of muP and watch the hidden coordinates: this is the lazy limit.",
]
D_IN, BASE, STEPS, LR, REPEATS = 8, 32, 4, 1e-4, 2
WIDTHS = (32, 64, 128, 256, 512)
def forward(params, X):
"""f(x) = v . tanh(W2 tanh(W1 x)); returns (output, second hidden layer's pre-activations)."""
W1, W2, v = params
z2 = (Tensor(X) @ W1).tanh() @ W2
return z2.tanh() @ v, z2
def moves(n, mup, X, y, rng):
"""Mean absolute change of the output and of a hidden pre-activation after STEPS Adam steps at width n."""
out_sd = np.sqrt(BASE) / n if mup else 1 / np.sqrt(n) # muP starts the output layer small; equal at the base width
params = [Tensor(rng.standard_normal((D_IN, n)) / np.sqrt(D_IN), requires_grad=True),
Tensor(rng.standard_normal((n, n)) / np.sqrt(n), requires_grad=True),
Tensor(rng.standard_normal((n, 1)) * out_sd, requires_grad=True)]
scale = BASE / n if mup else 1.0 # muP: hidden and output learning rates shrink like 1/n
lrs = [LR, LR * scale, LR * scale]
m = [np.zeros_like(p.data) for p in params]
s = [np.zeros_like(p.data) for p in params]
f0, z0 = (t.data.copy() for t in forward(params, X))
for t in range(1, STEPS + 1):
for p in params:
p.grad = np.zeros_like(p.data)
out, _ = forward(params, X)
(((out - y) ** 2).mean() * 0.5).backward()
for i, p in enumerate(params): # Adam (Kingma & Ba 2014) with bias correction
m[i] = 0.9 * m[i] + 0.1 * p.grad
s[i] = 0.999 * s[i] + 0.001 * p.grad ** 2
p.data -= lrs[i] * (m[i] / (1 - 0.9 ** t)) / (np.sqrt(s[i] / (1 - 0.999 ** t)) + 1e-12)
f1, z1 = (t.data for t in forward(params, X))
return np.abs(f1 - f0).mean(), np.abs(z1 - z0).mean()
def run(seed=0):
rng = np.random.default_rng(seed)
X = rng.standard_normal((32, D_IN))
y = np.sin(X[:, :1] * 2) + 0.5 * X[:, 1:2]
lab = labs.Lab()
res = {}
for name, mup in (("standard", False), ("muP", True)):
both = np.array([np.mean([moves(n, mup, X, y, rng) for _ in range(REPEATS)], axis=0) for n in WIDTHS])
res[name] = dict(out=both[:, 0], hid=both[:, 1],
out_slope=np.polyfit(np.log(WIDTHS), np.log(both[:, 0]), 1)[0],
hid_slope=np.polyfit(np.log(WIDTHS), np.log(both[:, 1]), 1)[0])
r = res[name]
lab.row(f"{name}: output moves at width 32 / 512", f"{r['out'][0]:.4f} / {r['out'][-1]:.4f} (slope {r['out_slope']:+.2f} on log axes)")
lab.row(f"{name}: a hidden coordinate moves", f"{r['hid'][0]:.4f} / {r['hid'][-1]:.4f} (slope {r['hid_slope']:+.2f})")
lab.row("theory", "random sums grow like n^0.5, aligned updates like n: slope 0 needs lr ~ 1/n")
lab.note = ("With one learning rate the update to every coordinate is a sum of n aligned terms and grows with the "
"width; muP's 1/n learning rates keep each layer's movement the same size at "
"every width, so a rate tuned on the small model can be reused.")
sp, mu = res["standard"], res["muP"]
assert sp["out_slope"] > 0.4 and sp["hid_slope"] > 0.6, "standard parametrization: the update grows with width"
assert abs(mu["out_slope"]) < 0.25 and abs(mu["hid_slope"]) < 0.25, "muP: flat in width"
assert sp["out"][-1] > 2.5 * mu["out"][-1], "at the largest width the standard network has moved several times further"
assert mu["hid"][-1] > 0.6 * mu["hid"][0], "muP's hidden layer still learns (it is not lazy)"
fig, ax = labs.figure(2, size=(11, 4.2))
for a, key, title in ((ax[0], "out", "How far the output moves in four Adam steps"),
(ax[1], "hid", "How far a hidden coordinate moves")):
a.loglog(WIDTHS, sp[key], "o-", color=labs.RED, label=f"standard: slope {sp[key + '_slope']:+.2f}")
a.loglog(WIDTHS, mu[key], "o-", color=labs.GREEN, label=f"muP: slope {mu[key + '_slope']:+.2f}")
a.set(title=title, xlabel="width n", ylabel="mean absolute change")
a.set_xticks(WIDTHS, labels=[str(w) for w in WIDTHS])
a.tick_params(axis="x", which="minor", bottom=False, labelbottom=False)
a.legend()
lab.fig = fig
return lab
Now change it
- Keep muP's learning rates but start the output layer at the standard size (variance 1/n). What moves now?
- Replace Adam by plain SGD (step = -lr * gradient). Which muP learning rates must change, and to what power of n?
- Shrink every learning rate by n ** -0.5 on top of muP and watch the hidden coordinates: this is the lazy limit.
Problems, with solutions
Try each problem before opening its solution.
1. The tangent kernel freezes. For f(x) = (1/√n) Σⱼ aⱼ φ(wⱼ x) with independent 𝒩(0, 1) weights, write the tangent kernel Θ(x, x′) as an average over the n units, and show that its fluctuation is O(1/√n). By how much does one gradient step move each aⱼ?
Solution
The gradient with respect to aⱼ is φ(wⱼx)/√n, and with respect to wⱼ it is aⱼ φ′(wⱼx) x/√n, so Θ(x, x′) = (1/n) Σⱼ [φ(wⱼx) φ(wⱼx′) + aⱼ² φ′(wⱼx) φ′(wⱼx′) x x′]: an average of n independent, identically distributed terms. By the law of large numbers it tends to its expectation, a fixed kernel; by the central limit theorem its fluctuation around it is O(1/√n). A gradient step on the squared error changes aⱼ by −η (1/m) Σᵢ rᵢ φ(wⱼxᵢ)/√n = O(1/√n): each weight moves by O(1/√n), and the vector of n weights, of length O(√n), by a relative O(1/√n).
2. μP's learning rate. A hidden layer h = Wx has n inputs of size Θ(1). Show that the update ΔW = −η g xᵀ changes hᵢ by η gᵢ ‖x‖² = Θ(ηn), while a random W with variance σ² gives |hᵢ| = Θ(σ√n). Deduce μP's η ∝ 1/n.
Solution
(ΔW x)ᵢ = −η gᵢ Σⱼ xⱼ xⱼ = −η gᵢ ‖x‖², and ‖x‖² is a sum of n positive terms of size Θ(1), so Θ(n): the change is Θ(ηn). For a random W, hᵢ = Σⱼ Wᵢⱼ xⱼ is a sum of n independent terms with mean 0 and variance σ²xⱼ², so its standard deviation is σ‖x‖ = Θ(σ√n). Keeping h of size Θ(1) needs σ ∝ 1/√n; keeping its change Θ(1) needs η ∝ 1/n. With Adam the step is about η per entry whatever the gradient's size, so ΔW x is again a sum of n aligned terms, and the hidden learning rate must again shrink like 1/n.
3. Chinchilla's split. From L = E + AN^(−α) + BD^(−β) and C = 6ND, derive N_opt and D_opt. With Chinchilla's published fit and Besiroglu et al.'s refit, compute the tokens per parameter at C = 5.76 × 10²³.
Solution
Substituting D = C/6N and setting dL/dN = 0: αA N^(−α−1) = βB (C/6)^(−β) β⁻¹·β N^(β−1), i.e. αA N^(−α) = βB D^(−β). With G = (αA/βB)^(1/(α+β)) this gives N_opt = G (C/6)^(β/(α+β)) and D_opt = G⁻¹ (C/6)^(α/(α+β)). Published fit (E = 1.69, A = 406.4, B = 410.7, α = 0.3392, β = 0.2849): N_opt ≈ 4.0 × 10¹⁰, D_opt ≈ 2.4 × 10¹², about 59 tokens per parameter, far from Chinchilla's own 70B on 1.4T. Refit (A = 482.0, B = 2085.4, α = 0.3478, β = 0.3658): N_opt ≈ 7.2 × 10¹⁰, D_opt ≈ 1.3 × 10¹², about 18 tokens per parameter, close to the 20 of approaches 1 and 2 and to Chinchilla itself.
4. Training for inference. Minimize 6ND + 2NT subject to L(N, D) = L*. Show that the optimal N decreases as the inference tokens T grow, and find its limit as T → ∞.
Solution
With a multiplier μ: 6D + 2T = μαA N^(−α−1) and 6N = μβB D^(−β−1). Eliminating μ, αA N^(−α) / (βB D^(−β)) = 1 + T/(3D). At T = 0 the two marginal gains are equal (Chinchilla); as T grows the parameter term's marginal gain must exceed the data term's, which on the level set L = L* means a smaller N and a larger D. As T → ∞ the cost is dominated by 2NT, so N is pushed to the smallest value from which L* can be reached at all: N_min = (A/(L* − E))^(1/α), with D → ∞.
5. Repeated data. Show that D′ = U + U R*(1 − e^(−R/R*)) satisfies D′ ≈ U(1 + R) for R ≪ R*, and D′ → U(1 + R*) as R → ∞.
Solution
For R ≪ R*, 1 − e^(−R/R*) ≈ R/R*, so D′ ≈ U + U R* · R/R* = U(1 + R): the total read, every repeat as good as new. As R → ∞, e^(−R/R*) → 0 and D′ → U + U R* = U(1 + R*): no amount of repetition is worth more than 1 + R* passes of new data.
6. The power law of many tries. If one try succeeds with probability p, and p has density c p^(b−1) near 0, show that 1 − pass@k ∼ c Γ(b) k^(−b). What is b for p uniform on [0, 1]?
Solution
1 − pass@k = ∫₀¹ (1 − p)^k f(p) dp. For large k, (1 − p)^k ≈ e^(−kp) is negligible unless p ≲ 1/k, where f(p) ≈ c p^(b−1); so 1 − pass@k ≈ c ∫₀^∞ e^(−kp) p^(b−1) dp = c Γ(b) k^(−b) (substitute u = kp). Each problem's failure falls exponentially; the power law comes from the problems with tiny p. For p uniform, f = 1, so b = 1 and c = 1: indeed ∫₀¹ (1 − p)^k dp = 1/(k + 1) ≈ k⁻¹.
Notes and sources
Glossary
| English | 中文 |
|---|---|
| scaling law, power law plus a floor | 规模定律,幂律加下限 |
| irreducible loss, reducible loss | 不可约损失,可约损失 |
| infinite-width limit | 无限宽极限 |
| neural network Gaussian process (NNGP) | 神经网络高斯过程(NNGP) |
| neural tangent kernel (NTK), tangent features | 神经正切核(NTK),切线特征 |
| linearization (of a network) | (网络的)线性化 |
| lazy training, lazy regime | 惰性训练,惰性区 |
| rich regime, feature learning | 丰富区,特征学习 |
| mean-field parametrization | 平均场参数化 |
| standard parametrization (SP) | 标准参数化(SP) |
| maximal update parametrization (μP) | 最大更新参数化(μP) |
| coordinate check | 坐标检查 |
| hyperparameter transfer (μTransfer) | 超参数迁移(μTransfer) |
| fan-in, fan-out | 扇入,扇出 |
| branch multiplier, depth-μP, CompleteP | 分支乘子,深度μP,CompleteP |
| lazy in depth | 深度上的惰性 |
| critical batch size, gradient noise scale | 临界批量大小,梯度噪声尺度 |
| steps–examples trade-off | 步数与样本数的权衡 |
| warmup-stable-decay (WSD), cool-down branch | 预热-稳定-衰减(WSD),冷却分支 |
| compute-optimal, Chinchilla-optimal | 计算最优,Chinchilla最优 |
| iso-FLOP curve, iso-FLOP valley | 等算力曲线,等算力谷 |
| Lagrange multiplier | 拉格朗日乘子 |
| non-embedding parameters | 非嵌入参数 |
| bootstrap (resampling) | 自助法(重抽样) |
| over-training, inference-aware scaling | 过度训练,计入推理的规模定律 |
| data-constrained scaling, epochs, effective data | 数据受限的规模定律,轮数(epoch),有效数据量 |
| effective parameter count | 有效参数量 |
| post-training quantization (PTQ), round to nearest | 训练后量化(PTQ),就近取整 |
| precision scaling law | 精度规模定律 |
| fine-grained experts, granularity | 细粒度专家,粒度 |
| data manifold, intrinsic dimension | 数据流形,内在维数 |
| quantization model of scaling, quanta | 规模的量子化模型,量子 |
| multitask sparse parity, Zipf's law | 多任务稀疏奇偶性,齐普夫定律 |
| emergent ability, exact match, metric artifact | 涌现能力,精确匹配,度量造成的假象 |
| grokking, memorization, generalization | 顿悟(grokking),记忆,泛化 |
| weight decay | 权重衰减 |
| Fourier spectrum, key frequencies | 傅里叶频谱,关键频率 |
| kernel distance | 核距离 |
| pass@k, coverage, repeated sampling | pass@k,覆盖率,重复采样 |
| test-time compute | 测试时计算 |
| sigmoidal compute–performance curve | S形的算力-性能曲线 |
| densing law, capability density | 致密化定律,能力密度 |
| algorithmic progress | 算法进步 |
| scaling ladder | 规模阶梯 |
Sources
Recent claims were checked against their primary reports: Sutskever's NeurIPS 2024 talk ("Pre-training as we know it will unquestionably end"; "we have but one internet", from transcripts of the recorded talk); the GPT-4.5 system card (27 February 2025: "our largest and most knowledgeable model yet", "scales pre-training further"); xAI's Grok 4 announcement (9 July 2025: reinforcement learning "at pretraining scale", "over an order of magnitude more compute"); Epoch AI's Why GPT-5 used less training compute than GPT-4.5 (26 September 2025); Microsoft AI's Frontier Pre-training at Microsoft AI (15 October 2026: MAI-Base-2, 80B active / 2.8T total parameters, 16k GB200s for 38 days, forecast from scaling ladders); Meta's Llama 4 post (5 April 2025: MetaP; more than 30 trillion tokens); Dey et al., CompleteP (Table 1; 11.8% and 34.4% FLOP savings); Khatri et al. (2025: the sigmoid, 400,000 GPU-hours, a 100,000-GPU-hour run); Besiroglu et al. (2024: Table 1; 600,000 against fewer than 500 experiments); Hoffmann et al. (2022: Table 2, a = 0.50, 0.49, 0.46); Kaplan et al. (2020: Eqs. 1.1–1.8, B_crit); Hestness et al. (2017: exponents −0.07 to −0.35; word LMs −0.066; three regions); Muennighoff et al. (2023: Eq. 5, R*_D = 15.39); Villalobos et al. (2024: an effective stock of about 4 × 10¹⁴ tokens, full use between 2026 and 2032, median 2028); Kumar et al. (2024: Eq. 2, N_eff = N(1 − e^(−P/γ)), 7–8 bits); DeepSeek-V3 (671B / 37B, 256 routed experts with 8 active; batch 3,072 → 15,360 over 469B tokens); Schaeffer et al. (2025: −log pass@k ∼ CΓ(b)k^(−b)); Brown et al. (2024: 15.9% → 56% on SWE-bench Lite); Ho et al. (2024: halving every 8 months, 5–14); Xiao et al. (2024: density doubles about every three months). Two items rest on reports of a primary source that could not be fetched directly: Oriol Vinyals's post on Gemini 3 (X, November 2025: "The delta between 2.5 and 3.0 is as big as we've ever seen", quoted identically by several outlets) and Sundar Pichai's words on Alphabet's Q2 2026 earnings call (22 July 2026: "For the next generation of frontier, you're going to need much larger base models. We are now training Gemini 4", from transcripts and 9to5Google). OpenAI's o1 post (September 2024) was blocked to the fetcher; its scaling claim is quoted from reproductions of the post.
Sources
Books: D. A. Roberts, S. Yaida & B. Hanin, The Principles of Deep Learning Theory (2022); S. J. D. Prince, Understanding Deep Learning (2023).
Papers: Neal (1996); Lee et al., Deep Neural Networks as Gaussian Processes (2018); Jacot, Gabriel & Hongler (2018); Lee et al., Wide Neural Networks of Any Depth Evolve as Linear Models (2019); Dyer & Gur-Ari, Asymptotics of Wide Networks from Feynman Diagrams (2019); Fort et al., Deep Learning versus Kernel Learning (2020); Chizat, Oyallon & Bach, On Lazy Training (2019); Yang & Hu, Tensor Programs IV (2021); Yang et al., Tensor Programs V (2022); Yang, Yu, Zhu & Hayou, Tensor Programs VI (2023); Bordelon et al., Depthwise Hyperparameter Transfer in Residual Networks (2023); Everett et al., Scaling Exponents Across Parameterizations and Optimizers (2024); Dey et al., Don't be lazy: CompleteP (2025); McCandlish et al., An Empirical Model of Large-Batch Training (2018); Zhang et al., How Does Critical Batch Size Scale in Pre-training? (2024); Bergsma et al., Power Lines (2025); Banko & Brill (2001); Hestness et al., Deep Learning Scaling is Predictable, Empirically (2017); Kaplan et al., Scaling Laws for Neural Language Models (2020); Hoffmann et al., Training Compute-Optimal Large Language Models (2022); Besiroglu et al., Chinchilla Scaling: A Replication Attempt (2024); Pearce & Song, Reconciling Kaplan and Chinchilla Scaling Laws (2024); Porian et al., Resolving Discrepancies in Compute-Optimal Scaling of Language Models (2024); Hägele et al., Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations (2024); Sardana et al., Beyond Chinchilla-Optimal (2023); Muennighoff et al., Scaling Data-Constrained Language Models (2023); Villalobos et al., Will We Run Out of Data? (2024); Clark et al., Unified Scaling Laws for Routed Language Models (2022); Krajewski et al., Scaling Laws for Fine-Grained Mixture of Experts (2024); Kumar et al., Scaling Laws for Precision (2024); Sharma & Kaplan, A Neural Scaling Law from the Dimension of the Data Manifold (2020); Michaud et al., The Quantization Model of Neural Scaling (2023); Wei et al., Emergent Abilities of Large Language Models (2022); Schaeffer, Miranda & Koyejo, Are Emergent Abilities of Large Language Models a Mirage? (2023); Du et al., Understanding Emergent Abilities from the Loss Perspective (2024); Snell et al., Predicting Emergent Capabilities by Finetuning (2024); Power et al., Grokking (2022); Nanda et al., Progress Measures for Grokking via Mechanistic Interpretability (2023); Kumar, Bordelon, Gershman & Pehlevan, Grokking as the Transition from Lazy to Rich Training Dynamics (2023); Brown et al., Large Language Monkeys (2024); Schaeffer et al., How Do Large Language Monkeys Get Their Power (Laws)? (2025); Khatri et al., The Art of Scaling Reinforcement Learning Compute for LLMs (2025); Ho et al., Algorithmic Progress in Language Models (2024); Xiao et al., Densing Law of LLMs (2024); DeepSeek-AI, DeepSeek-V3 (2024); Qwen Team, Qwen3 (2025); Meta, Llama 3 (2024), Llama 4 (2025).
About this partfrom its README
Part 12 of a thirty-one-part series on how modern AI works and how it came to be (see the series plan
and the syllabus), and the end of Act II. What happens to a network as it grows, and how the field
learned to predict it: infinitely wide networks (Gaussian processes, the neural tangent kernel, lazy training); μP,
derived, and the learning rate carried across width and depth; the critical batch; scaling laws measured on our own
sweep and Chinchilla's compute-optimal split derived by Lagrange; what Kaplan missed and the 2024 replication;
over-training for inference, repeated data, experts and precision; why power laws at all (data manifolds and quanta);
emergence against metric artifacts; grokking and its Fourier circuit; and the frontier of 2024–26 (test-time compute,
reinforcement-learning scaling, densing, and the argument over whether pretraining has stalled). Every model is trained
by compute.py on the CPU (PyTorch), several times over where a comparison is made. Part 14 tells the story of
GPT-3, Gopher and Chinchilla and of tokens per parameter model by model, and Part 18 does the FLOP accounting of a
real run; this part does the mathematics behind them.
- A straight line on log axes. The sweep's runs drawn at the compute each cost; the frontier, a floor plus a power law; how we got here, 1994–2026 (Neal; Banko & Brill 2001; Hestness et al. 2017; Jacot et al. 2018; Kaplan et al. 2020; Chinchilla, μTransfer and grokking 2022; data limits and the mirage 2023; o1 2024; RL at pretraining scale 2025; larger base models 2026); the plan.
- 1. Infinitely wide. A one-layer ReLU net's output over 6,000 random starts tends to a Gaussian of variance (x² + 1)/2 as the width grows (excess kurtosis falling to 0; Neal 1994/1996; Lee et al. 2018); five random wide nets as samples of a Gaussian process; the tangent kernel defined and gradient flow derived as kernel regression (Jacot, Gabriel & Hongler 2018); measured at widths 30 … 30,000, three seeds: how far the weights move (∝ n^−1/2) and the kernel (closer to n^−1, as Dyer & Gur-Ari 2019 derived for its expected change), and the trained function against its own linearization, replayed (Lee et al. 2019).
- 2. Lazy. Part 11's character model trained with neural-tangent step sizes at widths 32 … 2,048: its features change less and less; Chizat, Oyallon & Bach (2019); the lazy network is a kernel method (Part 6; Part 8's over-parametrized fits); a task that needs a feature, y = (w*·x)² − 1 in 32 dimensions from 256 examples, trained in the neural-tangent and the mean-field (μP) parametrizations at width 1,024, three seeds each, against kernel regression with the initial kernel; every hidden unit's weights replayed through training (the rich units turn toward w*).
- 3. μP, derived. The central limit theorem against the law of large numbers: random weights add like √n, an update aligned with its input like n; η ∝ 1/n; μP's table for Adam (Yang & Hu 2021; Yang et al. 2022, Table 3); the coordinate check at widths 64 … 4,096 in both parametrizations.
- 4. One learning rate for every width. Learning-rate sweeps at widths 64, 256 and 1,024, standard and μP, two seeds; the cost of copying the small model's rate; Tensor Programs V (40M → 6.7B GPT-3, 7% of the cost); Everett et al. (2024); Llama 4's MetaP (2025).
- 5. Deeper and deeper. Branch multipliers L^−α: none, depth-μP (1/√L; Yang et al. 2023; Bordelon et al. 2023) and CompleteP (1/L; Dey et al. 2025, Table 1); a deep residual character model at depths 2 … 32 swept over nine learning rates in all three, two seeds; the best loss by depth and the cost of copying the shallow model's rate; CompleteP's 12–34% compute savings.
- 6. How big a batch? McCandlish et al. (2018) derived: the best step, the noise scale, steps against examples (S/S_min − 1)(E/E_min − 1) = 1; measured at batches 32 … 4,096 (the best of three learning rates each) to three loss levels, with the critical batch fitted, against the noise scale measured from gradients; Kaplan's B_crit(L); the critical batch grows with data, not size (Zhang et al. 2024; Bergsma et al. 2025); DeepSeek-V3's batch ramp.
- 7. Scaling laws, measured. Hestness et al. (2017): power laws in four domains and three regions; Kaplan et al. (2020); our sweep: 11 widths × lengths 2¹⁶ … 2²⁴ characters, one constant-rate trunk per width with a cool-down branch at each length (Hägele et al. 2024); L(N) and L(D) with power-law-plus-floor fits; seed-to-seed spread.
- 8. Chinchilla's valley. L(N, D) = E + A/N^α + B/D^β fitted (Huber on log loss, L-BFGS from a grid, as Hoffmann et al. 2022); the compute-optimal split by a Lagrange multiplier; the fitted surface in 3D with the iso-FLOP lines and the valley floor; Chinchilla's three methods on our runs (envelope, iso-FLOP parabolas, the fit, with bootstrap intervals) against Chinchilla's 0.50 / 0.49 / 0.46 and Kaplan's 0.73.
- 9. What Kaplan missed. Gopher (280B, 300B tokens) against Chinchilla (70B, 1.4T) at the same compute; counting parameters without the embedding and output layers, on our own runs (Pearce & Song 2024); last-layer cost, warmup and β₂ (Porian et al. 2024); Epoch AI's replication of approach 3 (Besiroglu et al. 2024: a = 0.51, about 20 tokens per parameter; the published interval would need 600,000 runs).
- 10. Trained for the long run. The price of a smaller model for the same loss, from the fit, checked against our runs; inference in the budget (Sardana et al. 2023): minimize 6ND + 2NT at fixed loss; the best tokens per parameter against lifetime use; Llama 3's 1,900 tokens per parameter.
- 11. When the data runs out. 4.2 million characters of training drawn from 4.2 million down to 16,384 distinct ones (1 … 256 epochs), three seeds; the effective data read off the fresh-data curve and Muennighoff et al.'s R* fitted; the stock of public text (Villalobos et al. 2024); Qwen3's 36 trillion tokens.
- 12. Experts and bits. The hidden layer split into 1 … 32 experts, one used per character, two seeds, against the dense sweep (Clark et al. 2022; Krajewski et al. 2024; DeepSeek-V3); post-training quantization to 8 … 3 bits on every endpoint of the sweep, the damage against training length, and Kumar et al.'s form fitted.
- 13. Why power laws? The data-manifold derivation (Sharma & Kaplan 2020), checked with N linear pieces on manifolds of dimension 1, 2, 4, 8; the quantization model (Michaud et al. 2023), derived, and its multitask sparse parity in small (32 Zipfian subtasks, widths 8 … 512, two seeds): subtasks learned suddenly, one at a time; the average smooth; the final loss against the number of subtasks learned, on the theory's curve Σ_{k>n} p_k, and the finite task's tail running out.
- 14. Emergence, or a mirage? Wei et al. (2022); Schaeffer, Miranda & Koyejo (2023): p^L; our models on a checkable task (write the next characters exactly), per-character against whole-answer scores; quanta's real cliffs (every subtask at every width, as a grid); Du et al. (2024); Snell et al. (2024).
- 15. Grokking. (a + b) mod 97 from 40% of the table (Power et al. 2022), the run replayed; weight decay swept over five values, three seeds; the number vectors' Fourier spectrum lighting up through training, the five key frequencies, the circles; the trigonometric circuit and how much of the trained scores it explains (Nanda et al. 2023); the tangent kernel's distance from its start (Fort et al. 2020), with and without weight decay, against Kumar et al.'s lazy-to-rich account (2023).
- 16. Scaling the answer. o1 (2024; its two scaling plots drawn as a labelled schematic); pass@k on our checkable task over five orders of magnitude of tries; the power law of −log pass@k derived from the hardest problems (Schaeffer et al. 2025) and checked against the measured tail; tries against size, and what the tries cost in operations; reinforcement learning's sigmoid (Khatri et al. 2025); Grok 4 (2025).
- 17. Has pretraining stalled? The debate, 2024–26 (Sutskever; GPT-4.5; Grok 4; Epoch AI on GPT-5; Gemini 3; Pichai on Gemini 4; Microsoft's MAI-Base-2); our law fitted on the cheapest runs and predicting the rest; the slowness of the curve; efficiency (Ho et al. 2024; the densing law, Xiao et al. 2024).
- Recap in eight pictures from the part's own results, where it comes back, six problems, Part 13's teaser, references.
Every chapter follows the series' lecture standard: its card asks the motivating question; the derivations run step by step with a reason in the margin; a pause-and-predict card comes before each chapter's main experiment; the computed check answers it; and a takeaway card closes the chapter with a link forward.
Run from the repo root:
What is computed and built
(filled in from .cache/ai12/ by the run that made the video; the narration says whichever way they come out.)
Numbers from the run that made the video (Linux, one thread; compute.py took about 2.7 CPU-hours in all, the scaling
sweep 58 minutes of it):
- Infinitely wide. One-layer ReLU nets, 6,000 random starts: the output variance at x = 0.5 is 0.65, 0.64, 0.62, 0.64, 0.63 at widths 1, 2, 8, 64, 512 against the theory's 0.625; the excess kurtosis falls 15.8, 6.8, 2.0, 0.30, 0.00. Trained at widths 30 … 30,000 (three seeds): the weights move with slope −0.55 against width, the tangent kernel with slope −0.80 (between the n^−1/2 bound and Dyer & Gur-Ari's n^−1), and the trained function's gap to its linearization falls with slope −0.39 (0.35 at width 100, 0.067 at 10,000).
- Lazy. The character model in neural-tangent step sizes: its hidden features change with slope −0.35 against width (32 … 2,048). The feature task (w*·x)² − 1, d = 32, n = 256, width 1,024, three seeds: test error 1.38 lazy (1.21–1.61), 0.67 mean-field (0.49–0.87), 1.53 for kernel regression with the starting kernel; target variance 2.05. The lazy weights move 13% of their length, the mean-field ones 99%.
- μP. Coordinate check (widths 64 … 4,096, four Adam steps): the output scores' change grows like width^0.44 in SP and is flat in μP (−0.03). Learning-rate sweeps at widths 64, 256, 1,024 (11 rates, two seeds, 600 steps): the best rate drifts from 10^−1.9 to 10^−2.5 in SP (0.6 decades) and stays at 10^−1.9 in μP; copying the small model's rate costs 0.018 bits in SP and nothing in μP; μP's best loss falls 2.88 → 2.67 bits with width.
- Depth. Depths 2 … 32 at width 64 (nine rates, two seeds, 400 steps): the best rate moves 0, 0.31 and 0 decades for no scaling, 1/√L and CompleteP, all within one grid step; depth gains about 0.06–0.08 bits (3.05 at two blocks, 2.96–2.99 at 8–32). Too small and too short to separate the parametrizations — said so in the narration.
- Batch. Batches 32 … 4,096 at width 128 (best of three rates): critical batches 329, 1,063 and 2,397 characters to reach 3.4, 3.0 and 2.8 bits; the gradient noise scale measured directly, 1,576, 4,095 and 2,608: within a factor of 4.8.
- Sweep. 11 widths (7.8k … 1.36M parameters) × lengths 2¹⁶ … 2²⁴ characters, 94 endpoints from one constant-rate trunk per width with cool-down branches, plus four repeat seeds; best 1.965 bits (width 512, 2²⁴ characters). Seed spread at width 64 and 256: at most a few thousandths of a bit.
- Laws. L(N) at 2²⁴ characters: 1.82 + A N^−0.49; L(D) at width 512: 1.81 + B D^−0.41 (Kaplan: 0.076 and 0.095).
- Chinchilla. Fitted to the 49 runs of at least 2¹⁹ characters and width 64 and up (shorter runs are mostly warmup; the two narrowest models are mostly embedding): E = 1.76, α = 0.58, β = 0.43, RMS 0.025 bits; a = 0.424 (bootstrap 80%: 0.422–0.425), 0.443 from the iso-FLOP parabolas, 0.458 from the envelope; about 31 characters per parameter at the optimum (24–41 across budgets from the parabolas). Counting parameters Kaplan's way (no embedding or output layer) the same runs give 0.53.
- Over-training. From the fit at 10¹² operations (optimum 74,500 parameters, 2.2M characters): a model three quarters the size needs 5% more training compute for the same loss, half the size 45% more, and below 0.23 of the size no amount of data reaches it; two of our runs that got there (0.54 and 0.77 of the size) cost 52% and 5% more. Answering a hundred times the optimal training: about 760 characters per parameter, 0.35 of the size, 56% cheaper over the model's life.
- Data. 4.2M characters from 4.2M … 16,384 distinct ones (1 … 256 epochs), three seeds: 2.281, 2.289, 2.387, 3.45 and 11.5 bits; effective data from the fresh curve 0.98, 3.6 and 6.2 passes' worth for 1, 4 and 16 epochs (64 and 256 epochs are off the curve); R* = 5.8 (Muennighoff et al.: 15.4).
- Experts. 1 … 32 experts at width 128, two seeds: 2.356 → 2.215 bits; eight experts match a dense model of about 142,000 parameters, 2.5 times the base model, at the base model's compute per character.
- Precision. 4-bit rounding at width 256 costs 0.009 bits after 2¹⁶ characters and 1.58 after 2²⁴; Kumar et al.'s form fitted to 320 endpoints: γ_D = 0.70, γ_N = 0.25, γ = 0.65.
- Why power laws. Piecewise-linear fits on tori: slopes −3.99, −2.00, −0.97 for d = 1, 2, 4 (theory −4, −2, −1); −0.30 at d = 8 (theory −0.5, not yet asymptotic). Quanta: widths 8 … 512 learn 1, 2, 4, 6–7, 9–14, 32, 32 of 32 subtasks; the mean loss lies a little below the theory's Σ_{k>n} p_k (half-learned subtasks count).
- Emergence. At 2²² characters, per-character accuracy 43% → 57% across sizes; exact match on 8 characters 0.05% → 0.75%: on a linear axis it lies flat, in proportion it grows about 11 times against 1.3.
- Grokking. (a + b) mod 97 from 40% of the table: memorized at step 75, generalized (95% unseen) at 1,550 with weight decay 1 (21 times as long); never within 4,000 steps at weight decay 0, 0.1 or 0.3 (9 of 15 runs); 750–900 at weight decay 3. Five frequencies (1, 6, 22, 30, 41) hold 13% of the embedding's spectral energy at the start, 29% at step 1,000, 65% at the end; the five-wave circuit explains 75% of the trained scores' variation. The tangent kernel moves little (distance 0.029, most of it before the jump); without weight decay it moves further (0.105) and never generalizes.
- Tries. −log pass@k on six exact characters falls with slopes 0.26 … 0.32, and the measured tail of per-problem success rates gives 0.28 … 0.34; the smallest model needs about 16 tries to match the largest one's single try.
- Extrapolation. Chinchilla's formula fitted on the 28 runs below 3 × 10¹² operations predicts the other 21 (up to 14 times costlier) to within 0.046 bits on average, 0.10 at worst, always on the high side.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- NTK and lazy training: why it learns no features.
- μP derived from Θ(1) updates; coordinate checks; width transfer, computed; depth transfer (CompleteP).
- Scaling laws; our own CPU sweep, fit.
- Chinchilla's L(N, D); compute-optimal by Lagrange with C ≈ 6ND.
- Over-training for inference.
- Data-constrained scaling and repetition.
- MoE and precision scaling laws.
- Why power laws (data-manifold and quanta models).
- Emergence vs metric artifacts.
- Grokking and its Fourier circuit.
Visuals: iso-FLOP valleys in 3D; the Fourier spectrum of a grokked embedding lighting up.
中文讲义
本讲的中文部分(与英文版对应)。
习题与解答
1. 切线核被冻结。 对 f(x) = (1/√n) Σⱼ aⱼ φ(wⱼ x),权重相互独立、服从 𝒩(0, 1),把切线核 Θ(x, x′) 写成 n 个单元上的平均, 并证明它的涨落是 O(1/√n)。一步梯度下降让每个 aⱼ 移动多少?
解答
对 aⱼ 的梯度是 φ(wⱼx)/√n,对 wⱼ 的梯度是 aⱼ φ′(wⱼx) x/√n,所以 Θ(x, x′) = (1/n) Σⱼ [φ(wⱼx) φ(wⱼx′) + aⱼ² φ′(wⱼx) φ′(wⱼx′) x x′]:n 个独立同分布项的平均。由大数定律,它趋于自己的期望, 一个固定的核;由中心极限定理,它在这个期望附近的涨落是 O(1/√n)。在平方误差上走一步梯度下降,aⱼ 变化 −η (1/m) Σᵢ rᵢ φ(wⱼxᵢ)/√n = O(1/√n):每个权重移动 O(1/√n),长度为 O(√n) 的 n 维权重向量的相对变化也是 O(1/√n)。
2. μP的学习率。 一个隐藏层 h = Wx 有 n 个大小为 Θ(1) 的输入。证明更新 ΔW = −η g xᵀ 让 hᵢ 变化 η gᵢ ‖x‖² = Θ(ηn), 而方差为 σ² 的随机 W 给出 |hᵢ| = Θ(σ√n)。由此推出 μP 的 η ∝ 1/n。
解答
(ΔW x)ᵢ = −η gᵢ Σⱼ xⱼ xⱼ = −η gᵢ ‖x‖²,而 ‖x‖² 是 n 个大小为 Θ(1) 的正项之和,所以是 Θ(n):变化量是 Θ(ηn)。 对随机的 W,hᵢ = Σⱼ Wᵢⱼ xⱼ 是 n 个独立、均值为0、方差为 σ²xⱼ² 的项之和,标准差为 σ‖x‖ = Θ(σ√n)。要让 h 保持 Θ(1),需要 σ ∝ 1/√n;要让它的变化保持 Θ(1),需要 η ∝ 1/n。用Adam时,每个元素的步长大约就是 η,与梯度大小无关,所以 ΔW x 仍是 n 个 同向项之和,隐藏层的学习率同样要按 1/n 缩小。
3. Chinchilla的分配。 由 L = E + AN^(−α) + BD^(−β) 和 C = 6ND,推导 N_opt 和 D_opt。分别用Chinchilla发表的拟合和 Besiroglu等人的重新拟合,计算 C = 5.76 × 10²³ 时每个参数的词元数。
解答
代入 D = C/6N,令 dL/dN = 0,得 αA N^(−α) = βB D^(−β)。记 G = (αA/βB)^(1/(α+β)),就有 N_opt = G (C/6)^(β/(α+β)),D_opt = G⁻¹ (C/6)^(α/(α+β))。发表的拟合(E = 1.69,A = 406.4,B = 410.7,α = 0.3392, β = 0.2849):N_opt ≈ 4.0 × 10¹⁰,D_opt ≈ 2.4 × 10¹²,每个参数约59个词元,与Chinchilla自己的700亿参数、1.4万亿词元相去甚远。 重新拟合(A = 482.0,B = 2085.4,α = 0.3478,β = 0.3658):N_opt ≈ 7.2 × 10¹⁰,D_opt ≈ 1.3 × 10¹²,每个参数约18个词元, 接近方法一和方法二的20,也接近Chinchilla本身。
4. 为推理而训练。 在 L(N, D) = L* 的约束下最小化 6ND + 2NT。证明最优的 N 随推理词元数 T 增大而减小,并求 T → ∞ 时的极限。
解答
引入乘子 μ:6D + 2T = μαA N^(−α−1),6N = μβB D^(−β−1)。消去 μ,得 αA N^(−α) / (βB D^(−β)) = 1 + T/(3D)。 T = 0 时两个边际收益相等(Chinchilla);T 增大时,参数项的边际收益必须超过数据项的,在 L = L* 这条等值线上,这意味着更小的 N、更大的 D。T → ∞ 时成本由 2NT 主导,N 被压到还能达到 L* 的最小值:N_min = (A/(L* − E))^(1/α),同时 D → ∞。
5. 重复的数据。 证明 D′ = U + U R*(1 − e^(−R/R*)) 在 R ≪ R* 时满足 D′ ≈ U(1 + R),在 R → ∞ 时 D′ → U(1 + R*)。
解答
R ≪ R* 时,1 − e^(−R/R*) ≈ R/R*,所以 D′ ≈ U + U R* · R/R* = U(1 + R):读了多少就值多少,每次重复都和新数据一样好。 R → ∞ 时,e^(−R/R*) → 0,D′ → U + U R* = U(1 + R*):无论重复多少遍,都抵不上 1 + R* 遍新数据。
6. 多次尝试的幂律。 若一次尝试成功的概率为 p,且 p 在0附近的密度为 c p^(b−1),证明 1 − pass@k ∼ c Γ(b) k^(−b)。 p 在 [0, 1] 上均匀分布时,b 是多少?
解答
1 − pass@k = ∫₀¹ (1 − p)^k f(p) dp。k 很大时,(1 − p)^k ≈ e^(−kp),只有 p ≲ 1/k 时才不可忽略,而那里 f(p) ≈ c p^(b−1);所以 1 − pass@k ≈ c ∫₀^∞ e^(−kp) p^(b−1) dp = c Γ(b) k^(−b)(令 u = kp)。每道题的失败率按指数下降, 幂律来自 p 极小的那些题。p 均匀分布时 f = 1,所以 b = 1,c = 1:确实 ∫₀¹ (1 − p)^k dp = 1/(k + 1) ≈ k⁻¹。
Build the film
python -m videos.ai.ai12.compute # the part's numbers, into .cache/ai12
python tools/build.py ai12 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py ai12 Hook # one chapter, silent, with a contact sheet
Scenes: videos/ai/ai12. Setup: see the course page. Source of these notes: the README and the scenes' narration.