Study the paper
Scaling Laws for Neural Language Models
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Transformer Parameter and Compute Scaling
Unified Loss Equation L(N,D)
Unified Loss Equation L(N,D)
Source equation
The unified loss equation models the joint dependence of the cross-entropy loss on both the number of non-embedding parameters and the dataset size (measured in tokens). It captures how overfitting occurs when either resource is constrained 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}}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}}Where the symbols are defined as follows:
- : The predicted cross-entropy loss.
- : The number of model parameters (excluding embeddings).
- : The dataset size in tokens.
- : The critical model size parameter.
- : The critical dataset size parameter.
- : The power-law scaling exponent for model size.
- : The power-law scaling exponent for dataset size.
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 using a set of simplified parameters:
- ,
- , (so that )
- (a model 10 times larger than )
- (a dataset equal to )
Step-by-step evaluation:
- Calculate the model term:
- Calculate the dataset term:
- Sum the terms inside the brackets:
- Apply the outer exponent :
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}}- Cross-entropy loss as a function of model size and dataset size · scalar
- Number of non-embedding model parameters · scalar
- Dataset size in tokens · scalar
- Critical model size constant · scalar
- Critical dataset size constant · scalar
- Power-law scaling exponent for model size · scalar
- Power-law scaling exponent for dataset size · scalar