Repository navigation
Refuse tensor parallel on blocks that own parameters in the registry - #16638
Conversation
tp_native refuses an attention or MLP block that owns a parameter directly, such as the gpt-oss attention sinks, but the registry said tensor parallel MoE runs for every family and reported gpt_oss x tp as unverified. The query now reads that structure from the module tree (direct_params) and a tp x model rule refuses it with tp_native's reason, before the model is split. The cells table notes the refusal for gpt_oss.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # unsloth/parallel_capabilities.py
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
tp_nativerefuses tensor parallel for any decoder attention / MLP block that owns a parameter directly instead of inside a projection ("tensor parallelism cannot shard '...': it owns the parameter '...' directly"). The gpt-oss attention sinks are one such parameter. The registry did not know this. For every MoE family under tp,_moe_notesaid "tensor parallel MoE runs", and gpt_oss x tp showed up as unverified. It ran unlessUNSLOTH_PARALLEL_STRICT=1was set, and then failed later insideapply_tensor_parallel. Under pp x tp the cell gate refused it, but gave a missing-evidence reason instead of the real one.Change
unsloth/parallel_capabilities.py:Query.direct_params, filled by_direct_params(model). It walks the decoder layers with tp_native's own helpers (_decoder_layers,_ATTN_NAMES,_MLP_NAMES,_is_moe_block), skips MoE blocks as tp_native does, and reports whether a block owns a parameter itself. It reads only the module tree, so a meta-device model works. Objects without modules (config namespaces, model ids) giveFalse.tp x model:q.tp > 1 and q.direct_params, with tp_native's reason, and "drop tp (DDP, or UNSLOTH_FSDP2=1, over the dp axis)" as the alternative.tp_nativeis unchanged. Its refusal stays aValueError:tests/test_tp_native_oracle.pymatches it asValueError, andtp_env._applycatchesValueError.Testing
New
tests/test_parallel_capabilities_tp_model.py, CPU only, on the tiny gpt-oss checkpoint. It checks that tp 2, tp 4 and pp 2 x tp 2 on a meta-device model (no weights read) raisetp x model. It also checks that the loaded model is refused by both the registry andtp_native.derive_tp_plan(same model, same structure), that gpt-oss under DDP alone is not refused, that tiny Qwen3 and Qwen3-MoE are not flagged and still derive a tp plan, and that the cells table carries the note.test_parallel_capabilities_tp_model.pytest_parallel_env.py,test_context_parallel_compose_refusal.py,test_parallel_cp_compose_gloo.py,test_tp_native_oracle.py,test_float8_training.py,test_fp8_lora.py,test_precision_registry.py,test_float8_training_fsdp2_gloo.pyGPU-marked tests were not run (CPU-only host session).