Repository navigation
[1/3] feat(dspark): per-optimizer-step loss normalization for cost-aware scheduling - #986
Open
yushengsu-thu wants to merge 2 commits into
Open
yushengsu-thu wants to merge 2 commits into
yushengsu-thu wants to merge 2 commits into
Conversation
…ware scheduling DSpark historically averages every DP micro-batch round by its own all-reduced token weight (`round`). Cost-aware scheduling regroups rounds by cost, which would make that normalization re-weight tokens by round composition, so the model gains a `step` mode: it hands the trainer additive `loss_terms` and the whole optimizer step is averaged by its global token weight, like DFlash, with no per-micro-batch all-reduce. The mode is chosen automatically (`step` with `training.cost_aware_scheduling`, `round` otherwise) and recorded in the DSpark resume contract.
Checkpoints written before the DSpark resume contract recorded `dspark_loss_normalization` were trained with the per-round normalization. Treat a missing key as `round` so those runs resume unchanged, while a resume that now resolves to `step` (cost-aware scheduling on) is still rejected.
This branch has not been deployed
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.
Part 1/3 of #955 (online: #987, offline: #988). This one can be merged on its own.
DSpark normalizes the loss per DP round. Cost-aware scheduling puts similar samples in the same round, so short rounds would get a heavier per-token weight. This adds a
stepmode that normalizes over the whole optimizer step, like DFlash does. It's only picked whencost_aware_schedulingis on, so nothing changes until #987.roundstays bit-identical and old checkpoints resume asround.stepvsroundwith no regrouping, 4x H200, samples/s. The gain comes from dropping the per-micro-batch all-reduce.