How Much Compute Does the Better Model Save?
Part I of Cartesia's "From Tokens to Bytes" fits compute-to-loss power laws to a BPE Transformer ladder and to a matched H-Net ladder, then reports how much less compute the H-Net needs to reach the same loss. The posts do not state a formula, so this problem uses ours: on the compute-optimal frontier,
L∗(C)=AC−α
fitted as a straight line in log-log space. A sweep is a list of runs (compute, loss). Runs at the same iso-FLOP budget (different model sizes, same FLOPs) share exactly the same compute value.
frontier(runs)
- For each distinct budget keep the lowest loss. Return a list of
(compute, loss) tuples of floats, sorted by compute.
fit_power_law(points)
- Fit logL=logA−αlogC by ordinary least squares over the
(compute, loss) points. Return (A, alpha) as floats.
- Raise
ValueError if the points have fewer than 2 distinct compute values.
compute_to_reach(law, loss)
- Invert a law
(A, alpha): return the compute C=(A/L)1/α at which the frontier reaches loss.
compute_multiplier(base_law, new_law, loss)
- The compute multiplier of the new family over the baseline at a loss: m(L)=Cbase(L)/Cnew(L). Above 1 means the new family needs less compute.
shared_exponent_multiplier(base_points, new_points)
- Fit both frontiers jointly with one shared α and a separate A for each family, by least squares in log space over all points of both families. Return
(alpha, m) with m=(Abase/Anew)1/α, which is then the same at every loss.
Hints
- Any log base gives the same A and α, as long as you undo the log in the same base.
- With a shared slope and separate intercepts, the least-squares slope uses each family's data centred on that family's own means.
- Large values of C are safer in logs: logC=(logA−logL)/α.