Study the paper
Scaling Laws for Neural Language Models
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Critical Batch Size and Training Dynamics
Critical batch size power law
Critical batch size power law
Source equation
The critical batch size determines the optimal batch size for training language models. It represents the point of diminishing returns where increasing the batch size further yields minimal parallelization speedup per unit of compute. This relationship is modeled as a power law of the cross-entropy loss .
Sources
S1.E4
Bcrit(L)=B∗L1/αB,B∗∼2⋅108 tokens,αB∼0.21formulae-sequencesubscript𝐵crit𝐿subscript𝐵∗superscript𝐿1subscript𝛼𝐵formulae-sequencesimilar-tosubscript𝐵∗⋅2superscript108 tokenssimilar-tosubscript𝛼𝐵0.21B_{\rm crit}\left(L\right)=\frac{B_{\ast}}{L^{1/\alpha_{B}}},\qquad B_{\ast}\sim 2\cdot 10^{8}\text{ tokens},\ \ \alpha_{B}\sim 0.21 (1.4)
B_{\rm crit}\left(L\right)=\frac{B_{\ast}}{L^{1/\alpha_{B}}},\qquad B_{\ast}\sim 2\cdot 10^{8}\text{ tokens},\ \ \alpha_{B}\sim 0.21Sources
S1.E4
Bcrit(L)=B∗L1/αB,B∗∼2⋅108 tokens,αB∼0.21formulae-sequencesubscript𝐵crit𝐿subscript𝐵∗superscript𝐿1subscript𝛼𝐵formulae-sequencesimilar-tosubscript𝐵∗⋅2superscript108 tokenssimilar-tosubscript𝛼𝐵0.21B_{\rm crit}\left(L\right)=\frac{B_{\ast}}{L^{1/\alpha_{B}}},\qquad B_{\ast}\sim 2\cdot 10^{8}\text{ tokens},\ \ \alpha_{B}\sim 0.21 (1.4)
B_{\rm crit}\left(L\right)=\frac{B_{\ast}}{L^{1/\alpha_{B}}},\qquad B_{\ast}\sim 2\cdot 10^{8}\text{ tokens},\ \ \alpha_{B}\sim 0.21Illustrative Calculation
Let us calculate the critical batch size for a target cross-entropy loss of .
Using the empirical parameters:
- tokens
-
Calculate the exponent:
-
Compute the loss term:
-
Calculate :
This demonstrates that as the loss decreases (i.e., the model becomes more trained and accurate), the critical batch size increases significantly.
Sources
S1.E4
Bcrit(L)=B∗L1/αB,B∗∼2⋅108 tokens,αB∼0.21formulae-sequencesubscript𝐵crit𝐿subscript𝐵∗superscript𝐿1subscript𝛼𝐵formulae-sequencesimilar-tosubscript𝐵∗⋅2superscript108 tokenssimilar-tosubscript𝛼𝐵0.21B_{\rm crit}\left(L\right)=\frac{B_{\ast}}{L^{1/\alpha_{B}}},\qquad B_{\ast}\sim 2\cdot 10^{8}\text{ tokens},\ \ \alpha_{B}\sim 0.21 (1.4)
B_{\rm crit}\left(L\right)=\frac{B_{\ast}}{L^{1/\alpha_{B}}},\qquad B_{\ast}\sim 2\cdot 10^{8}\text{ tokens},\ \ \alpha_{B}\sim 0.21- Critical batch size measured in tokens · scalar
- Cross-entropy loss · scalar
- Scale parameter for the critical batch size · scalar
- Power-law scaling exponent for the critical batch size · scalar