Skip to content

EXL3 Flash Next: expert-parallel TP=2 (same tokens as TP=1) and MTP drafts (2/8) - #1442

Open
BlivionIaG wants to merge 42 commits into
ashhart:mainfrom
BlivionIaG:pr/exl3-s2-tp2-drafts
Open

BlivionIaG wants to merge 42 commits into
ashhart:mainfrom
BlivionIaG:pr/exl3-s2-tp2-drafts

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expert-parallel TP2 for EXL3 Flash Next and MTP drafts. TP partials use canonical FP64 gather and one rounding step.

Current-head checks

Two RTX 5060 Ti 16 GiB GPUs, CUDA 13.4.92, Zig 0.17.0; turboderp/Qwen3.8-Flash-Next-exl3 revision 69e33439ae950f17bcbe95c98f117d80f759ab6d.

  • Token gate: pass. TP1/TP2, drafts on/off, code/chat, greedy/seeded, one/four streams, three repetitions: full token hashes matched across all eight cells and all 240 measured responses completed. Receipt.
  • Performance gate: open. TP1 four-stream chat with default drafts was 0.883× plain greedy and 0.891× plain sampled on the alternating fresh-server check; code gains do not offset the chat loss. Receipt.
  • Sampled-head batching off did not resolve the loss: sampled chat was 0.879× plain. Diagnostic.
  • Draft depth 3 improved greedy chat to 1.077× plain, but sampled chat remained 0.916×. This diagnostic retained drafts and exact output hashes; it is not a production fix or a final performance/restore gate. Diagnostic.
  • Sampled depth 1 plus greedy depth 3 yielded 1.077× greedy and 0.953× sampled chat; all four diagnostic cells cleared 0.95 with identical hashes. The sampled margin is narrow and still below plain; this is not a robust no-regression result. Diagnostic.
  • tools/pr_check.py --base upstream/main --pr 1442 reported 0 errors and 0 warnings on this head at the time of the check. Its earlier Linux CI run passed eight checks with two nightly skips; current CI and integration remain with the maintainer.

Earlier evidence and open work

  • Earlier-head TP1/TP2 drafted/plain and resume comparisons passed; the filtered EXL3 Flash Next kernel contract passed 63/63 kernels and rejected 22/22 planted controls. Those resume and kernel checks have not been repeated on the current head.
  • Model fidelity on an older head: 70/72 top-token matches against an independent reference. The ids16 and ids17 differences remain open; no tie waiver or perfect-equivalence claim.
  • Final no-regression performance and restore evidence are required after a substantive fix. Main refuses this checkpoint and is not a runnable performance baseline; NVFP4 validation needs the maintainer's hardware.
  • ATC 0.9.6 returned an incomplete [Draft] EXL3 Flash Next on CUDA: TP=2, BF16 paging, cache reuse, graphs #1113 snapshot due to its pull-request limit. The earlier overlap check covered four known peers, not global clearance; maintainer is handling routine coordination.

The changed CUDA kernel was covered by the earlier filtered contract. No checkpoint weights are distributed; the checkpoint uses Qwen Community License 1.0.

@BlivionIaG
BlivionIaG force-pushed the pr/exl3-s2-tp2-drafts branch 3 times, most recently from 0b6880d to 519c235 Compare October 27, 2026 10:51
@ashhart

ashhart commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Thanks for this. Three things block it, two of which came up on #1113:

  1. TP=2 has to give the same tokens as TP=1. An FP64 receipt won't settle it. Each rank now sums its own experts
    before the fp32 all-reduce (exl3/tp/cuda_exl3_tp.zig:263-291), which regroups the sum, and you report different
    text on two of three prompts. One way through is to exchange the per-slot fp32 expert outputs, sum them in pick
    order on each rank, and show equal hashes at TP=1 and TP=2. Could you also say what regroups in the head? As far as
    I can see, the logits are gathered whole before the argmax.
  2. Please remove TF_FLASHNEXT_ATTN_SPLIT (exl3/model/cuda_exl3_heads.zig:26-32,181). It's an opt-in mode that
    changes tokens.
  3. Offloaded engines shouldn't serve plain by default. plainByDefault() (exl3/model/cuda_exl3_pass.zig:114-118)
    turns drafts off unless TF_FLASHNEXT_DRAFT_ENABLE=1.

This PR also changes NVFP4 Flash Next. Please take those changes out, or give them their own PR with NVFP4 receipts:

  • tp_draft_snapshots = true (cuda_lanes.zig:32) and --tp in the CUDA serves list (native/cuda.zig:35) admit
    NVFP4 TP=2 with drafts and the prompt cache. docs/multi-rank-receipts.md still says the CUDA build serves neither
    flag, and the refusal test (native/cuda_flashnext_refusal_test.zig:23) no longer checks Flash Next.
  • TF_FLASHNEXT_DRAFTS and _CONFIDENCE are renamed (cuda_lanes_load.zig:75-76), so existing settings are ignored
    without a warning.
  • Every NCCL wait now spins for 3 ms (cuda_collective.zig:14,85).

Two smaller points:

  • The draft vocabulary is decoded to bf16 at load (exl3/tp/cuda_exl3_mtp.zig:164-180). That only affects proposals,
    but please say so in the description.
  • fn_exl3_tp_mask and fn_exl3_tp_place need runner entries.

@BlivionIaG
BlivionIaG force-pushed the pr/exl3-s2-tp2-drafts branch 4 times, most recently from ae96d79 to 0d58795 Compare October 27, 2026 17:56
@BlivionIaG
BlivionIaG force-pushed the pr/exl3-s2-tp2-drafts branch from 0d58795 to e8b66c3 Compare October 27, 2026 19:21
@BlivionIaG BlivionIaG changed the title EXL3 Flash Next: expert-parallel TP=2 and MTP drafts (2/7) EXL3 Flash Next: expert-parallel TP=2 (same tokens as TP=1) and MTP drafts (2/8) Oct 27, 2026
@BlivionIaG
BlivionIaG force-pushed the pr/exl3-s2-tp2-drafts branch from e8b66c3 to b36b385 Compare October 28, 2026 08:08
@BlivionIaG
BlivionIaG force-pushed the pr/exl3-s2-tp2-drafts branch 4 times, most recently from f53ed60 to 66aca3f Compare October 29, 2026 07:33
@BlivionIaG BlivionIaG mentioned this pull request Oct 29, 2026
5 of 8 tasks
@BlivionIaG
BlivionIaG force-pushed the pr/exl3-s2-tp2-drafts branch 9 times, most recently from 28c7075 to e8bc4a0 Compare November 2, 2026 17:08
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Thanks for the review. On the head (e8bc4a049):

  1. TP=2 equals TP=1 by construction rather than by a per-slot exchange: one fixed reduction order at every degree. 64 leaves of 8 expert ids (the shared expert in leaf 63), an fma chain per leaf in pick order, then a fixed balanced fp32 tree. Each rank computes its own subtree, one fixed-size fp32 all-gather follows, and both ranks finish the tree; TP=1 runs the same tree (cuda_exl3_tp.zig, exl3_canon.zig). The old per-rank sum is gone. This changes TP=1 bits against the single 11-slot chain of the previous version, which the body asks you to accept.
  2. Nothing regroups in the head: the lm_head is split by vocabulary column (128-column blocks, each column reduced over the full K), the bf16 logits are gathered whole and the argmax runs on the whole row. A device test checks the joined halves equal the whole head bit for bit at 1 and 5 rows.
  3. TF_FLASHNEXT_ATTN_SPLIT, plainByDefault and TF_FLASHNEXT_DRAFT_ENABLE are gone; drafts are on by default for offloaded engines.
  4. NVFP4: tp_draft_snapshots stays false, --tp is refused for every non-EXL3 pack (packRanks), the 3 ms collective spin is EXL3-only, and the TF_FLASHNEXT_DRAFTS / _CONFIDENCE names are unchanged. fn_exl3_tp_place no longer exists; fn_exl3_tp_mask has a runner test. The draft vocabulary is decoded to bf16 at load and only affects proposals.

Open on our side: runner tests for fn_exl3_leaf_tree and fn_exl3_leaf_finish (the canonical reduction kernels) and removal of a stale per-slot test, in the next push; a few shared-rank changes (rank frame telemetry phase, prompt_last, snapshot warnings) that we are checking are EXL3-only; and a published TP=1 vs TP=2 hash table on this exact head, which is not posted yet.

BlivionIaG and others added 14 commits November 20, 2026 07:44
Migrate the shared real-weight layer oracle to the MTP-aware signature introduced by this slice.
The two-rank EXL3 exchange keeps each rank's subtree partials as 8-byte doubles: the gather buffer, per-rank offsets and the finish's stride count doubles, the all-gather is a typed FP64 NCCL copy (no rounding or reduction), and the root output stays f32. Adds the family collective's gatherF64 and bit-exact transport and partition regressions.
--
2.54.0 (Apple Git-157)
--
2.43.0
--
2.54.0 (Apple Git-157)
--
2.43.0
@AIFlowML

Copy link
Copy Markdown
Contributor

I checked the TP and MTP layer at a7642cc7 in a scratch merge with 37fa51d23. The five overlap paths resolve by keeping main's explicit-rank refusal, the EXL3 test dispatch entries beside main's readout dispatch, and the affected serving pins from the resolved tree. The environment test initially failed with two TF_FLASHNEXT_SHARD_HEAD entries. Keeping main's single Flash Next entry restored the expected refusal text.

zig build test-environment-host test-flashnext-exl3-host test-gradient-serving check-native-cuda-host -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j3 --summary all
zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dcpu=baseline -Doptimize=ReleaseSafe -j2 --summary all

Both exited 0 on M5 Max with Zig 0.17.0. All 136 tests passed, and both Linux ARM64 CUDA executables compiled. The TP=2 device and final train runs remain open.

Igor Lessio - AIFLOW LABS

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants