Repository navigation
Conversation
…nsenova_loop Physical layers keep one weight copy; each execution owns its delta-net or KV slot (42 + 14 for SenseNova-Loop-9B). Plain Qwen checkpoints get the identity schedule. Drafting, learning, pockets and stages are refused for loop models. Refs ashhart#3717
… leave) with host reference and contract cases Refs ashhart#3717
Route, plain norm, mixer, merge around both halves of layers 4..27; streams enter at each pass's first layer and leave at its last. FP32 dt_bias rounds to BF16 at load, as the reference holds it. Execution counts are cached in the geometry. Refs ashhart#3717
…the reviewed launch sequence qwen35_learn and the qwen35 GPU test mains pass null loops. kernels.zig registers the qwen35_mhc image. The launch sequence's three norm add flags come from the schedule's decision, main's values on the plain schedule.
Other backends decide their own drafting for this model type.
…iterations and pre_scale Accept loop_settings.use_gate absent or false, ignore unknown loop_settings keys, and no longer require layer_types. Streams 4 parses but is refused at admission, as are fixed_identity and more than 1000 iterations. The route kernel takes the Sinkhorn iteration count and pre_scale (defaults 20 and 1.0, the default path unchanged). A shared case table, zig/tests/fixtures/sensenova_loop_config.json, runs through the CUDA reader and admission.
…al does The route kernel takes pre_scale as an f32. A positive f64 such as 1e-50 passed the reader and the finite check, then ran as 0. Admission now refuses it with UnsupportedSenseNovaMhc, matching ashhart#3859's reader. Two fixture cases: 1e-30 (a normal f32) accepts, 1e-50 is refused at admission.
--drafter mtp serves SenseNova-Loop-9B's own mtp.safetensors (or an mtp/ directory) through the Qwen MTP drafter: a dense BF16 layer packed in the target's lane format, fed the last layer's final-normed hidden (the draft's main_norm when it ships one). The Loop engine taps only layers its schedule runs once; verification and rollback use the per-execution delta-net and KV slots. DFlash2 and DSpine drafts stay refused for this model type.
123bbd4 to
497cfed
Compare
|
On exact head I also checked the stated #3723 dependency against main Igor Lessio - AIFLOW LABS |
With
--drafter mtp, SenseNova-Loop-9B on CUDA drafts with its own MTP head. Greedy output equals plain decoding token for token on #3723's 11 prompts (alone, at 4 concurrent streams and on a resumed chat). Forced rejections at every draft depth leave the state clean. Decode goes from 25.9 to 59.2 tok/s at one stream on code and from 100.3 to 216.0 tok/s aggregate at 4 streams. Qwen3.6 MTP samples matchmain; decode results are below.What this changes
serve <SenseNova-Loop-9B> --backend cuda --drafter mtploads the checkpoint'smtp.safetensorsand drafts with it. Before this, every drafter was refused forsensenova_loop.Draft layer: the qwen3_5 MTP drafter gains a dense BF16 variant. Projections are packed in the target's BF16 lane format, the MLP is dense SiLU, and the target's embedding and
lm_headare shared. RMSNorms keep HF's1 + win FP32 throughnorm_shift; only the q/k head norms are stored pre-shifted (BF16 RNE). No kernel is new or changed.Draft input: each absorbed row is the last layer's residual through the final norm, the row the head reads. mHC streams have already merged at the end of the 4–27 pass, and layer 31 runs once. The AWQ repo's
mtp/copy also shipsmtp.main_norm.weight. It equals the BF16model.language_model.norm.weightbit for bit, and the drafter uses it in place of the target's final norm when present.Taps through the schedule: the Loop engine accepts a drafter tap only on a physical layer that the schedule executes once (
loop_schedule.once); a repeated layer is refused (LoopTapRepeated).Verification and rollback: these need no new code. Windows record and restore the per-execution slots (42 delta-net and 14 KV) that qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723 sized; this PR is the first to exercise them with multi-row draft windows.
Discovery:
--drafter mtpmeans the target's own folder, which holds<dir>/mtp.safetensorsor<dir>/mtp/*.safetensors. A path to either layout also works.Still refused for this model type: DFlash2 and DSpine drafts (no released weights),
--mtp-drafts,--mtp-confidence, draft trees, copy drafts,--drafter-bitsother than 4 or 0, vision, learning and pipeline stages.Issue: Fixes SenseNova-Loop-9B (sensenova_loop) MTP speculative decoding on CUDA #3858
Stacked on: qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723 (head
c1ec09679, on main11a0de0cf). This adds one commit,497cfed9d. I will rebase it once qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723 lands.atc overlap --json(ATC 0.9.6) on123bbd474(from the previous head):8cbef9777: 4 PRs conflict (CUDA: #1764's BF16 prompt tile for Qwen ModelOpt, Nemotron and Dory, plus two exact Qwen prompt kernels (#1762) #2008, MiMo-V2.6-Flash on CUDA (2x GB10) with DFlash as the drafter #728, lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508, Nemotron 3.5 Transcribe: audio input, the 65,536-token window, an hour of audio, MTP drafts #1632), all incomplete (otherPullRequestsLimit,pullFilesUnavailable,timeLimit). Every conflict file except one comes from qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723's append points. The exception iszig/build/server.zigagainst CUDA: #1764's BF16 prompt tile for Qwen ModelOpt, Nemotron and Dory, plus two exact Qwen prompt kernels (#1762) #2008: the test-step line added here sits at the same append point, and whichever lands second keeps both lines.git merge-treeof this head and of qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723's head against all 109 open PRs that share a file with this commit (or list 100+ files), counting only conflicts this commit adds. 97 add none.zig/build/server.zig, orzig/tests/cuda/main.zigfor EXL3 Flash Next on CUDA: one rank, offloaded experts, sm_120 gate (1/8) #1441 and EXL3 Flash Next: expert-parallel TP=2 (same tokens as TP=1) and MTP drafts (2/8) #1442); whichever lands second keeps both lines.cuda_mtp.zig,cuda_mtp_absorb.zig,cuda_mtp_batch.zig,cuda_mtp_weights.zig,cuda_drafter_open.zigandcuda_drafted.zig, because both add a dense-MLP arm to the same drafter.mtp.safetensors, which is not in the model index.main_norm, side-file discovery and the Loop refusals.TF_QWEN35_CHUNK_SOLO=8192, solo prompt passes for Qwen 3.5/3.6/3.8 #3294 changes the tap-ring row count read incuda_mtp_absorb.zig, next to the line this PR changes (the final-norm call); the resolution keeps both.Checks on this head
497cfed9d, tested as is. It is the previousc81b1f949rebased onto the new qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723 head; the only conflict was main'sengine.tap_rowsbecominge.tapRows()next to this PR'stapNorm, andsetTapsfolds the Loop tap check into the existing loop line socuda_engine.zigstays at 600 lines.zig build test-cuda-host: pass, exceptcuda.stager"every byte lands where the mapping would have put it" on my machine, which coincides with a Btrfs checksum error on its O_DIRECT temp file; it passes in CI and this PR does not touch the stager.test-gradient-serving,test-qwen-serving-hostandtest-serve-drafter-host: pass.test-qwen35-loop-host: pass.dense_serving_test.ziglaunch-sequence hash and the gradient-serving pins are unchanged and pass.zig build native -Dsm=120 -Dnative-fp-decode=trueandcompile-cuda-testspass.tf-cuda-test qwen-loop-mtp(needsTF_LOOP9B_DIR;TF_LOOP9B_MTPdefaults to it) passes on SM120.497cfed9d: all 9 jobs pass.Receipt
Main against branch: Qwen3.6-35B-A3B MTP, main
11a0de0cfagainst this head, alternated main/head/main/head (table below). Loop-9B plain against--drafter mtpis on the same binary, because main cannot serve this model.Boxes it reaches: CUDA qwen3_5 MTP drafting (dense Loop and MoE Qwen3.6), the Loop tap rule, server
--drafterselection.New switch: none.
--drafter mtpis a new value of an existing flag, forsensenova_loopon CUDA only, and it is off unless given.Environment:
497cfed9d, Zig 0.17.0, nvcc 13.4.sensenova/SenseNova-Loop-9Bat329a65f7, plusmtp.safetensors(sha2563b84d5143ad5c97cbeffb4ffe9d2db9f620e3cbbfa334f987a04a3cb902d08a6), Apache-2.0.TensorFold/Qwen3.6-35B-A3B-MLX-4bit-MTPatf84b054c.Paths run: decode at 1 and 4 streams, greedy and sampled; prompt-cache resume; forced rejection at depths 0–2. Not run: other SMs.
Losslessness (Loop-9B):
--context 8192 --prompt-cache-gib 0, 256 tokens or to EOS, raw token IDs through/v1/completions.--drafter mtpat--parallel 1, and 11/11 identical with the 11 sent 4 at a time at--parallel 4.Resume: a two-turn chat of 6907 then 6970 prompt tokens, served with
--drafter mtpand the prompt cache on. Turn 2 resumes at 4096 cached tokens, and both turns equal plain decoding with--prompt-cache-gib 0.Rollback (
tf-cuda-test qwen-loop-mtp): a wrapper replaces draft k of every round with a token the target cannot pick and keeps drafts 0..k−1 as proposed. In every run, all 64 tokens equal plain, and a fresh stream afterwards equals its plain reference.Exactness (
bench_concurrent.py --alone --serial, levels 1 and 4, greedy and sampled with fixed seeds): equal throughout with and without the drafter: alone 2/2 and 8/8 per prompt; serial against"draft": false1/1 greedy and 4/4 sampled.Acceptance (11 prompts, depth 3): 863 of 1603 drafts accepted (53.8%), 1.56 accepted drafts and 2.57 tokens per round; at 4 streams, 864 of 1613 accepted (53.6%) and 2.56 tokens per round.
Decode, Loop-9B (tok/s,
bench_concurrent.pyaggregate; separatebench_openai.py1-stream medians are not identical):--drafter mtpMemory and load: not rerun.
Qwen3.6-35B-A3B MTP, main against branch (
--context 8192 --parallel 4 --prompt-cache-gib 0 --drafter <its folder>;bench_openai.pydecode medians at 1 stream,bench_concurrent.pyaggregates at 4):--alone --serialis equal on every run.Welch tests compare main and head repetitions pooled across both runs: n=6 per side at 1 stream and n=2 per side at 4 streams.
Prompt speed: n/a. Prompt processing is unchanged; drafting starts after the prompt. Cold TTFT is in qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723.
Licence:
mtp.safetensorsis part ofsensenova/SenseNova-Loop-9B, Apache-2.0.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.1 + wexcept the q/k head norms (BF16 RNE pre-shift, draft-only).--drafter, no slower than without it, greedy and sampled. Prompt speed was not rerun.