You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native TP does not shard qwen3_vl_moe experts (weights fully replicated per rank) #48308
Found while testing native TP on Qwen3-VL-30B-A3B; the sibling arch qwen3_5_moe shards correctly with the same code, which makes the comparison easy. Related but distinct from #48204: that draft adds an expert-parallel path; this issue is about the plain tp_size-only path silently replicating the experts.
The model loads without error but each rank holds 60.3 GB: the full 30B-A3B weights. Expert weights are not sharded (for comparison, Qwen/Qwen3.6-35B-A3B, arch qwen3_5_moe, shards to
10.5 GB/rank with the same code). Consequences observed:
any training attempt OOMs immediately (weights + grads alone exceed 80 GB)
continuous batching on the TP model crashes in the paged cache with index_copy_(): Destination slice shape: 4 128 ... source slice shape: 1 128: the cache is sized for the config's 4 KV heads while the attention layers are sharded to 1 KV head per rank, so the two disagree (attention appears sharded while the MoE is not).
Root cause: Qwen3VLMoeTextConfig.base_model_tp_plan carries dense-style layers.*.mlp.gate_proj/up_proj/down_proj entries, paths that do not exist in the MoE layers (experts live at layers.*.mlp.experts.*), so no pattern matches the expert weights and they replicate. The sibling qwen3_5_moe plan has the fused-expert entries (experts.gate_up_proj: packed_colwise, experts.down_proj: rowwise, experts: moe_tp_experts), which is why it shards correctly.
Precedent: the sibling arch had the identical bug, reported in #45125 and fixed by #45124 (add _tp_plan to the ForConditionalGeneration wrapper). That fix was never mirrored to qwen3_vl_moe, which is exactly why the comparison above splits the way it does. #41570 (uneven memory on Qwen3-VL-30B-A3B multi-GPU) may be an earlier symptom sighting.
Expected behavior
Either a complete TP plan for qwen3_vl_moe (experts sharded like the other MoE archs), or a load-time error when parts of the model have no TP mapping, instead of silent replication.
System info
transformers main (a353632), torch 2.13.0+cu130, Python 3.12.12, 4-8x NVIDIA H100 80GB, torchrun single node.
EP is a working alternative: DistributedConfig(tp_size=4, enable_expert_parallel=True) shards the experts correctly (18.7 GB/rank at load, 0.44s/train step), but training NaNs at step 2 with the uninitialized grouped_mm sentinel-row signature fixed in Fix expert-parallel training: NaN gradients and missing gradient contributions #48205, so it's blocked on that PR.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Activity
qgallouedec commentedon Aug 25, 2026
Two follow-ups after testing:
DistributedConfig(tp_size=4, enable_expert_parallel=True)shards the experts correctly (18.7 GB/rank at load, 0.44s/train step), but training NaNs at step 2 with the uninitializedgrouped_mmsentinel-row signature fixed in Fix expert-parallel training: NaN gradients and missing gradient contributions #48205, so it's blocked on that PR.experts.gate_up_proj: packed_colwise,experts.down_proj: rowwise,experts: moe_tp_experts) is not enough: loading then fails with mismatched sizes, presumably because the qwen3_vl_moe fused-expert checkpoints go through the Transpose weight mapping ([loading] Fix Transpose Operation, and qwen3_vl_moe mapping #43307, Add a sentinel mechanism in Transpose and fix qwen3_vl_moe weight mapping #43913, Add a dim check mechanism in Transpose and fix qwen3_vl_moe weight mapping #44037) and the packed plan doesn't compose with that layout. A correct plain-TP fix needs the plan aligned with the conversion.remi-or commentedon Aug 27, 2026
cc. @3outeille for TP and @ArthurZucker since we talked about this recently
github-actions commentedon Sep 25, 2026
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
remi-or commentedon Sep 26, 2026
Issue is still relevant I think, should be fixed by #48373 ? cc. @ArthurZucker
qgallouedec commentedon Oct 1, 2026
Yes, linking #48373.
Also, the EP workaround from my comment above should be unblocked now that #48205 is merged.
ArthurZucker commentedon Oct 13, 2026
Transpose support is still planned, we'll probably get a quick fix in for now with a long term support for arbitrary stuff.