qwen4exp at four ranks: slice the width by parity, do not shard experts

The real-container declare gate refused this container at layers 46-47: 'keeps
1 experts plain bf16 on this rank, which leaves 127 quantised'. Root cause:
protected-expert counts are per-rank, and the recipe protects IN PAIRS precisely
so that each rank's quantised count stays even. Expert parallelism broke that
property the parity tables rest on; fixing it properly would need unequal-length
weight tables, which the builder's equal-split rule refuses by design.

The width split was always the right answer above two ranks and serves more
ranks than the old code realised. Each parity's blocks are cut contiguously
across the ranks and the rank taking the odd block alternates with the parity:
at four ranks and five blocks, [0,2) [2,3) [3,4) [4,5), with the fat class
rotating between the two parities so no rank takes both. Every block of every
expert has exactly one owner, protected counts go back to the recipe's global
even numbers, and -- because every rank still computes a slice of every routed
expert -- the routing-balance cost the EP design carried disappears with it.

World 2 is byte-identical: base, extra and the parity rotation reduce to the
same expressions at g.world == 2. Worlds up to the block count now declare;
beyond it the refusal names the reason.
This commit is contained in:
picoder authored and StillDeadcode committed 2026-10-04 21:47:44 +02:00
1 parent 7cf4c005e1
commit 10f3d6875b
3 files changed
+45 -18

No files matched your search

+5 -3
View File
@@ -97,9 +97,11 @@ keeps the 200K request and costs single-stream decode about 15%) and the 27B in
`--tp 4` runs the unfused all-reduce chain, so it is slower per step than `--tp 2` on the same
cards (unmeasured) — it is a capacity configuration, not a speed one, and it takes no `--tp-wire`:
`wht6` is a two-rank wire and four ranks run the exact one. The tiering flags above are the tp2
recipe carried over, and at four ranks a rank owns a quarter of the experts WHOLE instead of half
the width of every one, so the resident expert bytes per rank are smaller and the elastic window
is a different shape: read the boot log's `elastic` line and re-derive `--expert-vs-cache-ratio`
recipe carried over; above two ranks each rank still owns a **slice of every expert's width** —
each parity's 128-column blocks are cut contiguously over the ranks and the odd block alternates
with the parity, so every rank's share is whole blocks and every block has exactly one owner —
and the resident expert bytes per rank are smaller, so the elastic window is a
different shape: read the boot log's `elastic` line and re-derive `--expert-vs-cache-ratio`
and `--host-pool-mib` before trusting them.
Add `--api-key KEY` to require `Authorization: Bearer KEY`. Add `--debug-graph` to print every op