Skip to content

A throughput claim gets its same-container pair from two refs, alternating - #115

Merged
feitreim merged 1 commit into
mainfrom
compare-train-harness
Aug 6, 2026
Merged

feitreim merged 1 commit into
mainfrom
compare-train-harness

Conversation

@feitreim

@feitreim feitreim commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Why

compare_profile gives a fusion claim the same-container pair SPEC §11 asks for, but
only for bin/profile. A throughput claim is quoted from bin/train.rs, and every
measurement PR this month has hand-rolled that pairing by hand (#112 wrote one and
reverted it as out of scope). This is that utility, once.

What it is

compare_train(ref, baseline_ref="main", steps=12, rounds=2, shard=None), reachable as

modal run modal_app.py::train_ab --ref <pushed-branch> [--baseline-ref main] [--steps 12] [--rounds 2]

Two differences from compare_profile, both of which the trainer needs and the profile
pair does not:

  • Both arms are refs. compare_profile pairs a cloned baseline against the mounted
    working tree. Here both arms are git worktree --detach checkouts of one clone, so
    what is measured is exactly two committed refs and nothing uncommitted leaks into
    either side. The candidate must therefore be pushed. (--detach is also what lets
    main be both arms, which is how the harness is validated below.)
  • The arms alternate. Each arm is built once — that build's run is its warmup, and
    train.rs discards its own first step besides — then the arms alternate round by round.
    A drift in clocks across the container's life then lands on both arms and shows up as
    each arm's spread rather than as a difference between them.

B is a compile-time constant of train.rs and is left as whatever each ref says it is;
the harness does not rewrite it. Per-run tokens/s and MFU are parsed from train.rs's own
throughput= line, and each arm reports mean, spread, and the runs behind them.

Validation: main vs main

One B200 container, --steps 6 --rounds 2 (5 measured steps a run), both arms main.
The correct answer is two indistinguishable arms:

=== round 0 baseline main ===
throughput=87706.8 tokens/s mfu=38.95% measured_steps=5 elapsed=1.868s
=== round 0 candidate main ===
throughput=87026.6 tokens/s mfu=38.64% measured_steps=5 elapsed=1.883s
=== round 1 baseline main ===
throughput=86187.8 tokens/s mfu=38.27% measured_steps=5 elapsed=1.901s
=== round 1 candidate main ===
throughput=87537.6 tokens/s mfu=38.87% measured_steps=5 elapsed=1.872s
=== summary ===
baseline main: mean=86947.3 tokens/s spread=1.75% mfu=38.61% runs=[87706.8 86187.8]
candidate main: mean=87282.1 tokens/s spread=0.59% mfu=38.75% runs=[87026.6 87537.6]
candidate/baseline=1.0039

Two indistinguishable arms, as they must be: the arms differ by 0.39% while one arm's
own two runs differ by 1.75%, so the between-arm difference is a quarter of the
noise the harness itself reports. That 1.75% is the useful number here — it is what five
measured steps costs in resolution, and a claim under ~2% wants more --steps (the
default 12 measures 11) or more --rounds, which is exactly what the spread column is
for. All four runs sat within 0.7% of the 38.6-39.0% MFU band.

Cost: one B200 container, six trainer processes (two builds/warmups + four timed runs),
about 25 minutes wall.

Note for whoever merges this

origin/rmsnorm-fusions (#113) carries its own compare_train in modal_app.py, added
independently for that PR's own A/B; a third copy exists on an unpushed local branch.
Whichever of the two lands second should drop its copy rather than resolve the conflict —
the two do the same job, this one from two refs with alternating rounds and summary
statistics, that one from one ref against the mounted tree with a --batch rewrite. The
diff here is additive-only (one function, one entrypoint, one README paragraph) and
touches nothing existing.

…e refs

`compare_profile` gives a fusion claim the same-container pair SPEC 11 asks
for, but only for `bin/profile`. Throughput is quoted from `bin/train.rs`, and
every measurement this month has hand-rolled that pairing.

`compare_train` is the trainer's shape of it, with two differences the profile
pair does not need. Both arms are worktrees of one clone, so neither side is
the mounted tree and both are exactly what was committed; and the arms
alternate round by round rather than running once each, which turns a drift in
clocks into a spread each arm reports beside its mean instead of a difference
between them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant