{"notes":[{"id":"transformers/chinchilla","category":"transformers","legacyPath":"transformers/2203-chinchilla","legacySlug":"2203-chinchilla","legacyPaths":[],"title":"Chinchilla","subtitle":"Chinchilla's Gaze","author":"Z. Yuan","paperDate":"2022-03-29","publishedOn":"2024-12-13","paperTitle":"Training Compute-Optimal Large Language Models","paperUrl":"https://arxiv.org/abs/2203.15556","bibliography":{"title":"Training Compute-Optimal Large Language Models","authors":["Jordan Hoffmann","Sebastian Borgeaud","Arthur Mensch","Elena Buchatskaya","Trevor Cai","Eliza Rutherford","Diego de Las Casas","Lisa Anne Hendricks","Johannes Welbl","Aidan Clark","Tom Hennigan","Eric Noland","Katie Millican","George van den Driessche","Bogdan Damoc","Aurelia Guy","Simon Osindero","Karen Simonyan","Erich Elsen","Jack W. Rae","Oriol Vinyals","Laurent Sifre"],"url":"https://arxiv.org/abs/2203.15556","pdfUrl":"https://arxiv.org/pdf/2203.15556","codeUrl":null,"preprint":{"id":"2203.15556","submittedOn":"2022-03-29","url":"https://arxiv.org/abs/2203.15556"},"publication":{"venue":"NeurIPS","year":2022,"kind":"conference","url":"https://doi.org/10.52202/068431-2176"},"citation":"@misc{transformerschinchilla2022,\n  title = {{Training Compute-Optimal Large Language Models}},\n  author = {Jordan Hoffmann and Sebastian Borgeaud and Arthur Mensch and Elena Buchatskaya and Trevor Cai and Eliza Rutherford and Diego de Las Casas and Lisa Anne Hendricks and Johannes Welbl and Aidan Clark and Tom Hennigan and Eric Noland and Katie Millican and George van den Driessche and Bogdan Damoc and Aurelia Guy and Simon Osindero and Karen Simonyan and Erich Elsen and Jack W. Rae and Oriol Vinyals and Laurent Sifre},\n  year = {2022},\n  eprint = {2203.15556},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2203.15556}\n}\n","citationPath":"/content/papers/citations/transformers/chinchilla.431d422c0970.bib"},"thumbnail":{"src":"/content/papers/assets/834457a467c9947344ae6910ab4baffd6be26ccd2be38c97bfd8a6c5d9f4bd5d.jpg","width":1660,"height":456},"locale":"en","path":"/content/papers/en/transformers/chinchilla.8eb9e6a0f75c.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"approach-1-fixed-model-size-n","text":"Approach 1: Fixed Model Size (N)","depth":3},{"id":"approach-2-fixed-compute-budget-c","text":"Approach 2: Fixed Compute Budget (C)","depth":3},{"id":"approach-3-unified-parametric-model","text":"Approach 3: Unified Parametric Model","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"chinchillas-performance","text":"Chinchilla's Performance","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"approach-2-fixed-training-data-size-d":"approach-2-fixed-compute-budget-c"},"guide":null,"tags":["transformers","scaling","google-deepmind"],"relatedReading":[{"id":"transformers/scaling_laws","relation":"background","topic":"Trading model size against training data"}]},{"id":"transformers/scaling_laws","category":"transformers","legacyPath":"transformers/2001-scaling_laws","legacySlug":"2001-scaling_laws","legacyPaths":[],"title":"Scaling Laws","subtitle":"Scaling Laws for Neural Language Models","author":"Z. Yuan","paperDate":"2020-01-23","publishedOn":"2024-05-24","paperTitle":"Scaling Laws for Neural Language Models","paperUrl":"https://arxiv.org/abs/2001.08361","bibliography":{"title":"Scaling Laws for Neural Language Models","authors":["Jared Kaplan","Sam McCandlish","Tom Henighan","Tom B. Brown","Benjamin Chess","Rewon Child","Scott Gray","Alec Radford","Jeffrey Wu","Dario Amodei"],"url":"https://arxiv.org/abs/2001.08361","pdfUrl":"https://arxiv.org/pdf/2001.08361","codeUrl":null,"preprint":{"id":"2001.08361","submittedOn":"2020-01-23","url":"https://arxiv.org/abs/2001.08361"},"publication":null,"citation":"@misc{transformersscalinglaws2020,\n  title = {{Scaling Laws for Neural Language Models}},\n  author = {Jared Kaplan and Sam McCandlish and Tom Henighan and Tom B. Brown and Benjamin Chess and Rewon Child and Scott Gray and Alec Radford and Jeffrey Wu and Dario Amodei},\n  year = {2020},\n  eprint = {2001.08361},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2001.08361}\n}\n","citationPath":"/content/papers/citations/transformers/scaling_laws.a1ab0069ac66.bib"},"thumbnail":{"src":"/content/papers/assets/1a680a937f0c09dd160f2661fc04c4598f9bec153e122a7b92c264ef213558c1.jpg","width":1696,"height":544},"locale":"en","path":"/content/papers/en/transformers/scaling_laws.f5c1f7d57894.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"training-process","text":"Training Process","depth":3},{"id":"dataset","text":"Dataset","depth":3},{"id":"variation-factors","text":"Variation Factors","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"size-matters-most","text":"Size Matters Most","depth":3},{"id":"power-laws","text":"Power Laws","depth":3},{"id":"the-universality-of-overfitting","text":"The Universality of Overfitting","depth":3},{"id":"test-performance-vs-downstream-performance","text":"Test Performance vs. Downstream Performance","depth":3},{"id":"sample-efficiency","text":"Sample Efficiency","depth":3},{"id":"convergence-is-inefficient","text":"Convergence is Inefficient","depth":3},{"id":"optimal-batch-size","text":"Optimal Batch Size","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["transformers","scaling","openai"],"relatedReading":[{"id":"transformers/gpt_3","relation":"background","topic":"Trading model size against training data"},{"id":"transformers/chinchilla","relation":"next","topic":"Trading model size against training data"}]}],"text":"We have run out of jokes about the authors’ unusual model names.\n\nThis paper is an advanced version of Scaling Laws. The authors challenge some previous viewpoints and propose a new training strategy.\n\n\n> [!TIP]\n> \n> If you’re not familiar with Scaling Laws yet, you can refer to our previous article:\n> \n> - [**[20.01] Scaling Laws: The Scaling Laws of Models**](/blog/papers/transformers/scaling_laws)\n\n\n## Defining the Problem\n\nAt the paper’s publication in 2022, language models were rapidly growing in parameter count. Both dense Transformers and MoE models followed this trend, although total and active parameter counts are not directly interchangeable.\n\nThis expansion brings a series of problems, such as soaring training and inference costs, as well as the need for larger and higher-quality datasets to feed these models. Without such datasets, no matter how large the model, it won't produce satisfactory results.\n\nThe problem the authors of this paper aim to solve is:\n\n- **Given a fixed computation (FLOPs) budget, how should we choose the optimal combination of \"model size\" and \"dataset size\" to minimize the final pre-training loss of the language model?**\n\nKaplan et al.’s Scaling Laws already studied compute allocation. Chinchilla questions the use of intermediate losses from a fixed training horizon and learning-rate schedule: a shorter run can look worse if its decay schedule is not shortened accordingly.\n\n- **The Scaling Laws analysis tends to suggest \"make the model bigger, but don’t increase the dataset size that much\".**\n\nMatching the learning-rate schedule to each training horizon leads the authors to recommend scaling model size and training-token count in approximately equal proportions.\n\nA more formal description is that the authors define the optimal solution as follows:\n\n$$\nN_{\\text{opt}}(C), D_{\\text{opt}}(C) \\;=\\; \\arg\\min_{N,D \\;\\;s.t.\\;\\; \\text{FLOPs}(N,D)=C}\\, L(N,D),\n$$\n\nWhere:\n\n- $N$ is the number of model parameters,\n- $D$ is the number of training tokens (representing the amount of training data),\n- $C$ is the fixed computation budget (i.e., how many FLOPs you can spend to train with the given compute power and time),\n- $L(N, D)$ is the pre-training loss of the model after training with $N$ parameters and $D$ training tokens.\n\nThe goal of this paper is to optimize the combination of \"model size (N)\" and \"training token count (D)\" within a fixed computation budget (C).\n\n## Solving the Problem\n\nTo reduce the difficulty of reading the following article, please remember the corresponding terms:\n\n- $C$: Fixed computation (FLOPs) budget,\n- $N$: Model size (number of parameters),\n- $D$: Training data size (number of training tokens),\n\nThe authors propose three different methods to estimate the \"optimal scaling relationship of $N$ and $D$ with respect to $C$.\"\n\n### Approach 1: Fixed Model Size ($N$)\n\nIn this approach, the authors first \"fix a set of model sizes,\" and for each model size, they try different training data amounts.\n\nModel sizes range from around 70M parameters to over 10B parameters, with four independent training runs for each size. The training data amounts vary by up to 16 times. During training, the learning rate decays according to a schedule, and for each setting, smoothing and interpolation are applied to obtain continuous loss curves.\n\nWith this experimental design, they can intuitively answer: \"Given a specified FLOPs budget $C$, which combination of $(N, D)$ achieves the minimum loss $L(N,D)$?\"\n\nFrom a mathematical perspective, the authors aim to solve the following optimization problem:\n\n$$\nN_{\\text{opt}}(C), D_{\\text{opt}}(C) = \\arg\\min_{N, D \\; s.t. \\; \\text{FLOPs}(N,D)=C} L(N,D).\n$$\n\nIn this process, they chose 1500 different $C$ values distributed on a logarithmic scale (i.e., different FLOPs budgets) and observed the corresponding $N_{\\text{opt}}(C)$ and $D_{\\text{opt}}(C)$.\n\nThrough fitting, they found that the optimal parameter configuration approximately follows:\n\n$$\na = 0.50, \\quad b = 0.50\n$$\n\nThis means that when available compute power $C$ increases, the best strategy is to increase both model parameters $N$ and training tokens $D$ at about the same rate of $C^{0.5}$. This result is a significant departure from previous literature, which mostly suggested that the model size should increase faster than the training data size.\n\nThe experimental results are shown in the figure below:\n\n![Chinchilla - Approach 1](/content/papers/assets/834457a467c9947344ae6910ab4baffd6be26ccd2be38c97bfd8a6c5d9f4bd5d.jpg)\n\nOn the left of the figure, each curve corresponds to different model sizes $N$ and training data amounts. The x-axis roughly represents the FLOPs used during training, and the y-axis shows the loss $L$ of the model during training.\n\nThe authors first plot all these training curves, then take the envelope, i.e., the minimum possible loss $L_{\\min}(C)$ achieved in each experiment at any given FLOPs budget $C$.\n\nWith the envelope, we can see: given a fixed computation budget, is there a better $(N, D)$ combination that can achieve a lower loss? If so, that would mean we can adjust the ratio of model size and training tokens to get better results.\n\nNext, the middle graph shows the inferred \"optimal model parameter count $N_{\\text{opt}}(C)$\" based on the envelope at different FLOPs $C$. In simple terms, this tells us the optimal model size for a specific FLOPs budget.\n\nThe right graph shows how the \"optimal number of training tokens $D_{\\text{opt}}(C)$\" changes with FLOPs. After extracting these points, the authors fit them with a power-law relationship to find scaling relationships like $N_{\\text{opt}}(C) \\propto C^a$ and $D_{\\text{opt}}(C) \\propto C^b$.\n\nThe green dotted line in the figure represents the FLOPs used by the Gopher model (around $5.76 \\times 10^{23}$) for comparison.\n\nBased on these envelope lines and the inferred power-law relationships, it is evident that the optimal $N_{\\text{opt}}$ and $D_{\\text{opt}}$ differ significantly from Gopher's original design. This means that by adjusting the configuration according to the analysis in this paper, one could achieve a lower loss with the same compute budget.\n\n### Approach 2: Fixed Compute Budget ($C$)\n\nIn this method, the authors first fix a set of FLOPs budgets, and for each fixed $C$, they adjust model size $N$ and training token count $D$ to ensure that the total FLOPs spent during training exactly equals the specified $C$ value.\n\nIn simple terms, they \"fix the FLOPs consumption,\" and along this \"constant FLOPs line,\" they examine how different model sizes affect the final loss $L$.\n\nTheoretically, this graph usually forms a \"U-shaped curve\" (or something like the bottom of a parabola), indicating that there is an optimal model size $N_{\\text{opt}}(C)$ that minimizes the loss under fixed compute. They fit this curve with a parabolic function to find the position of the minimum.\n\nThrough this fitting, the authors obtain a set of data points that can be fitted with a power law:\n\n$$\nN_{\\text{opt}} \\propto C^a \\quad \\text{and} \\quad D_{\\text{opt}} \\propto C^b.\n$$\n\nThe experimental results are shown in the figure below:\n\n![Chinchilla - Approach 2](/content/papers/assets/2d1aebef805158305c969e8ed052b13375365648e7e3c67da2060b57917e5e45.jpg)\n\nThey calculate $a \\approx 0.49$ and $b \\approx 0.51$.\n\nSimilarly, this suggests that as the compute budget $C$ increases, the best strategy is to let model size $N$ and training token count $D$ grow together at roughly $\\sqrt{C}$ (because 0.5 power means taking the square root).\n\nFinally, they apply this result to estimate the FLOPs budget used in Gopher training (green markers in the figure).\n\nThe conclusion is similar to the previous method: current large models may be too big, with too few training tokens. Based on these results, if we reduce the model size and increase the training token count under the same compute budget, we could theoretically achieve a better final loss.\n\n### Approach 3: Unified Parametric Model\n\nSince we have a wealth of experimental data $(N, D, L)$ from \"Approach 1\" and \"Approach 2,\" why not directly use an appropriate mathematical model to fit all the final loss data simultaneously and then see what the optimal scaling rule derived from this is?\n\nAssume a parametric functional form as follows:\n\n$$\n\\hat{L}(N,D) = E + \\frac{A}{N^\\alpha} + \\frac{B}{D^\\beta}.\n$$\n\nIn this model:\n\n- $E$ is the fitted irreducible-loss term, motivated by the entropy of the data distribution; its fitted value is not an exact measurement of natural-language entropy.\n- $\\frac{A}{N^\\alpha}$ represents a bias that still exists in a finite model size, even when training the model to its maximum capacity. As $N$ increases, the model approaches the ideal generation process, but the gap is never completely eliminated.\n- $\\frac{B}{D^\\beta}$ represents the \"under-training\" error due to insufficient training tokens and insufficient training steps. As $D$ increases, this error decreases.\n\nThe authors then use the L-BFGS optimizer to minimize the Huber loss, ensuring that $\\hat{L}(N,D)$ closely matches the actual observed experimental loss $L$ on the logarithmic scale ($\\log L$).\n\nThe objective function here is:\n\n$$\n\\min_{A,B,E,\\alpha,\\beta} \\sum_{i} \\text{Huber}_\\delta\\bigl(\\log \\hat{L}(N_i,D_i) - \\log L_i\\bigr),\n$$\n\nOnce the parametric model is obtained, the authors can solve the optimization problem under the fixed FLOPs budget $C$ to obtain $N_{\\text{opt}}(C)$ and $D_{\\text{opt}}(C)$.\n\nFor the dense Transformers studied here, training compute is approximated by $\\text{FLOPs}(N,D) \\approx 6ND$. Substituting this constraint gives:\n\n$$\nN_{\\text{opt}}(C) \\propto C^a, \\quad D_{\\text{opt}}(C) \\propto C^b,\n$$\n\nWhere:\n\n$$\na = \\frac{\\beta}{\\alpha+\\beta}, \\quad b = \\frac{\\alpha}{\\alpha+\\beta}.\n$$\n\nThe estimates are approximately $a = 0.46$ and $b = 0.54$: near-equal scaling, rather than exactly equal exponents.\n\nFinally, they use this parametric model to plot various iso-loss contours and iso-FLOP slices, and use the blue \"efficient frontier\" to show where the minimum loss can be achieved with the same compute budget, as shown in the figure below:\n\n![Chinchilla - Approach 3](/content/papers/assets/e823614d0255b21a98d94cfe918a29781a8399c8c63b74329763d6a4dca1d3d5.jpg)\n\nWhen applied to the FLOPs budget used by Gopher, they predict the optimal model size should be about 40B parameters, much smaller than the original 280B in Gopher, while requiring more training tokens.\n\n## Discussion\n\nDespite the different implementation details and analytical approaches in the first three methods, the recommendations they provide are very similar:\n\n- **As computation resources (FLOPs) increase, the best approach is to expand both model parameters $N$ and training data (token count) $D$ in almost \"equal proportion.\"**\n\nIn other words, if your compute power $C$ increases, the optimal strategy is $N_{\\text{opt}}(C) \\propto C^a$ and $D_{\\text{opt}}(C) \\propto C^b$, with both $a$ and $b$ close to 0.5.\n\n\n\n![scaling laws comparison](/content/papers/assets/08a297910292c835cfaec1e02662d0bd5cd2873872ea291da1e2579aab09b47e.jpg)\n\n\n\nIn contrast, Scaling Laws' conclusions (as shown in the table above) suggest that $N$ should grow faster ($a \\approx 0.73$) and $D$ should grow more slowly ($b \\approx 0.27$). The analysis in this paper indicates that previous viewpoints may have underestimated the benefits of increasing the training token count, meaning the \"importance of data\" has been overlooked.\n\nThe authors then list the required FLOPs and corresponding training tokens for different model sizes, when situated on the \"compute-optimal frontier,\" in the following table:\n\n\n\n![compute-optimal frontier](/content/papers/assets/3e37e8b5184247dc58a702f6b4ee8d2835d779e711800c76e780b386e626f73e.jpg)\n\n\n\nHere, “compute-optimal” means choosing the configuration with the lowest loss for a fixed training budget. Further training gains and lifetime serving cost require separate evaluation.\n\nFor example, Table 3 projects that bringing a 175B-parameter model, about the size of GPT-3, onto this frontier would require roughly $3.85 \\times 10^{24}$ FLOPs and 3.7 trillion tokens, far more training tokens than GPT-3 used.\n\nAt Gopher’s budget of about $5.76 \\times 10^{23}$ FLOPs, Approach 1 estimates about 67B parameters and 1.5 trillion tokens. Compared with Gopher’s actual 280B parameters and 300B tokens, that is roughly one quarter as many parameters and five times as many training tokens. Approach 3 instead predicts about 40B parameters. These are different fitted estimates, not the configuration of the final trained model.\n\n\n> [!TIP]\n> \n> The authors also note that while these results have \"uncertainty when extrapolating,\" they clearly show that many large language models today are \"underfed,\" meaning their parameter sizes are not the \"compute-optimal\" choice given the available training compute and data.\n\n\n### Chinchilla's Performance\n\n\n\n![Chinchilla - Discussion](/content/papers/assets/29b31312a128fc8c77a9439443fe876ec971269bc46ccda3739d667dccefb858.jpg)\n\n\n\nThe final Chinchilla model has 70B parameters and is trained on 1.4 trillion tokens, compared with Gopher’s 280B parameters and 300B tokens, at similar training FLOPs. The figure compares language modeling on The Pile subsets; the paper also reports downstream evaluations such as MMLU.\n\nChinchilla has lower bits-per-byte (bpb) than Gopher on every plotted The Pile subset. This is negative log-likelihood normalized by byte count; lower is better, but it is not the fraction of correctly predicted text. Table A5 shows only two subsets where Chinchilla scores worse than Jurassic-1: dm_mathematics and ubuntu_irc. The authors caution that Chinchilla used more training data, so overlap between training and test data could affect these language-modeling comparisons.\n\n\n> [!NOTE]\n> \n> The paper contains a lot of experimental results, most of which lead to consistent conclusions. Interested readers are encouraged to refer to the original paper for more details.\n\n\n## Conclusion\n\nThe scaling fits use over 400 smaller training runs. At the large end, however, the direct validation consists of Chinchilla versus Gopher, without further intermediate-scale validation runs.\n\nPower-law extrapolation has limits: curvature at high compute may imply that optimal model size is still overestimated. The scaling runs use less than one epoch, so the result does not directly establish behavior under heavy data repetition. Final Chinchilla training uses weighted sampling; MassiveWeb and Wikipedia each exceed one effective epoch. Not every part of the study sees every datum only once.\n\nNevertheless, the results of Chinchilla relative to Gopher nicely confirm their theory: with the same training costs, using smaller models trained on more data indeed outperforms models that are purely scaled up in size. Researchers should place more emphasis on expanding and improving the quality of datasets rather than focusing solely on model size.\n\nFinally, the authors speculate that this \"model size vs. training data\" optimization relationship is not limited to language models, but also applies to the training of models in other domains. By estimating the optimal model size and training schedule in advance, much resource wastage can be avoided, which is a valuable insight for the future research community.\n\n\n> [!TIP]\n> \n> We graciously accept these conclusions, which were \"stacked up with money,\" with gratitude.\n","imageSizes":{"/content/papers/assets/834457a467c9947344ae6910ab4baffd6be26ccd2be38c97bfd8a6c5d9f4bd5d.jpg":{"width":1660,"height":456},"/content/papers/assets/2d1aebef805158305c969e8ed052b13375365648e7e3c67da2060b57917e5e45.jpg":{"width":1818,"height":538},"/content/papers/assets/e823614d0255b21a98d94cfe918a29781a8399c8c63b74329763d6a4dca1d3d5.jpg":{"width":1596,"height":708},"/content/papers/assets/08a297910292c835cfaec1e02662d0bd5cd2873872ea291da1e2579aab09b47e.jpg":{"width":1744,"height":394},"/content/papers/assets/3e37e8b5184247dc58a702f6b4ee8d2835d779e711800c76e780b386e626f73e.jpg":{"width":1064,"height":512},"/content/papers/assets/29b31312a128fc8c77a9439443fe876ec971269bc46ccda3739d667dccefb858.jpg":{"width":1224,"height":656}}}
