Repository navigation
fix(training): align GDN MTP FLOPs with decoder layout - #4834
Conversation
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
|
/ok to test 58631b4 |
|
Line one |
|
Review of fix for GDN FLOP count on MTP layers. The fix is correct. When the attention variant is gated_delta_net and mtp_num_layers is greater than zero, MTP layers were previously counted only as standard-attention layers (via num_standard_attn_layers = num_layers - num_gdn_layers), even though MTP construction reuses the final decoder layer spec. Adding last_layer_is_gdn * mtp_num_layers to num_gdn_layers mirrors the existing MoE handling (last_layer_is_moe at line 726) and keeps the GDN/standard split consistent. Using cfg.model.num_layers for the pattern length is also correct, since num_layers includes the MTP layers. One test-coverage gap worth closing (also flagged inline): both parametrized values in test_gdn_mtp_repeats_last_decoder_attention resolve to pattern [1,1,1,0] for num_layers=4, so the last decoder layer is always standard-attention (last_layer_is_gdn == 0). The new last_layer_is_gdn * mtp_num_layers term is never exercised with a nonzero value. Add a case where the final decoder layer is GDN (e.g. linear_attention_freq=[1,1,0,1]) with expected_delta computed from the GDN per-layer cost — that is the exact path this PR fixes. Suggested test cases:
|
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
|
/ok to test 683abde |
Post-merge cross-calculator audit evidenceAn independent AutoModel ↔ Megatron Bridge theoretical-FLOPs audit reproduced Using identical parameters and GBS 1 on the pre-fix frozen Bridge revision
The difference decomposes as follows:
This exactly matches the reported Related evidence and follow-up:
No additional Bridge PR is needed because #4834 already contains both the |
What does this PR do ?
Fixes Gated DeltaNet FLOPs accounting when a decoder-only attention layout is combined with Multi-Token Prediction (MTP), unblocking the Qwen3.5-VL L1 recipe test on
main.Changelog
linear_attention_freqagainst decoder layers only; Hugging Face layer layouts do not include MTP layers.GitHub Actions CI
Validated in the repository container on EOS:
uv run python -m pytest tests/unit_tests/training/utils/test_flop_utils.py::TestGDNLayerFlops::test_gdn_mtp_reuses_last_decoder_attention_type -q(4 passed)uv run python -m pytest tests/unit_tests/training/utils/test_flop_utils.py::TestGDNLayerFlops -q(9 passed)2 failed), then both pass after restoring the implementation.TestQwen35VLFinetuneRecipes::test_sft_nothing_frozensmoke train (1 passed, all 10 iterations plus validation/test evaluation)uv run pre-commit run --all-filesBefore your PR is "Ready for review"
Pre checks:
Additional Information
2f69b067748a0842521a527b59ace55e18df7f44): exact Hugging Face Qwen attention schedules became decoder-length lists.mtp_num_layers=1.mainjob fixed by this PR: https://github.com/NVIDIA-NeMo/Megatron-Bridge/actions/runs/29176488641/job/86607551503