Repository navigation
One image, both toolchains: the trainer is 0.9890 of torch.compile() and the interval excludes parity - #120
Merged
Merged
Conversation
… container gets it `torch_baseline` was the only function on `torch_image` and every trainer entrypoint runs on the kernel image, so the trainer and the PyTorch baseline could never share a GPU. At B=16 that did not matter: the gap was 12.4%. At B=32 it is the whole question -- 92,718 against 93,634 is 0.99%, inside the 1.4% spread the same trainer binary shows between two containers. `ab_image` is the kernel toolchain plus torch. The three expensive layers are the toolchain's own, so it is `image`'s cache plus a pip install, and `image` itself is untouched -- kernel runs still pull no torch. `torch_versus_train` takes the trainer from a pushed ref and the baseline script from another (default the baseline branch, which stays the source of truth for what PyTorch is asked to do), imposes one batch on both by rewriting train.rs's compile-time `B`, and alternates them round by round after a discarded warmup each. Torch's compile lands in the script's warmup steps; an arm whose inductor recorded CUDA graphs is rejected, because the trainer has none and cuda-oxide cannot give it any. The summary reports a 95% interval on the difference rather than two point estimates, since the answer at this margin is decided by the interval.
…e interval excludes parity Fifteen alternating pairs at B=32 and 30 steps, three containers. The trainer is 1.1% behind torch.compile()'s default mode with a 95% interval of 0.42 points, and it is not ahead in any container: 0.9996, 0.9827, 0.9901. The 0.99% that #117's table left as a coin flip was never going to be settled by more of the same measurement. The columns say why: each arm's spread within a container is 0.13-0.43%, while the trainer's mean moves 2.72% between containers and torch's 1.01%. The old pair -- 92,718 from one container against 93,634 from another -- was two draws from a distribution wider than the effect. Neither number was wrong; the subtraction was. Both arms also read lower here than the numbers they replace, and the window is why: 93,634 came off an 11-step measurement, this off 29. A four-step window in the same harness reads 96-97k for both arms. Short windows flatter whatever they measure. The escalation rule is unchanged and now has a properly measured gate: `mode="max-autotune"` stays locked until a trainer beats torch.compile(), and what it has to beat is 91,816 tokens/s under this harness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
torch_baselinewas the only Modal function ontorch_imageand every trainerentrypoint runs on the kernel image, so the trainer and the PyTorch baseline
could never share a GPU. At B=16 that did not matter -- the gap was 12.4%. At
B=32 it was the whole question: 92,718 against 93,634 is 0.99%, inside the 1.4%
spread the same trainer binary shows between two containers.
The harness
ab_imageis the kernel toolchain plus torch.imageis untouched -- kernelruns pull no torch -- because the toolchain layers were split out and both
images build from them, so the torch image is
image's cache plus one pipinstall (82s the first time, cached after).
torch_versus_train/modal run modal_app.py::versus:--ref, baseline script from--torch-ref(defaultpytorch-throughput-baseline), both checked out in the container asworktrees of one clone, with A pushed branch names itself, and the compare's clone knows it as origin's #116's
origin/-fallback ref resolution;the baseline branch stays the source of truth for what PyTorch is asked to do
--batchimposed on both arms, on train.rs by rewriting its compile-timeB, so a matched batch is a property of the run and not of the two refscompare_train(63s cold in the container, 15s once inductor's cache is warm)
none and cuda-oxide cannot give it any
The result
main(c5a3b1a) at B=32, 30 steps (29 measured), againsttorch.compile()default mode, bf16 masters, same shard,
cuda_graphs=Falseverified everyround, peak 150.1 GiB every round.
torch.compile()tokens/sVerdict. Container 1 came back unresolved (-0.04% ± 0.62%), so the rounds
were doubled; containers 2 and 3 each resolve, both against the trainer. Over
all fifteen pairs the trainer is at 0.9890 of
torch.compile(), ±0.0042 at95% -- 1.1% behind, interval excluding parity. It is ahead in no container.
Within-arm spread landed at 0.13-0.43% per container (target was ~0.3%), while
the trainer's mean moves 2.72% between containers and torch's 1.01%. That is
the whole argument for the pairing: the effect is smaller than the noise the
pairing removes. The old comparison -- 92,718 from one container, 93,634 from
another -- was two draws from a distribution wider than the thing being
measured. Neither number was wrong; the subtraction was.
Both arms also read lower here than the numbers they replace, and the window is
why: 93,634 came off an 11-step measurement, these off 29. A 4-step window in
this same harness reads 96-97k for both arms.
max-autotune gate
Not beaten.
mode="max-autotune"stays locked. The gate was 93,634; thebetter-measured value for
torch.compile()default at B=32 is 91,816tokens/s (grand mean, 15 rounds, three containers), and
mainreaches 90,809against it. The trainer has to be ahead to unlock the next tier and it is
behind by 1.1% with the interval excluding zero -- a stronger statement than
#117's coin flip, and in the same direction.
Diff is additive:
imagekeeps its exact build, split only soab_imagecanreuse the toolchain layers; the only new runtime objects are
ab_image,torch_versus_train, and theversusentrypoint.