Conversation
Snowball's layer scan bounded forward memory, but reverse mode retained routed-expert activations from every layer. A 67B update compiled to 292.59 GiB per H100 and failed before its first optimizer step. Checkpoint the scan body so reverse mode recomputes one layer at a time and activation memory no longer scales with depth.
The scan still retains each layer's input carry. State only that routed-expert intermediates are recomputed instead of claiming all activation memory is independent of depth.
Combine each token’s top-k expert outputs with fixed gathers and ordered additions. This removes collision-prone scatter-add atomics from the local fallback used when expert parallelism is one. The old path changed repeated log probabilities by up to 6.35e-4 and differed from a gradient forward by up to 3.46e-3 on a representative 8-H100 Snowball replay.
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.
This draft carries the three Levanter changes required by MarinSkyRL PR #578:
Numerical evidence
Before the deterministic combine, repeated unchanged-policy scoring was nondeterministic. After it, repeated scoring became bitwise exact. Standalone score-versus-training drift remained deterministic at maximum/mean
0.0089493/0.00014377; backend, attention, accumulation, and traced-score A/Bs did not remove it. The paired MarinSkyRL path therefore runs independent old-policy scoring through the same compiled accumulated gradient/optimizer program in no-commit mode. Its declared gate requires exact zero score drift, exact unit ratios, and zero clipping.Representative eight-H100 gate
/romain/snowball-numerical-exact-mean-01a0a1bepassed that rule over a 4,096-token, two-accumulation-step batch. The independent native PyTorch Grug oracle remained within2.384e-7for token log probabilities,4.470e-8for loss,8.941e-8for gradients, and1.192e-7for the first AdamW update.Corrected target run
Paired job
/romain/snowball-67b-exact-two-cycle-r4-01a0a1beused this PR at779cd403521e02d1615d8c49290cd8de63efdde0, MarinSkyRL34056d565ae2e7a7b79ef9c28b4604aaa8613e53, the pinned 67B-A2B model, 32 learner H100s over four hosts, and a separate eight-H100 TP1/DP8/EP8 vLLM host. All five tasks exited 0 without failures, retries, or preemptions.Both synchronous GRPO/AdamW updates passed exact zero score-difference, exact unit-ratio, and zero-clipping checks. They consumed 445,242 and 717,953 valid tokens; synchronized update bodies took 26.848 and 26.348 seconds; parameter-probe L2 deltas were
1.1653e-4and1.0050e-4. Policy versions 1 and 2 each verified 19,968 expert projection slices across all eight inference workers. A single final native checkpoint committed atglobal_step_2.Closure job
/romain/snowball-67b-final-policy-generation-01a0a1beloaded that target-size checkpoint in 142.12 seconds, republished version 2 in 449.776 seconds with all 19,968 slices verified, skipped training, and generated a correct retained RLVR-math response. This completes generation after both newly installed policies.Focused validation:
uv run --frozen pytest -q lib/levanter/tests/test_grad_accum.py -k "extrema_identities or accumulate_gradients_sharded": 7 passed.779cd403.The two-update run is feasibility evidence. Learning quality, sustained throughput, and matched backend benchmarks remain out of scope.