perf(sft): add a direct path for Megatron-LM prepacked inputs - #3380
Open
seonjinn wants to merge 37 commits into
Open
perf(sft): add a direct path for Megatron-LM prepacked inputs#3380seonjinn wants to merge 37 commits into
seonjinn wants to merge 37 commits into
Conversation
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
…ked-metrics-latest-main-200step-20260727
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Signed-off-by: sna <sna@nvidia.com>
Contributor
Author
|
/ok to test 35eaec8 |
Signed-off-by: sna <sna@nvidia.com>
Contributor
Author
|
/ok to test 9cd69d1 |
Signed-off-by: sna <sna@nvidia.com>
Contributor
Author
|
/ok to test 1e5c1d6 |
Signed-off-by: seonjinn <sna@nvidia.com>
Contributor
Author
|
/ok to test 5240737 |
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.
What does this PR do ?
This PR adds an opt-in SFT input path that consumes Megatron-LM-style
offline-packed JSONL rows without repacking their constituent conversations
inside NeMo-RL.
The new path:
megatron_sft_packedresponse dataset;and packed sequence boundaries from each offline-packed row;
present;
sharding; and
PP1 object-broadcast path.
Normal response datasets continue through the existing collator and packing
path. The direct path is SFT-only and opt-in.
Issues
No linked issue.
Usage
The direct path currently requires the Megatron policy backend, micro-batch
size 1, dynamic batching disabled,
sft.only_unmask_final=false, the standardNLLLossFn, fused linear logprobs disabled,delegate_pack_to_model=false,and no draft-model, split-training, or router-replay input. Unsupported
combinations fail closed during setup or before model execution.
Performance
A strict 64-node comparison used 512 H100 GPUs, the same static packed row
schedule, and matched performance-sensitive settings: TP8, CP16, EP32, ETP1,
PP1, GBS64, MBS1, sequence length 262144, selective MoE recompute, overlapping
gradient reduction and parameter gathering, two repeated MTP layers, P2P
batching enabled, and NVLS disabled.
In this strict comparison, NeMo-RL was within 0.71% of standalone Megatron-LM.
Detailed performance and convergence results are available in the 200-step W&B report. The
lm_lossand validation loss closely matched between the two systems.Correctness
For steps 3-20, training loss closely matched between the two systems, with a
mean absolute difference of
0.001631and a maximum difference of0.004211.All compared losses were finite.
Before your PR is "Ready for review"
Pre checks:
validation DP remainders, pipeline transport, loss handling, metric payloads,
and worker integration.
68 passed).pending.
accepted in review.
Additional Information
supported SFT prompt format.
does not deserialize prebuilt PyTorch tensors.
fused linear logprobs.
maincommit80555d3a0595ce3cf76f2ca1b2bf123339064556; full CI and the matchedlatest-main 200-step run are pending.
Reviewer focus: