Repository navigation
qwen27 metal: draft SenseNova-Loop-9B with published mtp.safetensors (MTP) - #3868
Conversation
7bac710 to
cd992f1
Compare
|
Thanks @gilby for the MTP implementation and the direct BF16/AWQ evidence on this head. The targeted host suites, oracle checks, serial/single-request equality, and M5/M3 kernel-contract controls cover the new drafting and batched-round paths. The MTP increment reuses the parent stack's kernels rather than adding new ones. The remaining blocker is application to current main. The supplied diff has nine rejected hunks in Please rebase the stack while preserving both the current-main additions and the SenseNova MTP changes, then refresh the focused host checks and exactness evidence on the resulting head. The reviewed source otherwise has no remaining finding in this pass.
|
|
I checked exact head The important code hunk is prompt admission in On this PR head, Igor Lessio - AIFLOW LABS |
cd992f1 to
9d7f872
Compare
|
I rechecked the published tip The rebased stack carried by #4415 gives a smaller update path. Its MTP slice ends at The original published branch was the conflict check. The rebased slice was the host test. Checkpoint serving and token parity were outside this run. Igor Lessio - AIFLOW LABS |
9d7f872 to
f835eb8
Compare
|
The refreshed zig build test-qwen27 test-metal-residency-owners-host test-draft-metal-host \
-Dcpu=apple_m1 -j4 --summary allThe draft metadata suite hits the same Qwen27 assertion on main and on the trial. I isolated it to the fixture in This covers the revised host and residency paths. Checkpoint token parity and throughput remain device work. Igor Lessio - AIFLOW LABS |
f835eb8 to
31db111
Compare
|
Thanks @gilby for adding MTP drafting to SenseNova-Loop. One small fix:
|
|
Fixed in commit
Verified on this commit: |
|
Thanks @gilby. The fix on The overlaps with main are ours to sort out when we rebase.
|
c0653a7 to
3f83cb7
Compare
|
Thanks @gilby for bringing both onto main yourself. We read the range-diff against the head we reviewed. The conflict work folds main's tied-head opt-in into the parse options and widths, and keeps the stage-plane record on the default path. The rest is context and the 600-line split. This one is in our landing queue now, and #4415 follows once it lands.
|
ce83ff7 to
376697b
Compare
376697b to
1445a3a
Compare
1445a3a to
0351ce9
Compare
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
Main 881e224 added the prompt-tail slices retained by the rebase. Move the unchanged round fingerprint into its own module so the combined runner remains below 600 lines.
Main moved keysForward to prompt_tail.zig. This PR's copy passed the shifted norm and YaRN rope, so the moved one must too. Both default to the plain path, so other Qwen models are unchanged.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
… each with its own host field and tap slots Main's 4f8b193/090c9c4a9 line serves Qwen3.8-27B's MTP head under --mtp-drafts (Host.mtp: qwen27_mtp.zig's Mtp, its taps through qwen27_features.zig's prepare and rows in the lane backend's table). This PR's head for SenseNova-Loop came with a Host.mtp of its own type and the same two table slots, plus prefill_features. - qwen27_served: the PR's head is Host.sn_mtp; it loads only when --mtp-drafts is off (so at most one head drafts), sets the backend's sn_features before its wrapper takes the backend's table, and frees as the PR placed it. - qwen27_lanes: Metal.sn_features picks the table. With it, the PR's slots (sensenova_features.zig's prefill_features, prepare_features and features); without it, main's table unchanged, so a Qwen3.8-27B prompt under --mtp-drafts keeps main's prompt pass (Drafted streams prompts through prefill_features whenever one is set). - residency: the PR's three resident-set lines name sn_mtp, the type whose buffers they add. Main's Qwen3.8-27B MTP, DFlash2 and plain paths keep main's code; SenseNova-Loop's keeps the PR's.
…main Main's growth beside this series' SenseNova-Loop lane changes put the file at 605 lines. The tail encoder's choice becomes one if/else line and the argmax tail's body one call; no behaviour changes.
…s solo prompt rows attention.zig, attention_plan.zig, decode_round.zig and qwen27_slots.zig now carry main's solo prompt rows with this stack's SenseNova-Loop changes; their pins are regenerated from the merged files, main's notes kept.
0351ce9 to
4164b9b
Compare
|
Thank you @gilby. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
… pinned main's slots; this PR adds rank 1's begin and the chunked-pass announce, hash refreshed with provenance)
… pinned main's slots; this PR adds rank 1's begin and the chunked-pass announce, hash refreshed with provenance)
What this changes
Adds native Multi-Token Prediction (
MTP) speculative drafting on Metal for SenseNova-Loop-9B using the checkpoint's publishedmtp.safetensorshead (TF_MTP_DRAFTS,TF_MTP_BITS,TF_MTP_PLAIN_GUARD), fusing drafter prompt absorb and hold rounds (draft_round), usingkeysOnlyintermediate prompt-chunk absorb, and batching active streams (sn_mtp_batch) with identical token output (token_sha) to--no-drafts.Rebased onto
#3859(b61c6f90b3) and resolvedzig/src/native/qwen27_served.zigcleanly by preserving#3859'sq.simd_attention.sharedPrefix(model.device.tensorUnits())memory sizing while threadingo.mtp_dir,mtp_ring,tap_count = 1,lanes.drafted.Drafted, andTF_MTP_*options; added9d7f872be9(@hasField(@TypeOf(h.*), "mtp")) inzig/src/families/qwen27/residency.zigso shared residency tests compile cleanly.b61c6f90b3), adding commitsbd9e59baa2,f7ee1b961d,6c654a14ff,a6aa74047b, and9d7f872be9(24changed files).atc overlap --json: Timed out after 10s (TIMEOUT 10s); manual diff audit against#3859resolvedzig/src/native/qwen27_served.zig(sharedPrefix+ MTP tap/ring budgeting),docs/environment.md,zig/src/platform/environment.zig,zig/src/platform/environment_test.zig, andCHANGELOG.md.Checks on this head
9d7f872be9e73c777c5aaa75913eb29be1814a6cpython3 tools/zig/lean_check.py, on the base and on this head:b61c6f90b3(7380files,167problems) ->9d7f872be9(7387files,167problems),0 new(tools/zig/lean_new.pyandtools/pr_check.py --base b61c6f90b3 --pr 3868:0 error(s), 0 warning(s)).zig fmt --checkandgit diff --check b61c6f90b3..HEAD: passed.zig build -j6 dev-tools native -Dcpu=apple_m1: exited0.zig build -j6 test-metal-residency-owners-host -Dcpu=apple_m1on9d7f872be9:76/78passed (remaining2crashes are pre-existing upstream1b394565ccGLMe.dflashundefined field).9d7f872be9(a6aa74047b:36/39steps passed includingtest-golden324/337+69/69,test-metal-launch-map-host1163 registered launches, 2 controls, 0 missing,test-qwen27,test-kernel-contract);9d7f872be9only changed the@hasFieldguard inzig/src/families/qwen27/residency.zigand re-runs full host CI upon push.9d7f872be9(SenseNova-Loop-9B-AWQ-g128,--parallel 4 --context 36864 --prompt-cache-gib 0,TF_MTP_BITS=4 TF_MTP_DRAFTS=3 TF_MTP_PLAIN_GUARD=1) acrossApple M5 Ultra(bench_openai.py,bench_concurrent.py --alone --serial8/8cells0failed/0unmeasured/0unequal,bench_cache.py --require-cold) andApple M5 Pro(bench_openai.py&bench_cache.py --require-cold): passed (see Receipt below).9d7f872be9(pr-3868-rebased).tf-sensenova-oraclewas not re-run after rebase onto#3859(No GPUCI runs full host checks; stacked PRs validateq27/sensenovatf-kernel-contracton Apple M3 Ultra and Apple M5 Max).Receipt
SenseNova-Loop-9B-AWQ-g128,9d7f872be9,--parallel 4 --context 36864 --prompt-cache-gib 0,TF_MTP_BITS=4 TF_MTP_DRAFTS=3 TF_MTP_PLAIN_GUARD=1): startupinfo: sensenova mtp: bits=4 depth=3 abs_rows=2048 step_ms=1.86 plain_guard=true slot_bytes=151101504;drafts: MTP + copies(18.8 GiBvs--no-drafts14.9 GiB).tools/bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone --serial:0failed,0unmeasured,0unequal across all8cells (alone2/2atc=1and8/8atc=4;serial1/1atT=0and4/4atT=1.0;plain_drafted: 0,vacuous: none):code T=0:c=1 121.2 tok/s(tok/chunk 2.844,sha=339b36c97870),c=4 agg 342.8 tok/s(per 92.4,steady 388.6,accepted 83)chat T=0:c=1 80.4 tok/s(tok/chunk 1.882,sha=791252c1c8f1),c=4 agg 239.3 tok/s(per 63.8,steady 273.2,accepted 60)code T=1.0:c=1 109.3 tok/s(tok/chunk 2.51),c=4 agg 294.4 tok/s(per 79.5,steady 349.4,accepted 310)chat T=1.0:c=1 85.8 tok/s(tok/chunk 2.0),c=4 agg 237.5 tok/s(per 68.9,steady 283.8,accepted 252)64 GiB,macOS 27.2.1,SenseNova-Loop-9B-AWQ-g128,9d7f872be9):bench_cache.py --require-cold(2,571prompt tok,qualified=True,token_sha=eaa68149fc60, first TTFT3.421s, rep[3.330, 3.348]s, decode50.34 / 48.45 / 48.75 tok/s);bench_openai.pyfibT=0.0 50.75 tok/s(sha=2f1d93533424),T=1.0 47.93 tok/s,chatT=0.0 35.67 tok/s(sha=c011df2b114c),T=1.0 36.93 tok/s.qwen27lane backend on M-series Macs).TF_MTP_DRAFTS: wholeu32clamped to1..window-1(0clamps to1), unset defaults to3on SenseNova-Loop MTP.TF_MTP_PLAIN_GUARD:0or1, unset/blank defaults to1.TF_MTP_BITS:4or16, unset/blank defaults to4(target verification always runs in checkpoint weights).9d7f872be9e73c777c5aaa75913eb29be1814a6c, Zig0.17.0, Apple M5 Ultra & Apple M5 Pro (64 GiB,macOS 27.2.1),SenseNova-Loop-9B-AWQ-g128(sensenova/SenseNova-Loop-9Bderivative).qwen27serving, MTP speculative drafting, and shared residency helpers (macOS host checks plus Apple M5 Ultra and Apple M5 Pro serving receipts completed; non-Metal backends untouched).tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false:tools/bench_openai.py --tokens 256 --reps 3(--no-draftsvs MTP on Apple M5 Ultra): all12/12token_shaandoutput_sha256pairs identical (fibonacci-raw T=0.0:2f333243860dx3;fibonacci-raw T=1.0:['1a0e8659a9ca', '1ecfdd251491', 'bfdf5c973665'];gpu-chat-no-think T=0.0:deb79c46255ax3;gpu-chat-no-think T=1.0:['650226c66939', 'e63d8ce93536', 'bb2767d5fc07']).tools/bench_concurrent.py:0unequal across all8cells (alone2/2atc=1,8/8atc=4;serial1/1atT=0,4/4atT=1.0).tools/bench_cache.py --require-cold: identicaltoken_sha=eaa68149fc60across--no-draftsand MTP (cached_tokens=0cold on all5rows).--no-drafts(baseline#3859behavior) vs MTP comparison onSenseNova-Loop-9B-AWQ-g128(9d7f872be9) above.tools/bench_openai.py:SenseNova-Loop-9B-AWQ-g128,--tokens 256 --reps 3,--no-drafts-> MTP):fibonacci-rawT=0.0:54.46 -> 117.51 tok/s(2.16x,tok/chunk 2.783,ttft 0.0580s -> 0.0608s)fibonacci-rawT=1.0:54.97 -> 114.04 tok/s(2.07x,tok/chunk 2.667,ttft 0.0614s -> 0.0592s)gpu-chat-no-think(thinking=off)T=0.0:54.32 -> 82.58 tok/s(1.52x,tok/chunk 1.954,ttft 0.0578s -> 0.0583s)gpu-chat-no-think(thinking=off)T=1.0:55.59 -> 79.48 tok/s(1.43x,tok/chunk 1.855,ttft 0.0608s -> 0.0600s)SenseNova-Loop-9B-AWQ-g128, MTP):fibT=0.0 50.75 tok/s(T=1.0 47.93),chatT=0.0 35.67 tok/s(T=1.0 36.93).ttft_sfromtools/bench_cache.py --require-coldon a long prompt, or "n/a" with the reason when the change cannot reach prompt processing:SenseNova-Loop-9B-AWQ-g128,2,571prompt tokens,tokens=64,repeats=2,streams=2,cached_tokens=0cold on all5rows):--no-drafts:qualified: true,firstttft 0.9855s(decode 53.94 tok/s),repeated0.9328s / 0.9332s(decode 53.88 / 53.94 tok/s)qualified: true,firstttft 1.0012s(decode 105.63 tok/s),repeated0.9527s / 0.9566s(decode 105.47 / 106.01 tok/s)SenseNova-Loop-9B-AWQ-g128, MTP):firstttft 3.421s,repeated3.330s / 3.348s(qualified: true).sensenova/SenseNova-Loop-9Bpublishedmtp.safetensors).Checklist
The title and description match the head commit, including the receipt and the stack.
New tests fail before the change, pass after it, and skip cleanly without their dependency.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
Drafted output equals
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.No precision traded for speed. If the bits change, the description says which sums change and why.
Decode and prompt processing are no slower than main at one stream and the widest admitted; with
--drafter, no slower than without it, greedy and sampled