You are reading immutable version 1. The current guide may be newer.

Study the paper

Scaling Laws for Neural Language Models

Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.

All activities

The Infinite Data Limit and Overfitting

Unified scaling law for parameters and dataset size

Unified scaling law for parameters and dataset size

Source equation

L(N,D)=[(NcN)αNαD+DcD]αDL(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}}

The unified scaling law models the cross-entropy loss L(N,D)L(N,D) as a joint function of the number of non-embedding parameters NN and the dataset size DD (measured in tokens). This formulation captures how performance scales when both resources are finite, predicting the onset of overfitting when one resource is bottlenecked relative to the other.

Sources

S1.E5

L​(N,D)=[(NcN)αNαD+DcD]αD𝐿𝑁𝐷superscriptdelimited-[]superscriptsubscript𝑁𝑐𝑁subscript𝛼𝑁subscript𝛼𝐷subscript𝐷𝑐𝐷subscript𝛼𝐷L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}} (1.5)
L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}}

L(N,D)=[(NcN)αNαD+DcD]αDL(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}}

Sources

S1.E5

L​(N,D)=[(NcN)αNαD+DcD]αD𝐿𝑁𝐷superscriptdelimited-[]superscriptsubscript𝑁𝑐𝑁subscript𝛼𝑁subscript𝛼𝐷subscript𝐷𝑐𝐷subscript𝛼𝐷L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}} (1.5)
L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}}

Symbol Definitions

  • L(N,D)L(N,D): The cross-entropy loss, representing the model's performance.
  • NN: The number of model parameters (excluding embeddings).
  • DD: The dataset size in tokens.
  • NcN_c: The critical parameter scale constant.
  • DcD_c: The critical dataset scale constant.
  • αN\alpha_N: The power-law scaling exponent for model size NN.
  • αD\alpha_D: The power-law scaling exponent for dataset size DD.
Sources

S1.E5

L​(N,D)=[(NcN)αNαD+DcD]αD𝐿𝑁𝐷superscriptdelimited-[]superscriptsubscript𝑁𝑐𝑁subscript𝛼𝑁subscript𝛼𝐷subscript𝐷𝑐𝐷subscript𝛼𝐷L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}} (1.5)
L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}}
Implementation detail

Illustrative Calculation

Let us compute the loss L(N,D)L(N,D) for a specific set of parameters:

  • Nc=105N_c = 10^5, Dc=106D_c = 10^6
  • αN=0.08\alpha_N = 0.08, αD=0.16\alpha_D = 0.16
  • Ratio of exponents: αNαD=0.080.16=0.5\frac{\alpha_N}{\alpha_D} = \frac{0.08}{0.16} = 0.5

We evaluate at N=107N = 10^7 and D=108D = 10^8:

  1. Parameter term ratio: NcN=105107=102=0.01\frac{N_c}{N} = \frac{10^5}{10^7} = 10^{-2} = 0.01

  2. Exponentiated parameter term: (NcN)αNαD=(0.01)0.5=0.1\left(\frac{N_c}{N}\right)^{\frac{\alpha_N}{\alpha_D}} = (0.01)^{0.5} = 0.1

  3. Dataset term: DcD=106108=102=0.01\frac{D_c}{D} = \frac{10^6}{10^8} = 10^{-2} = 0.01

  4. Sum of terms: 0.1+0.01=0.110.1 + 0.01 = 0.11

  5. Final Loss: L(N,D)=(0.11)0.160.7015L(N,D) = (0.11)^{0.16} \approx 0.7015

Sources

S1.E5

L​(N,D)=[(NcN)αNαD+DcD]αD𝐿𝑁𝐷superscriptdelimited-[]superscriptsubscript𝑁𝑐𝑁subscript𝛼𝑁subscript𝛼𝐷subscript𝐷𝑐𝐷subscript𝛼𝐷L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}} (1.5)
L(N,D)=\left[\left(\frac{N_{c}}{N}\right)^{\frac{\alpha_{N}}{\alpha_{D}}}+\frac{D_{c}}{D}\right]^{\alpha_{D}}
L(N,D)L(N,D)
Cross-entropy loss · scalar
NN
Number of non-embedding model parameters · scalar
DD
Dataset size in tokens · scalar
NcN_c
Critical parameter scale constant · scalar
DcD_c
Critical dataset scale constant · scalar
alphaNalpha_N
Power-law scaling exponent for model size · scalar
alphaDalpha_D
Power-law scaling exponent for dataset size · scalar