Repository navigation
fix(refit): release trainer memory before collective export - #3984
Conversation
Signed-off-by: seonjinn <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test ca43e3d |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 32b0467 |
…t-memory-20260903 Signed-off-by: seonjinn <[email protected]> # Conflicts: # tests/unit/algorithms/test_distillation.py
|
/ok to test 1b592f7 |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 1e8e23f |
Signed-off-by: seonjinn <[email protected]>
|
/ok to test a572960 |
Backport #3984 (release_grads_before_refit) from optimized's patches 0002 and 0006 (originally by seonjinn <[email protected]>), then extend it to the trtllm generation backend: factory.py's _SUPPORTED_BACKENDS and validate_release_grads_before_refit only allowed vLLM. CollectiveWeightSynchronizer is backend-agnostic on the trainer side and TrtllmGeneration already implements the generation-side interface it needs, so trtllm just needed the gate relaxed. Signed-off-by: Erin Ho <[email protected]>
Backport #3984 (release_grads_before_refit) from optimized's patches 0002 and 0006 (originally by seonjinn <[email protected]>), then extend it to the trtllm generation backend: factory.py's _SUPPORTED_BACKENDS and validate_release_grads_before_refit only allowed vLLM. CollectiveWeightSynchronizer is backend-agnostic on the trainer side and TrtllmGeneration already implements the generation-side interface it needs, so trtllm just needed the gate relaxed. Signed-off-by: Erin Ho <[email protected]>
Signed-off-by: seonjinn <[email protected]> # Conflicts: # nemo_rl/weight_sync/collective_weight_synchronizer.py
Signed-off-by: seonjinn <[email protected]>
|
/ok to test b4e342c |
Signed-off-by: seonjinn <[email protected]>
Signed-off-by: seonjinn <[email protected]>
Backport #3984 (release_grads_before_refit) from optimized's patches 0002 and 0006 (originally by seonjinn <[email protected]>), then extend it to the trtllm generation backend: factory.py's _SUPPORTED_BACKENDS and validate_release_grads_before_refit only allowed vLLM. CollectiveWeightSynchronizer is backend-agnostic on the trainer side and TrtllmGeneration already implements the generation-side interface it needs, so trtllm just needed the gate relaxed. Signed-off-by: Erin Ho <[email protected]>
Signed-off-by: seonjinn <[email protected]>
|
/ok to test 73f4446 |
There was a problem hiding this comment.
Scope: follow-up on 4a0aa78 and the test commits since 5586e40.
Checked:
- Default behaviour is unchanged for every shipped recipe. The old nested key was
falseeverywhere it was set, the newpolicy.offload_policy_before_refitisfalsein every exemplar, andoffload_optimizer_for_refitresolves totrueexactly as the old.get(..., True)did. - Legacy PPO with non-colocated vLLM now attaches a weight synchronizer when offload is on, and
refit_policy_generationroutes through it, so the flag is no longer dropped there. - Distillation's managed refit path skips the inline
prepare_refit_info, which is fine becauseCollectiveWeightSynchronizer.init_communicatorruns it. - GRPO, PPO and distillation all validate the topology at setup, before the policy or generation workers are built, so colocated and unsupported-transport combinations fail early.
Remaining comments are on the removed mcore_generation_config key, which has no startup rejection, and on the research template config, which is missing the two new required keys.
nit, not blocking merging — the title says "before collective export", but the PR now also covers nccl_reshard and Megatron-generation refit; something like fix(refit): offload policy before non-colocated refit would match the scope.
Signed-off-by: seonjinn <[email protected]>
…efaults Signed-off-by: seonjinn <[email protected]>
|
/ok to test 717da9b |
yuki-97
left a comment
There was a problem hiding this comment.
Merge blockers — please rebase on main and resolve conflicts before further review.
Scope: fix commit 717da9b against the open threads from the previous pass, plus a scan of the changed files for new issues.
Checked:
- The removed
mcore_generation_config.offload_policy_before_refitkey is now rejected at startup byreject_outdated_mcore_refit_offload_key, which runs beforeMasterConfig(**config)in every entry point includingsingle_update.py; no shipped YAML nests the key undermcore_generation_config, so the check does not trip on in-tree recipes. research/template_project/configs/grpo_math_1B.yamlnow defines both required keys, soMasterConfigno longer fails with "Field required".- The rejection tests cover both
trueandfalsefor the removed key, plus the policy-level key passing.
Remaining comments are on the new template_project config test.
Signed-off-by: seonjinn <[email protected]>
…61007 Signed-off-by: seonjinn <[email protected]>
|
/ok to test c9fdef7 |
Megatron worker setup reads offload_optimizer_for_refit without a fallback since #3984 removed its `.get(..., True)` default. The CSD example teachers never set the key: YAML lists are not merged from the defaults file, so the student inherits it from distillation_math.yaml while each teacher entry is written out in full. A CSD example teacher switched to Megatron therefore fails with a KeyError during worker setup. Add offload_policy_before_refit and offload_optimizer_for_refit to each teacher in csd.yaml and csd_multiteacher.yaml, matching the teacher entries of the X-Token example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adithya Hanasoge <[email protected]>
Megatron worker setup reads offload_optimizer_for_refit without a fallback since #3984 removed its `.get(..., True)` default. The CSD example teachers never set the key: YAML lists are not merged from the defaults file, so the student inherits it from distillation_math.yaml while each teacher entry is written out in full. A CSD example teacher switched to Megatron therefore fails with a KeyError during worker setup. Add offload_policy_before_refit and offload_optimizer_for_refit to each teacher in csd.yaml and csd_multiteacher.yaml, matching the teacher entries of the X-Token example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adithya Hanasoge <[email protected]>
Megatron worker setup reads offload_optimizer_for_refit without a fallback since #3984 removed its `.get(..., True)` default. The CSD example teachers never set the key: YAML lists are not merged from the defaults file, so the student inherits it from distillation_math.yaml while each teacher entry is written out in full. A CSD example teacher switched to Megatron therefore fails with a KeyError during worker setup. Add offload_policy_before_refit and offload_optimizer_for_refit to each teacher in csd.yaml and csd_multiteacher.yaml, matching the teacher entries of the X-Token example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adithya Hanasoge <[email protected]>
… export (#4806) Signed-off-by: seonjinn <[email protected]>
Megatron worker setup reads offload_optimizer_for_refit without a fallback since #3984 removed its `.get(..., True)` default. The CSD example teachers never set the key: YAML lists are not merged from the defaults file, so the student inherits it from distillation_math.yaml while each teacher entry is written out in full. A CSD example teacher switched to Megatron therefore fails with a KeyError during worker setup. Add offload_policy_before_refit and offload_optimizer_for_refit to each teacher in csd.yaml and csd_multiteacher.yaml, matching the teacher entries of the X-Token example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adithya Hanasoge <[email protected]>
Megatron worker setup reads offload_optimizer_for_refit without a fallback since #3984 removed its `.get(..., True)` default. The CSD example teachers never set the key: YAML lists are not merged from the defaults file, so the student inherits it from distillation_math.yaml while each teacher entry is written out in full. A CSD example teacher switched to Megatron therefore fails with a KeyError during worker setup. Add offload_policy_before_refit and offload_optimizer_for_refit to each teacher in csd.yaml and csd_multiteacher.yaml, matching the teacher entries of the X-Token example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adithya Hanasoge <[email protected]>
Summary
Release policy training memory before non-colocated refit.
One policy-level option now controls the same lifecycle for vLLM collective, vLLM NCCL Reshard, and Megatron-generation refit. This prevents large exports from competing with completed gradients, optimizer state, and Transformer Engine caches.
Usage
The option defaults to
false. It requires a Megatron policy and non-colocated vLLM or Megatron generation.Changes
Validation
207f9c385; the full test matrix is running.