Conversation
…e can run `get_flops_formula_for_hf_config` had no entry for `Qwen3_8_FlashNextConfig` or its text / legacy `qwen4_exp` aliases, so `BenchmarkingRecipe.setup()` fell back to `transformer_flops`, which reads `config.hidden_size` on the multimodal wrapper and raises `AttributeError` before the first iteration. Any Qwen3.8-Flash-Next benchmark yaml therefore could not start, and the finetune recipe's TFLOPS metric was computed with the wrong formula. Add `qwen3_8_flash_next_flops`, mirroring the `qwen3_8_flash_next` module shapes: GatedDeltaNet layers via the shared `_gdn_attention_per_layer_flops` term, QSA gated q/k/v/o projections plus sparse GQA BMMs over the routed compressed blocks and causal tail (closed form per query position), the frozen indexer counted forward-only, the MoE router / routed + shared experts / shared-expert gate, two HyperConnection mixers per layer plus the final read mixer, the Engram PLE key/value projections and depthwise convolution, and the untied LM head. The unloaded MTP head is not counted. On the released configuration the formula counts 6.14B active GEMM parameters per token excluding the LM head (model card: 6B activated) and implies a 125.8B backbone excluding the 51.2B Engram table (model card: 125B); 4096-token training costs 42.0 GFLOPs/token, 1.034x `6 x active`. Map all four config classes to it and add CPU unit tests (registration, wrapper unwrapping, model-card parameter checks, closed-form tail sum against brute force, per-layer QSA/indexer/PLE accounting, gbs linearity, sparse-attention saturation). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Agoniii <815244047@qq.com>
This branch has not been 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 ?
Register a FLOPs formula for Qwen3.8-Flash-Next so
BenchmarkingRecipeForNextTokenPredictioncan start and report MFU, and so the finetune recipe's TFLOPS metric uses the right architecture.get_flops_formula_for_hf_confighad no entry forQwen3_8_FlashNextConfig/Qwen3_8_FlashNextTextConfig(or the pre-renameqwen4_expaliases), so it fell back totransformer_flops, which readsconfig.hidden_sizeon the multimodal wrapper and raisesAttributeErrorinBenchmarkingRecipe.setup()— the same failure mode #3955 fixed for DeepSeek-V4.1.Changelog
qwen3_8_flash_next_flopstonemo_automodel/components/utils/flops_utils.py, mirroring thecomponents/models/qwen3_8_flash_nextmodule shapes:_gdn_attention_per_layer_flopsterm;q_proj/k_proj/v_proj/o_proj, plus sparse GQA BMMs where querytattends toratio * min(indexer_budget/ratio, floor((t+1)/ratio))routed tokens and its(t+1) mod ratiocausal tail (closed form, new_sum_modhelper);requires_grad_(False)) counted forward-only (2x MACs);num_experts_per_tokrouted + 1 shared expert, shared-expert gate;key_proj/value_projand depthwise causal convolution onple_layer_ids;Qwen3_8_FlashNextConfig,Qwen3_8_FlashNextTextConfig,Qwen3_8_FlashNextLegacyConfig,Qwen3_8_FlashNextLegacyTextConfigin the class → formula map.tests/unit_tests/utils/test_qwen3_8_flash_next_flops.py(8 CPU tests): registration of all four config classes, wrapper →text_configunwrapping, model-card parameter checks,_sum_modvs brute force, per-layer QSA + indexer accounting vs brute-force sums, PLE projection counting, linearity ingbs, sparse-attention saturation with sequence length.Sanity numbers on the released configuration:
6 x activeBefore your PR is "Ready for review"
Pre checks:
ruff format/ruff checkclean.pytest tests/unit_tests/utils/test_qwen3_8_flash_next_flops.py tests/unit_tests/utils/test_deepseek_v41_flops.py→ 16 passed (CPU).Additional Information
🤖 Generated with Claude Code