Repository navigation
fix: Preserve quant worker hook overrides during fp8 setup - #2803
Merged
Merged
Conversation
The fp8_params initialization path disabled Megatron DDP forward pre-hooks by calling the raw DDP method directly. ModelOpt quant workers already override the worker-level hook toggles to hide TensorQuantizer modules from DDP module iteration, so the raw call bypassed that protection and exposed TensorQuantizer(disabled) entries that had no registered hook handle. Constraint: Megatron DDP assumes every current module has a forward-pre-hook handle when disabling overlap-param-gather hooks.\nRejected: Special-case TensorQuantizer in the base worker | the quant worker already owns that behavior through its override.\nConfidence: high\nScope-risk: narrow\nDirective: Forward-pre-hook toggles in helper paths should dispatch through worker methods so subclasses can preserve their invariants.\nTested: ruff format --check and ruff check on touched files; python -m py_compile on touched files; Slurm container pytest tests/unit/models/policy/test_megatron_worker.py -k forward_pre_hook --mcore-only passed in job 214815.\nNot-tested: Full tests/functional/qa_distillation_megatron.sh in this container; current smoke container lacked some Megatron runtime deps for direct full-module unit imports. Signed-off-by: Meng Xin <[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. |
The initial regression guard only inspected the source shape. Execute the actual helper body from the production file inside a lightweight fake worker so the test fails on the original raw-DDP bypass and also verifies the worker-level hook override receives param_sync=False. Constraint: Importing the full Megatron worker in lightweight unit environments can require heavy Megatron-Bridge and Transformer Engine dependencies.\nRejected: Full quant-worker integration unit | too heavyweight for the narrow regression and already covered by functional QARL smoke surfaces.\nConfidence: high\nScope-risk: narrow\nDirective: Keep this test focused on dispatch behavior; broader quant hook integration belongs in functional tests.\nTested: ruff format --check and ruff check on touched files; python -m py_compile on touched files; Slurm container pytest tests/unit/models/policy/test_megatron_worker.py -k forward_pre_hook --mcore-only passed in job 214818.\nRelated: Reviewer re-check approved after replacing structural-only assertion with behavioral source-execution test. Signed-off-by: Meng Xin <[email protected]>
The QARL distillation functional test uses Qwen3-0.6B on two GPUs for one training step plus quantized HF export. That makes it comparable to the existing fast Megatron checks while covering the quantized distillation path that exposed the TensorQuantizer forward-hook regression. Constraint: This is the only functional coverage for the quantized QA distillation path that hit the forward-hook regression.\nConfidence: high\nScope-risk: narrow\nTested: bash -n tests/functional/L1_Functional_Tests_Megatron_3.sh tests/functional/qa_distillation_megatron.sh\nTested: Slurm qa_distillation_megatron.sh job 214980 completed with train/loss=0.1924101710319519 and HF export PASS\nNot-tested: Full CI matrix Signed-off-by: Meng Xin <[email protected]>
Contributor
Author
|
/ok to test |
|
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. |
Contributor
Author
|
/ok to test |
copy-pr-bot Bot
pushed a commit
that referenced
this pull request
Jun 14, 2026
…quant-worker hook fix) Signed-off-by: Zeyu Zhou <[email protected]>
copy-pr-bot Bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
…quant-worker hook fix) Signed-off-by: Zeyu Zhou <[email protected]>
ashors1
pushed a commit
that referenced
this pull request
Jun 27, 2026
Signed-off-by: Meng Xin <[email protected]> Signed-off-by: Anna Shors <[email protected]>
This branch was previously 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.
What does this PR do ?
Fix the issue by #2633, The fp8_params initialization path disabled Megatron DDP forward pre-hooks by calling the raw DDP method directly. ModelOpt quant workers already override the worker-level hook toggles to hide TensorQuantizer modules from DDP module iteration, so the raw call bypassed that protection and exposed TensorQuantizer(disabled) entries that had no registered hook handle.
We didn't have any QARL test in CI Lfast, I moved the small QA-distill to fast, so people won't miss QARL things next time.
Issues
closes #2805
Usage
# Add a code snippet demonstrating how to use thisBefore your PR is "Ready for review"
Pre checks:
Additional Information