Repository navigation
fix(xing4): 按 MoE 实际序列分片聚合路由辅助损失 - #364
Draft
xingleixu123 wants to merge 1 commit into
Draft
xingleixu123 wants to merge 1 commit into
xingleixu123 wants to merge 1 commit into
Conversation
Reuse sequencewise router statistics across the actual sequence-partition groups and keep complete-sequence routing unchanged. Expose resolved input placements to existing recipe factories and wrappers.
This was referenced Nov 6, 2026
Collaborator
Author
|
补充本轮完整窗口证据:七组数值/状态/图表报告,必要顺序和触发场景置顶于总issue362。 统计域增量3b76915e在source496(四个TP1布局)与source3292(两个TP/LP布局)中均有明确身份。尤其TP2EP2/SP使用合法shared packed MLP复制plan并保留MoE序列分片/EP,完成1501–2500的1000次更新、4000实际全局样本与原生2500独立CPU状态核验;主LOSS/rawMTP signed mean相旧连续FSDP分别+0.0000357043592633941/-0.000055535430556125755,按原完整均值规则通过。 本PR负责resolved CP/TP序列统计域及router统计职责归属,复用DS4.1公共sequence AUX;LP显式TP副本在原生反向中重复累加是另一个独立根因,由#365/Draft#366处理。本次整网组合同时包含它,不能把该结果写成#364已单独解决LP倍率。原12case显式TP平均/LP=false探针和后续原生倍率证据的边界均保留。 保持Draft,当前外部CI尚无可信完整通过回写;原review线程和既有source/head未改。 |
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 type of PR is this?
/kind bug
What does this PR do / why do we need it:
TP+EP 使用 sequence parallel 时,MoE 的 D-10 边界可以保留 TP 序列分片。mindspore-ai#1477 只给 router 绑定 CP group,导致完整序列的 sequencewise AUX 变成各本地片段的目标;不能仅依据配置中 TP>1 就加入 TP group,因为普通 TP 或 EP1/SP 会先 all-gather,router 已看到完整序列。
本修改按真实边界的 resolved input destination 选择仍为 sequence Shard 的 TP/CP 轴。counts 使用无梯度 SUM,概率和使用已有可微 SUM;不合并不同 DP 样本,也不改变 expert dispatch、load bias 的 token counts 或 Muon。CP 适配文件不再负责 router 统计绑定。
实现复用 DS4.1 已有
sequence_load_balancing_loss,提升到公共 functional 后保留原导入兼容。默认 DS4.1 路径不变,Xing4 只传入其既有 affinity epsilon。完整序列 fast path 保留原有表达式,避免引入无关算子或分配。recipe factory/inner wrapper 通过一个可选的只读input_placements上下文获取已解析布局;未声明该参数的现有扩展不受影响。这是基于 主仓 #1477 head
eb1121470917789ce641e3f12b4b6bad65b6ba54的独立 stacked Draft,保留 mindspore-ai#1439/mindspore-ai#1477 原提交和全部检视线程。1 commit、7 files;其中一个文件仅调整已有两处 UT 的 mock 所有者路径,没有新增 UT/ST。Which issue(s) this PR fixes:
关联并扩展已有 JT #338 的完整序列 AUX 统计域问题;此前 CP 实现 JT #341 不覆盖 TP+EP/SP 保留分片的边界。本修复对应 mindspore-ai#1439 检视 T40/T44,和 MTP AUX 累积倍率问题 JT #355/#1441 独立。
总跟踪:JT #362。
Test Plan and Test result:
Code review checklist [illustration]: