The paper models the early-stopped test loss of a model with non-embedding parameters trained on tokens as and measures overfitting as . Its fit gives , , , . Implement the law and the data requirement it implies.
Implement three functions (the constants are keyword arguments with the paper's fitted values as defaults: alpha_N=0.076, alpha_D=0.103, N_c=6.4e13, D_c=1.8e13).
overfit_loss(N, D, ...) returns a dict:
"L": rounded to 4 decimals;"L_N": the infinite-data loss , rounded to 4 decimals;"L_D": the infinite-model loss , rounded to 4 decimals;"delta": computed from the unrounded losses, rounded to 6 decimals. may be math.inf (then ).
data_needed(N, tol, ...): the smallest with tol (solve the equation exactly), as a float rounded to 4 significant figures (float(f"{x:.4g}")).
data_growth(m, alpha_N=0.076, alpha_D=0.103): the factor by which must grow to keep unchanged when grows by a factor , rounded to 4 decimals.
tol > 0, .