Scaling laws + exam review
Overview
Mohit Iyyer reviews the 40-question, handwritten-cheat-sheet exam and then explains how scaling laws use small-model experiments to predict language-model loss and choose model size and training data under a compute budget. He derives the approximate training-cost formula 6ND, describes the Chinchilla finding of about 20 training tokens per parameter, and explains why inference costs can favor smaller models trained on more data.
Key takeaways
- The exam contains 40 equally weighted four-choice questions, allows only a handwritten two-sided 8.5-by-11-inch cheat sheet, and covers material through the scaling-laws lecture.
- A simplified transformer training estimate is 6ND FLOPs: about 2N for forward computation and 4N for backpropagation per token, across D tokens.
- Chinchilla’s compute-optimal rule of thumb is about 20 training tokens per parameter; its 70-billion-parameter model trained on 1.4 trillion tokens outperformed the larger, undertrained GPT-3.
- Scaling laws estimate loss by fitting results from many smaller models across parameter counts and data sizes, then extrapolating; accuracy depends on experiment coverage and fit quality.
- The best compute allocation for pretraining may differ from the best production allocation: high inference volume can make a smaller model trained on more data cheaper to serve.
Chapters
- Exam 1 has 40 questions, each with four options and one correct answer, and uses the full class period.
- Questions are equally weighted, so Mohit Iyyer advises moving on rather than spending ten minutes on one item.
- Students may bring a handwritten cheat sheet on both sides of one 8.5-by-11-inch sheet; typed, printed, and electronic notes are not allowed.
- Phones, laptops, and calculators are unnecessary, and students must stop when time is called.
- A local attention mask with a window of eight tests whether students can reason about how receptive fields expand across transformer layers.
- A question where training perplexity falls while test perplexity rises tests understanding of model quality and overfitting.
- A transformer without nonlinearities collapses to a single linear transformation, a concept students should apply to modified scenarios.
- Questions range in difficulty and may require extrapolating class concepts to situations not covered exactly in lecture.
- New exam topics include mixture-of-experts models: total versus active parameters, routing, and why sparse models can be preferable to dense models.
- Students should review block attention masks and loss masking, including how mask changes affect model behavior.
- This year emphasizes position encoding less: RoPE and ALiBi are not required, but the no-position-encoding approach discussed in class is relevant.
- Review KV-cache growth and the difference between prefill and decoding, along with their effects on inference speed and memory.
- The broad empirical pattern is that larger models trained on more data tend to outperform smaller ones, often achieving lower perplexity.
- Training frontier-scale models can cost billions of dollars and requires large GPU fleets and specialized engineering.
- Scaling laws aim to use cheaper, smaller-model experiments to predict how model size and data choices will perform at larger scales.
- OpenAI introduced early scaling-law work, while Google’s Chinchilla research later refined the compute-optimal allocation of parameters and data.
- A 2022 Google study plotted pretrained-model task accuracy against training FLOPs, with scale in that comparison largely tracking model size.
- Tasks such as word unscrambling, Persian question answering, and multitask language understanding showed sharp apparent gains at larger scales.
- The paper described abilities as emergent when they were absent in smaller models and became observable at larger scales.
- Researchers debate whether these jumps reflect truly sudden capabilities or evaluation metrics that hide gradual improvements.
- A later study examined downstream performance against training loss and found that lower-loss models tended to do better on trivia, math, and multiple-choice tasks.
- The plotted models ranged from about 1.5 billion to 32 billion parameters, with larger models generally reaching lower losses.
- Next-token prediction acts like multitask learning: predicting a capital requires stored facts, while unfamiliar arithmetic requires learning a procedure.
- Scaling can improve both memorization and generalization, but robust behavior on new examples depends on more than memorizing frequent answers.
- The three quantities are N, the model’s total number of parameters; D, the number of training tokens; and C, the available training-compute budget.
- For a fixed budget, the central question is how to allocate compute between model size and training data to minimize loss.
- A scaling-law workflow trains many smaller models at varied N and D, measures their losses, fits a curve, and extrapolates to larger configurations.
- Chinchilla gained support by testing its predictions at substantially larger scale and outperforming earlier parameter/data allocations.
- Scaling studies often plot compute and loss on logarithmic axes, where improvements can appear approximately linear across orders of magnitude.
- A successful fit should predict loss beyond the compute range used to train the smaller models.
- Extrapolation quality depends on the number and range of experiments; industry labs can afford to train hundreds or thousands of models.
- Replication work found errors in earlier Google scaling-law results, illustrating that empirical fits can be brittle and require validation.
- The dominant operations in neural-network compute estimates are floating-point multiplications and additions, particularly in transformer linear layers.
- For a 2-by-2 matrix multiplying a two-dimensional vector, the forward pass uses four multiplications and two additions: six FLOPs.
- A square 4096-dimensional layer has about 16.8 million weights and requires roughly 33.6 million forward-pass FLOPs per token.
- Attention can become a larger compute contributor as sequence length grows, although many scaling studies approximate cost using feed-forward and other linear layers.
- In the simplified accounting, each model weight is used once per token in the linear layers being counted.
- The forward pass costs approximately 2N FLOPs per token, where N is the number of model parameters.
- Backpropagation costs approximately 4N FLOPs per token because it computes gradients with respect to both weights and inputs.
- Training on D tokens therefore costs approximately 6ND FLOPs, providing a practical compute estimate for comparing model-and-data configurations.
- With compute fixed at C ≈ 6ND, increasing N means fewer tokens D, so model size and data volume must be balanced.
- A model can be too small to use its available data effectively, or too large to benefit from the limited data it sees.
- Early OpenAI scaling work proposed finding the lowest-loss N-and-D configuration at each compute budget, though its recommended allocation was later judged incorrect.
- The key experimental method is to compare compute-matched models, identify each budget’s best configuration, and fit a rule for larger runs.
- The Chinchilla study trained roughly 400 to 500 models spanning about 70 million to 16 billion parameters and multiple compute budgets.
- Its result recommends approximately 20 training tokens per parameter, so model size and dataset size should grow together.
- A 70-billion-parameter Chinchilla model trained on about 1.4 trillion tokens outperformed the 175-billion-parameter GPT-3 despite having fewer parameters.
- GPT-3 had received fewer than one trillion tokens, illustrating how a large model can be undertrained when its data allocation is too small.
- The fitted power law predicts loss from N and D using an irreducible baseline plus a model-size penalty and a data-size penalty.
- The constant E represents the estimated entropy floor of text; the discussed replication fit put it at about 1.82.
- The model and data penalties shrink as N and D increase; the fitted exponents are positive, while the other coefficients are empirical fit parameters.
- The equation explains why neither a tiny model nor a huge model with too little data achieves the best loss under a fixed compute budget.
- Compute-optimal training is not always the production objective: inference cost depends strongly on the model served, not on how many tokens it saw during training.
- For services with billions of users, a smaller model can reduce repeated inference FLOPs, even if training it on more data costs more upfront.
- Mixture-of-experts models can reduce active parameters per inference by routing inputs to only part of the full model.
- A company may therefore accept higher one-time training expense to serve a cheaper, smaller model at scale.
Transcript excerpt
0:08 Okay. >> Uh let's get started. So today uh first of all it's it's been a while actually. Our next class is actually the exam. So um yeah that was uh I actually forgot about the fall break. So I came here on Monday and was ready to give the scaling laws lecture. And um anyway, it's one less topic for you guys to uh study on the exam. So, uh what I'm going to do today is um first do a brief review of the format of the exam, some of the things that you can expect that uh will be on it and will not be on it and comparisons to last year's exam one. Um and then we will uh go through the last topic on pre-training that um is still
0:58 fair game for the exam which is uh scaling laws and how we can use um results of small models to predict how larger models will behave. Um okay so I will just get started then um with the exam review part. Um so the format will be identical to the uh exam from the previous year. Um if you haven't looked at that already, it's in the resources section on Piaza. There are two exams from last year. The first exam um covers a lot of the same topics that uh your exam will cover. Uh it was also focused on pre-training. So um as a review
1:46 uh this exam will have 40 multiplechoice questions. Um so for each of these questions there will be four options only one of the answers is correct. Um so uh pretty straightforward. um you'll have the full class period to do it and we are um very strict about making sure you end on time. So none of
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Mohit Iyyer.