How Well Does Pretraining Loss Transfer Downstream?
Part II of Cartesia's "From Tokens to Bytes" compares model families on two kinds of laws: compute-to-loss (validation bits per byte against compute) and loss-to-loss (OLMES bits per byte against validation bits per byte). The loss-to-loss curve of a family is not fitted on scattered points: it is implied by the family's two fitted compute-optimal frontiers. Implement that curve and the post's three-step loss-to-loss compute multiplier.
A law is a tuple (A, alpha) meaning L(C)=AC−α. A family is a dict {"val": law, "eval": law}: its compute-to-validation law and its compute-to-evaluation law. Raise ValueError whenever a loss passed in is not positive.
compute_to_reach(law, loss)
- Invert a law: return C=(A/L)1/α.
compute_multiplier(base_law, new_law, loss)
- Return Cbase(L)/Cnew(L): how many times more compute the base family needs than the new one to reach
loss.
implied_eval_loss(family, val_loss)
- Eliminate C between the two laws: return the evaluation loss the family reaches when its validation loss is x,
y=Ae(Avx)αe/αv
loss_to_loss_multiplier(family, reference, val_loss)
- Step 1: take the point (x,y) on the family's loss-to-loss curve, with x =
val_loss.
- Step 2: at the same x, read y′ from the reference family's curve.
- Step 3: return how much more compute the family needs to drive its evaluation loss from y to y′ along its own compute-to-evaluation law, Cfamilye(y′)/Cfamilye(y).
- Return the tuple
(y, y_ref, multiplier). When the reference transfers better (y′<y) the multiplier is above 1; when it transfers worse, below 1.
Hints
- Check your curve: for any compute C, feeding the family's validation loss at C into the curve must give its evaluation loss at the same C.
- Step 3 uses only the family's own evaluation law, not the reference's.
- Another check: the multiplier equals the evaluation compute multiplier at y′ divided by the validation compute multiplier at x (both the reference's advantage over the family).