Skip to content

DeepSeek-V4.1-1017: experimental TCP MoE partitions and parallel attention - #1061

Closed
cwschroeder wants to merge 184 commits into
ashhart:mainfrom
cwschroeder:feat/ds1017-tp2-integration
Closed

cwschroeder wants to merge 184 commits into
ashhart:mainfrom
cwschroeder:feat/ds1017-tp2-integration

Conversation

@cwschroeder

@cwschroeder cwschroeder commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This adds opt-in parallel sparse attention and a second experimental two-Mac MoE partition for DeepSeek-V4.1-Flash-1017 EXL3 with SSD Engram. The current TCP pair remains slower than one Mac. The branch is based on upstream d1018b318fb51981c4a18f12e40269a4d3ee9713 and preserves its backend-neutral family files. The Metal path reads the shared configuration through a validated f32/slice view; its GPU loader, model and cache have separate capability files.

On two M3 Ultra Macs with 256 GB each, runtime cdfa5203 measured:

Configuration Decode forwards/s Repetitions
One Mac, parallel attention 4.8619 Median of 3 on the second Mac
TCP pair, MoE output columns 3.0992 1 per rank
TCP pair, whole routed slots 3.6003 Median of 3 per rank

Each generation has 128 completion tokens but 127 decode forwards. The routed-slot partition improves this TCP decode sample by about 16% over output columns, while both ranks still hold the complete backbone and attention. It provides no RAM reduction. The pair uses ordinary TCP over the TB5 interfaces, with both data and ACK sockets observed on bridge0/en3; it does not open an RDMA device.

TF_DSV41_PARALLEL_ATTENTION=1 scores independent keys and output dimensions concurrently while preserving each reduction order. The earlier attention-only prototype 61ab890f increased the single-Mac three-run median from 4.0519 to 4.8595 forwards/s. The current runtime repeats that result with the explicit 256-thread reservation. The separate teacher prefill in the earlier prototype became slightly slower, so this is not a claim that every workload improves.

TF_DSV41_TP_SLOTS=1 assigns slots 0/2/4 to rank 0 and 1/3/5 to rank 1, duplicates the shared expert, exchanges completed routed rows once per layer and restores the original six-slot combine order. Measured generation exchanges fall from 15,489 to 5,249, corresponding to 121 versus 41 per forward plus startup identity. Both switches default to the predecessor paths and must agree across the pair.

All six routed-slot generation token files match the frozen original. Teacher268 logits match the original SHA on both ranks with both partitions. One-token teacher chunks match the same original logits on both ranks. The interleaved two-lane test ends at positions 134/134 with zero bit disagreements against solo execution. All model phases pass their execution I/O gate, with zero page-ins. Both original Qwen services reply 4 after restoration; the original reranker returns the correct synthetic ordering. Test processes, ports and locks are clear.

Validation completed locally uses Zig 0.17.0 and -Dcpu=apple_m3. Both Macs pass the DeepSeek GPU, EXL3 GPU, reference and planted numerical control tests. The new attention passes its kernel-contract gates and actual M3 launch limits. The global limits check remains red with twelve missing M1/M2 Flash-Next declarations, reproduced on the unchanged upstream base with matching findings. Linux runs every applicable No GPU workflow command and Lean successfully; the full Zig format check and all five original encoding/template fixtures pass.

The complete desktop suite is 819/821 on both candidate and unchanged base, with the same sandbox-Git assertion and settings child timeout; their app trees are identical. Typecheck, mobile verification and whitespace pass on both. These local failures remain open findings. Remote CI is pending on the updated head and is separate from the local results above.

This stays a draft. Whole-model FP64/noise-floor qualification, the original-checkpoint anchor matrix, MTP, long context and full Rust-normalizer parity remain open under #847. The new native binary builds, but its HTTP serving behavior has not been requalified at cdfa5203; the existing native HTTP/cancellation/peer-loss receipts belong to b27e39af. Native Metal serving retains the explicit TF_EXPERIMENTAL=deepseek admission gate. No merge or production binary promotion is part of this patch.

Pinned data: current runner and slot receipts, earlier attention comparison, and historical native HTTP receipt.

ashhart and others added 30 commits October 18, 2026 21:33
Credit: @ZackSample; @philip-pentatonic; @akol1; @BobClawblaw; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.

Carry the pocket-fit margin call-site correction from 4f76c16.

Co-authored-by: ashhart <71890694+ashhart@users.noreply.github.com>

Prepare the serving pin refresh, held until the Living Weights device gates pass on this candidate.

Update only the held CUDA image-export and qlinear hashes for the candidate without MiMo. These approvals remain conditional on the Living Weights device gates.

Keep the shipped 1.1.0 documentation and drafter route. Remove two empty lines at the native test import block so the rebased file remains below 600 lines.

Co-authored-by: ZackSample <134018356+ZackSample@users.noreply.github.com>
Co-authored-by: Philip Mossop <63354535+philip-pentatonic@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Co-authored-by: BobClawblaw <288991054+BobClawblaw@users.noreply.github.com>
Credit: @BobClawblaw; original CUDA family contributors; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.

Use the supplied nvcc 13.2 resource measurements for these pending launches; keep 13.0 unmeasured.

Co-authored-by: BobClawblaw <288991054+BobClawblaw@users.noreply.github.com>
Credit: @BobClawblaw; @cwschroeder; @sethforprivacy; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: BobClawblaw <288991054+BobClawblaw@users.noreply.github.com>
Co-authored-by: Christian Schröder <1188270+cwschroeder@users.noreply.github.com>
Co-authored-by: Seth For Privacy <40500387+sethforprivacy@users.noreply.github.com>
Credit: @BobClawblaw; original YaRN attribution; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: BobClawblaw <288991054+BobClawblaw@users.noreply.github.com>
Credit: @ashhart; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: @ashhart; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: TensorFold maintainers; inherited family 8 and ashhart#978 credits retained. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: BobClawblaw <288991054+BobClawblaw@users.noreply.github.com>
Credit: TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Credit: @jayleaton; @akol1; Turboderp; MiaAI-Lab; BobClawblaw; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.

Use the supplied nvcc 13.2 resource measurements for these pending launches; keep 13.0 unmeasured.

Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Co-authored-by: MiaAI-Lab <83042094+MiaAI-Lab@users.noreply.github.com>
Co-authored-by: BobClawblaw <288991054+BobClawblaw@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.

Remove source line information from release CUDA images and reject private paths before packaging.

Refuse symlinks in release staging and inspect finished archive metadata and contents before publication.

Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton for the chain; @akol1 for shared config, math and state; common EXL3 retains Turboderp and landed prompt attribution; maintainer integration and regressions. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Retain the resolveBase split used by DeepSeek and the six training image exports used by Living Weights and the live contract runner. Move MiMo-only kernels, compatibility views and geometric depth to the separate MiMo track.

Credit: @ajensenwaud; @jayleaton; shared EXL3 and common copy-source authors; TensorFold maintainers. Original MiMo source commits and credit remain in the separate track.
Co-authored-by: Anders Jensen-Waud <5827908+ajensenwaud@users.noreply.github.com>
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Kolibri needs generic lane option forwarding. Without the MiMo adapter, reject policy on every CUDA family instead of accepting an ignored option.

Credit: @ajensenwaud; @jayleaton; shared EXL3 and common copy-source authors; TensorFold maintainers.
Co-authored-by: Anders Jensen-Waud <5827908+ajensenwaud@users.noreply.github.com>
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Credit: @jayleaton; @akol1; @ajensenwaud; Qwen served-contract authors; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Co-authored-by: Anders Jensen-Waud <5827908+ajensenwaud@users.noreply.github.com>
Credit: @jayleaton; @akol1; common EXL3 contributors; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Credit: @jayleaton; @akol1; @ajensenwaud; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: jayleaton <58495321+jayleaton@users.noreply.github.com>
Co-authored-by: akol1 <15747200+akol1@users.noreply.github.com>
Co-authored-by: Anders Jensen-Waud <5827908+ajensenwaud@users.noreply.github.com>
Credit: @jschmied; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: Jürgen Schmied <600316+jschmied@users.noreply.github.com>
Credit: @jschmied; TensorFold maintainers. Maintained release composition preserves the reviewed feature and its controls.
Co-authored-by: Jürgen Schmied <600316+jschmied@users.noreply.github.com>
cwschroeder and others added 27 commits October 19, 2026 02:51
Keep whole-prompt batching available while stepped serving returns fresh requests to the filling queue. Exercise the production capabilities through the real worker and clarify the equal-precision prompt reduction policy from ashhart#1014.
The Mac app keeps beta 8's download queue, previews, comparisons and benchmarks, and gains 1.1.1's Hub checks: one validated HTTPS endpoint for checks and downloads, fake-IP admission for that endpoint only, and classified failures. The README is main's, with 1.1.1's version, prompt-seed flag, credit and Kolibri-1 row.

Tests that supply their own child environment keep it live for the fake engine's settings, with the Hub origin still pinned and the token still stripped; two component tests list the shared Hub-failure module, and the Hub test accepts a pull the queue reports as queued.
The cluster-node test certificate cleared only the sign bit of its random 16-byte serial, so about one serial in 256 began with a zero byte that DER forbids, and OpenSSL refused the certificate with illegal padding. bounds.test.ts failed that way on CI at 47ea1bb. The first byte is now always 0x40 to 0x7f: 0 of 20,000 generated certificates refused, against 9 of 4,000 before.
@cwschroeder cwschroeder changed the title DeepSeek-V4.1-1017: experimental two-Mac MoE partition with SSD Engram DeepSeek-V4.1-1017: experimental TCP MoE partitions and parallel attention Oct 19, 2026
@cwschroeder

Copy link
Copy Markdown
Contributor Author

Closing this draft. The two-Mac partition decodes slower than one Mac: 3.60 against 4.86 forwards/s.

What the receipts measure:

  • Wall time minus GPU time is 5.6 s for 127 forwards, about 44 ms a token. Each token waits for 41 TCP exchanges, and nettop shows a 1.0 to 1.2 ms round trip on the link.
  • GPU time per rank rose from 25.4 to 29.7 s, although each rank computes only half the routed slots.

What we suspect but have not isolated: the code drains the command buffer twice per layer, once so the CPU can pick slots from the router output and once before the exchange. We do not yet know how much of the GPU gap that explains. A faster link alone would leave that gap.

We will rework the pair on our fork after speed-up mode's pattern (one command buffer, GPU-posted sequences and polled flags over MCDMA), and come back only with a receipt that beats one Mac.

The parallel sparse attention, the bit-identical part that gained speed, is now its own PR onto the family line: akol1#4. The receipts here stay pinned at 8c6e65ac.

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.

5 participants