Propagate RL runtime config updates to module configs - #6423
Conversation
Signed-off-by: Philip Petrakian <ppetrakian@nvidia.com>
|
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. |
|
/ok to test de68147 |
|
/claude review |
There was a problem hiding this comment.
LGTM
Verified the wrapper-descent loop handles the real production shapes (DDP/Float16Module/GPTModel roots are already nn.Module, so modules() covers the whole tree), the identity dedup preserves existing behavior for models sharing one config, and the restore path keeps the prior args.* semantics. Test coverage looks right: dedup/idempotency and skip-on-missing-attribute in test_utils.py, plus shared/distinct config parametrization across dense/MoE for megatron_rl_inference_mode and a get_logprobs test that checks the value both during forward and after restore.
Non-blocking note: the helper assigns the same list object to every config for cuda_graph_modules. I checked for in-place mutation of that attribute and the only site is TransformerConfig.__post_init__ (append), which runs only at construction, so no aliasing is observable today — and the docstring already documents the shared-value intent. Just worth keeping in mind if a runtime in-place mutation of that list is ever added.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/31533473528 |
What does this PR do?
Design doc (internal-only).
Removes RL runtime config updates' assumption that every module aliases the root model config.
get_logprobsandmegatron_rl_inference_modecurrently update onlymodel.config. Models may contain distinct module config objects, so those root-only writes can leave module runtime state stale.This change:
set_model_config_attribute, which updates the root config and every distinct child-module config that defines the attribute;flash_decode,cuda_graph_impl,cuda_graph_modules, andinference_cuda_graph_scopein RL utilities; andThese four attributes are model-wide runtime controls: this helper intentionally assigns the same value to every applicable config. This PR does not introduce layer-specific values for them.
For models that share one config object, identity deduplication preserves the existing behavior. For models with distinct configs, the change fixes propagation of these model-wide controls.
This PR is independently mergeable into
mainand is intended to merge before #6313. It does not modify #6313 or depend on its hybrid layer config changes.