Repository navigation
Conversation
Reapply the intended DFlash-only net delta from ef405c8 onto NVIDIA main 36b5999. The original signed series spans fe8a7fa..ef405c8. Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 8a4c7f2 |
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]> # Conflicts: # nemo_rl/models/policy/workers/megatron_policy_worker.py # nemo_rl/weight_sync/nccl_reshard_weight_synchronizer.py # tests/unit/models/policy/test_megatron_worker.py # tests/unit/weight_sync/test_weight_synchronizer.py
|
/ok to test 440e439 |
|
@jinglinglingling can you review it again ? |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 1192c2b |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 373c2a2 |
Signed-off-by: seonjinn <[email protected]>
jinglinglingling
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. I re-checked the earlier comments at 373c2a2: the Megatron-generation token order (with the new ordering test), the refit.md wording, the new in-process and gloo tests, and the cleanups all look good, and the OCI GPU run covers the 8-rank TP2xPP2xCP2 layout.
Two things left:
- The TRT-LLM
nccl_reshardreceiver that came in with the main merge has the same token-order problem (inline). - The PR conflicts with main again (
prepare_nccl_reshard_refit_infoinvllm_backend.py, anddocs/design-docs/nccl-reshard-refit.md). Because of that, CI fails at checkout and no tests actually ran at this head. Could you resolve the conflicts and re-run CI, including codecov?
Happy to approve once those are in.
Signed-off-by: seonjinn <[email protected]>
|
/ok to test d5aa627 |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 0ec8492 |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test d1f68b7 |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test e65acdb |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test fa45b07 |
Carry over the NVIDIA-NeMo#3750 review changes: required draft_weights, preflight token before bulk reshard on Megatron and TRT-LLM receivers, and removal of draft_metadata_only, include_draft and generation cp_size. Signed-off-by: seonjinn <[email protected]>
yuki-97
left a comment
There was a problem hiding this comment.
Great to see draft refit become CP/PP-aware: the PR brings the draft from each lane's owner stage to every trainer rank, so the refit stream stays identical across ranks under TP, PP and CP.
Thanks for posting the OCI GB200 GPU gate (2 nodes x 4 GPUs) in the description, including the 8-rank TP2xPP2xCP2 torchrun stage; it shows clearly that the lane protocol holds on real hardware. Thanks also for the extensive self-review.
Scope: the PR diff, at fa45b07
Checked:
- Readiness token pairs on every path: the Megatron/Automodel collective and Megatron
nccl_reshardsenders send it, and the vLLM, Megatron-generation and TRT-LLM receivers read it before any payload on both transports, including empty misc. - Runs without a draft enter no new draft collective, since
_iter_draft_weights_for_refitreturns first; the only added cost is one int32 token per refit. - Every PP-lane raise depends on values all lane ranks already agreed on, and rank-local export/allocation failures go through the consensus, so lanes fail together.
- Every caller of
_iter_params_with_optional_kv_scalespasses the preflighteddraft_weights(keyword-only, required), so the draft is exported once per refit before any payload.
Remaining comments are on:
- The test-only branch in the PP-owner broadcast and the manifest-agreement helper
- The stale reason in the
lm_policy.pyguard comment for draft withnccl_reshard - Reusing the existing PP object broadcast instead of the custom wire protocol
- Streaming the draft like the target instead of the per-refit preflight and readiness token
nit
- Builder patch in the manifest-mismatch test that does not reach the worker
- Moving
_collective_deviceand_reduce_lane_consensusintonemo_rl/distributed/collectives.py - Moving the manifest-agreement helper into
nccl_reshard_utils.py - Gathering the draft refit code into a new
draft/refit.py - Moving the tensor-manifest encoding into a new
nemo_rl/distributed/tensor_manifest.pyif the custom protocol stays - Please refresh the PR description: it still says the PR is stacked on #3744, cites older validation heads, and its Supported contract section lists train-side CP lanes as supported while setup still rejects draft with Megatron CP>1
Generated by Claude Code (#4999 version)
Signed-off-by: seonjinn <[email protected]>
Address review: the PP owner sends a manifest with broadcast_obj_from_pp_rank, then streams draft tensors one at a time on the PP group. Remove the packed-broadcast preflight token, move the manifest rank-agreement helper to nccl_reshard_utils and the collective helpers to collectives.py, and append checked draft weights last in the nccl_reshard misc broadcast. Signed-off-by: seonjinn <[email protected]>
|
/ok to test fbd587b |
Take the manifest plus per-tensor PP stream from draft/refit.py and drop the readiness token, draft preflight and packed frame protocol. stream_draft_weights_for_refit gains an export_weights hook so DFlash and DSpark providers export their own weights. Signed-off-by: seonjinn <[email protected]>
yuki-97
left a comment
There was a problem hiding this comment.
Merge blockers — please rebase on main; the PR is 36 commits behind and the "Check if PR branch is up to date" job allows at most 10.
Thanks for resolving the previous round of comments: the draft now streams from its PP owner stage like the target, and the readiness token, the per-refit preflight and the custom wire protocol are gone.
Scope: fix commits b4e5372 through fbd587b, checked against the open threads from the previous review, plus a scan of the changed files for new issues.
Checked:
- Every previous thread held at the current head:
stream_draft_weights_for_refitsends one manifest withbroadcast_obj_from_pp_rankand onedist.broadcastper tensor, the draft comes last in every live and metadata producer (collective, CUDA-IPC, checkpoint-engine, both ModelOpt paths and the nccl_reshard misc stream), and the token and preflight files are byte-identical to main. - The WORLD manifest-agreement check is rank-stable: the bulk/misc split depends on mapping types only and is EP-reduced, non-owner shapes come from the owner's object gather, and the draft manifest is exchanged before the meta context.
- Dropping the vLLM-side speculator rejection is safe for a static drafter: with
policy.draft.enabled=falsenodraft.*name entersmisc_meta, the manifest has no draft component and finalization skips it, the same as the collective path. - The second
vllm_context_parallel_violationscall in the synchronizer is load-bearing: distillation builds the synchronizer through the factory withoutcheck_nccl_reshard_refit_support.
Remaining comments are on:
- A PP>1 GPU run at this head, since the new NCCL stream has only run under gloo
- The follow-up issue for draft refit over
nccl_reshard
nit
- Two
speculative_configtests that no longer check anything - The missing
@requires_weight_foldingon the new real-quant order test - PR title: "support context-parallel draft weight transport" names a capability setup rejects (draft with Megatron CP>1);
feat(draft): stream Megatron draft weights across PP stages for refitmatches the description
Generated by Claude Code
| yield f"{DRAFT_REFIT_PREFIX}{name}", tensor | ||
| return | ||
|
|
||
| pp_group = parallel_state.get_pipeline_model_parallel_group() |
There was a problem hiding this comment.
Following up on the previous comment (#3750 (comment)): this PP>1 stream (refit.py:133-141, one broadcast_obj_from_pp_rank manifest, then one dist.broadcast per tensor on the PP group) is new in fbd587b and has only run under gloo in the 2-process test_pp2_streams_owner_weights_to_every_lane_rank. The OCI GB200 TP2xPP2xCP2 stage posted earlier (#3750 (comment)) ran at 5b9e0dc on the protocol this commit removed, and the Megatron eagle3 nightly runs PP=1, so the NCCL path with a real Megatron PP layout has not executed at this head.
Please re-run a PP>1 draft refit on GPUs at fbd587b (the earlier torchrun stage adapted to TP2xPP2 is enough, since draft with Megatron CP>1 stays rejected) and post the result in the PR description.
| ids=["eagle3", "dflash", "dspark", "dflash-k4", "model-without-method"], | ||
| ) | ||
| def test_check_nccl_reshard_refit_support_rejects_draft_speculators( | ||
| def test_check_nccl_reshard_refit_support_accepts_draft_speculators( |
There was a problem hiding this comment.
These two tests no longer check anything: this PR removed the only speculative_config read from check_nccl_reshard_refit_support (nccl_reshard_utils.py:666-965), so test_check_nccl_reshard_refit_support_accepts_draft_speculators and test_check_nccl_reshard_refit_support_accepts_non_draft_speculators only show that an ignored key is ignored. The non-draft one was the negative control for the deleted rejection, and draft with nccl_reshard is still rejected one layer up in lm_policy.py.
Suggest fix: delete these:
- test_nccl_reshard_utils.py:197-216
test_check_nccl_reshard_refit_support_accepts_draft_speculatorswith its parametrize - test_nccl_reshard_utils.py:219-237
test_check_nccl_reshard_refit_support_accepts_non_draft_speculatorswith its parametrize
| torch.testing.assert_close(output[0][1], torch.ones(1)) | ||
|
|
||
|
|
||
| def test_real_quant_refit_yields_draft_weights_last(monkeypatch): |
There was a problem hiding this comment.
nit: test_real_quant_refit_yields_draft_weights_last is the only _make_real_quant_worker() test without @requires_weight_folding. The helper reads MegatronQuantPolicyWorker.__ray_metadata__ (test_megatron_quant_worker.py:125), which is bound only under if _MODELOPT_AVAILABLE: (test_megatron_quant_worker.py:46-55), so without modelopt this test errors with NameError while its siblings skip.
Suggest fix:
| def test_real_quant_refit_yields_draft_weights_last(monkeypatch): | |
| @requires_weight_folding | |
| def test_real_quant_refit_yields_draft_weights_last(monkeypatch): |
What does this PR do ?
Adds pipeline-parallel-aware draft weight refit for Megatron draft co-training, and the context-parallel checks that
nccl_reshardneeds.broadcast_obj_from_pp_rank. Then it streams the draft tensors one at a time withdist.broadcaston the PP group. The code is innemo_rl/models/megatron/draft/refit.py.EXPORTER_ERRORorMANIFEST_INVALID). The nccl_reshard misc broadcast checks each draft tensor against the prepared metadata (METADATA_DRIFT) before it sends.nccl_reshardmaps trainer CP replicas onto the transport mesh and checks that all ranks build the same weight manifest (assert_refit_weight_manifest_rank_agreementinnccl_reshard_utils.py).Supported contract
policy.draft.enabled=truewithrefit_transport: nccl_reshardor a sparse transport. Draft refit overnccl_reshardis a follow-up.nccl_reshard, vLLM generation must use CP1.Issues
None.
Before your PR is "Ready for review"
Pre checks:
Validation
fbd587bc90addresses the 11-18 review. It removes the packed-broadcast readiness token and the custom binary PP protocol, and it streams the draft per tensor.tests/unit/models/megatron/test_draft_refit.py(PP1 stream, metadata-only, disabled draft, coded owner errors, metadata drift, and a 2-rank gloo PP stream), manifest agreement tests intests/unit/weight_sync/test_nccl_reshard_utils.py, and a misc-broadcast draft drift test intest_megatron_worker.py.