[PR #3908] [Engine] qwen35: MTP drafting for sampled requests (--mtp-sampled, --spec-min-p, --sample-gpu) #4825

Open
opened 2026-11-07 15:39:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3908
Author: @xyehya
Created: 10/24/2026
Status: 🔄 Open

Base: main ← Head: pr/q36-07-mtp-sampled


📝 Commits (10+)

  • 1883224 [Engine] qwen35: accept Q4_K down-projection experts
  • 9903b66 [Engine] qwen35: a parity case for the Q4_K down experts at FF 512
  • aab82b7 [Engine] qwen35: --kv int8 for the qwen35moe engine, and --tokens-file
  • 0a2b727 [Engine] qwen35: grouped-query decode attention (#3641's kernel), --kv fp16 and k8v4
  • 73ba60e [Engine] qwen35: int8 decode attention reads the cache through shared memory, one pass per verify window
  • efb3066 [Engine] qwen35: --attn-mma, decode attention on tensor cores for the int8 cache (not bit-identical)
  • 6e21c89 [Engine] qwen35: --fused-prompt-attn, the prompt attention in one tensor-core kernel from the int8 cache
  • 022982d [Engine] qwen35: --chunked-gdn, the prompt's gated delta rule in pieces of 16 tokens
  • a3c2dc4 [Engine] qwen35: k_add_rms_q and k_moe_out in registers with a one-barrier same-order sum
  • 9017b2f [Engine] qwen35: --side-stream: z, alpha / beta (and the attention k, v) on a stream beside the first matrix

📊 Changes

19 files changed (+5869 additions, -240 deletions)

View changed files

📝 CMakeLists.txt (+39 -0)
📝 docs/QWEN36.md (+225 -3)
📝 include/strata/kernels/cpu/pool.hpp (+40 -1)
📝 setup.py (+2 -2)
📝 src/kernels/cpu/pool.cpp (+170 -37)
➕ src/kernels/cpu/pool_warm_test.cpp (+88 -0)
📝 src/kernels/cuda/iq_kernels.cu (+3 -3)
📝 src/kernels/native_expert_parity.cpp (+7 -2)
➕ src/qwen35/q36_attn.cuh (+890 -0)
📝 src/qwen35/q36_engine.cu (+1822 -188)
➕ src/qwen35/q36_gdn.cuh (+258 -0)
📝 src/qwen35/q36_kernels.cuh (+113 -4)
➕ src/qwen35/q36_pattn.cuh (+297 -0)
➕ src/qwen35/q36_sampling.hpp (+320 -0)
➕ src/qwen35/q36_sampling_test.cpp (+473 -0)
➕ tools/qwen35/q36_attn_parity.cu (+500 -0)
➕ tools/qwen35/q36_gdn_parity.cu (+199 -0)
➕ tools/qwen35/q36_pattn_parity.cu (+240 -0)
➕ tools/qwen35/q36_spec_sampled.py (+183 -0)

📄 Description

Series (each stacked on the one before; review in order): #3699 → #3903 → #3904 → #3905 → #3906 → #3907 → #3908 → #3909 → #3910. Scope discussion: #3700. This is 7 of 9; it builds on #3907.

Branch pr/q36-07-mtp-sampled, stacked on pr/q36-06-pool-warm.

Problem and result

On the Qwen3.6 engine path only a strictly greedy request drafts with the MTP block. A request with a temperature above 0 or a repeat / frequency / presence penalty decodes one token at a time even with --mtp 2. That includes every request that names no sampling, because the server fills in the model card's sampling (#3354: drafts accepted 0 of 0, 73-88 tok/s where the same machine reaches about 150 with drafts).

  • --mtp-sampled match | q: sampled requests draft too. match drafts the block's greedy pick and keeps each window row's token exactly as a plain decode step would sample it (same seed, same text as without drafts, up to a near tie in the last bits). q samples the drafts from the block's own distribution and keeps them by the speculative-sampling rule; the text is a sample of the same distribution, not the same text.
  • --spec-min-p P (the main path's name): end a step's drafts at the first one the block is less sure of than P.
  • --sample-gpu: a sampled row comes to the host as a shortlist of the K highest logits (K = top_k + the ids the penalties touch, at most 160) instead of 1 MB of logits.

Result on an RTX 5080 16 GB (same day, --max-context 262144, level 06 with its flags against this level; runs in Validation). Sampled requests (temperature 0.7, top-p 0.95, top-k 20, seeds 1 to 4, 256 tokens each, through --serve), tok/s:

  • --sample-gpu alone: 232.1 -> 244.1 (+5.2%) at a 4K prompt, 210.1 -> 218.2 (+3.8%) at 40K.
  • With --mtp 2 --spec-min-p 0.5 --mtp-sampled q --sample-gpu: 282.6 (+21.8%) at 4K and 240.6 (+14.5%) at 40K, 67 to 75% of drafts accepted at 4K and 68 to 69% at 40K. The two 4K runs of this arm are 276.2 and 289.1, so it is noisier than the others (the seed changes the text and so the acceptance).
  • Greedy, free-running with --mtp 2: level 06 already drafts greedy requests (294.6 tok/s at 4K, 243.9 at 40K); this level with --spec-min-p 0.5 gives 298.3 and 249.7 (+1.3% / +2.4% over level 06). Against --mtp 0 that is +23% / +13%.
  • --mtp-sampled match was not measured.
  • #3354 (the problem above) and #3773 (baptisterajaut: the same match idea behind STRATA_Q36_MTP_SAMPLED=1, stacked on #3678). If #3773 lands first, --mtp-sampled match should keep its environment variable as an alias; I will rebase either way.
  • Existing opt-in sampled drafting of the main path (STRATA_SPEC_PROB, --coupled-draft, DETAILS.md "Sampled drafting"): different engine; the rule here reuses core/spec_prob.hpp, and STRATA_SPEC_MIN_TEMP is that path's variable.
  • The first commit of the branch (a penalty past a --draft-vocab row) is the separate fix 07a.
  • No scope issue; the flags are opt-in.

Approach

Flags off, the engine drafts for greedy requests only, as before. The sampler moves from q36_engine.cu to src/qwen35/q36_sampling.hpp (header-only) so a CPU test can check the rules without a GPU. The default sampled path is unchanged: the host's top-k keeps the comparator it had (lg[a] > lg[b]) unless --mtp-sampled or --sample-gpu is given; only then equal logits are ordered by the lower id (the shortlist kernel needs a total order, and match needs the plain steps and the window rows to sort alike). The one fix that does touch the default path, a penalty for a history id outside a --draft-vocab row that wrote past the row, is its own first commit and its own PR (07a, below). Greedy requests are untouched.
q36_sampling_test (CPU): sample() against a copy of the old function on 8,000 random rows (tie rule off and on; same token, same rng state); match gives the plain sampler's text seed for seed; match and q give the exact joint of four tokens against the chain (chi-square), also with --spec-min-p and over a --draft-vocab row; three deliberately wrong rules fail as controls; the shortlist gives the whole row's chain, token and rng state (27,291 cases, ties and penalties). tools/qwen35/q36_spec_sampled.py measures the rules on the real model.

Validation

Revision: branch pr/q36-07-mtp-sampled (66da263), level 06 below it, origin/main 5c8dd32. Environment: Fedora 44 (Linux 7.2.11), CUDA 13.4.92 with g++-15 as host compiler, RTX 5080 16 GB (driver 615.78.08), Core Ultra 9 285K, 61 GB DDR5, 6400 MT/s configured, Sage-A1.5 Q4_K_M with the BF16 ssm_alpha/ssm_beta graft (the file of #3699).

Passed:

  • Build CUDA sm_120 and "75;120" (commands as in the level-01 PR), targets strata q36_sampling_test and the earlier test tools.

  • q36_sampling_test: passed (GPU build tree; also built by hand with g++ -std=c++17 -Iinclude src/qwen35/q36_sampling_test.cpp and run: passed).

  • Greedy default path against level 01's binary, flags off, fixed 56 slots: logits cmp at 4K / 14K IDENTICAL / IDENTICAL; gate_a.sh against level 02's binary IDENTICAL / IDENTICAL.

  • Free-running slot count unchanged: 90 of 256 (fp32, 65K), 82 (int8, 262144).

  • The submitted revision 66da263 against the timed one (the revision before the last amend of the stack), full-logit cmp with the flags of level 07 on both sides (--sample-gpu on top of level 06's flags, fixed 56 slots, 4K and 14K): IDENTICAL / IDENTICAL (64,563,200 bytes each). This is a greedy compare; it says the timings hold for the submitted revision, not that sampling is unchanged.

Timing (same box and day, 2026-10-23; one cold strata process per run under the GPU lock; CLI runs alternated, two runs each, four for level 06 with --mtp 2, level 07 and the 4K greedy rows; serve runs two each; both binaries from the revisions before the last amend of the stack). <06 flags> = --kv int8 --gqa-attn --fused-prompt-attn --chunked-gdn --side-stream --split-stage-copy --expert-profile $PROFILE --expert-prefetch 2 --hybrid-zero-copy --decode-swaps 64 --async-swaps --lend-staging --pool-warm 3 --prefetch-copies 0 ($PROFILE is an expert profile saved from an agent session, not in the repository); 92 experts per layer in VRAM in every arm. Commands:

# greedy, free-running, 256 tokens (CLI)
level 06: strata --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <06 flags> --mtp 2 --tokens-file $P --n 256
level 07: strata --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <06 flags> --mtp-sampled q --sample-gpu --mtp 2 --spec-min-p 0.5 --tokens-file $P --n 256
# sampled, serve protocol: one engine, per depth 4 requests, the 2nd to 4th reuse the held prompt
strata --serve --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <06 flags> [--sample-gpu | --mtp-sampled q --sample-gpu --mtp 2 --spec-min-p 0.5]
GEN 256 temperature=0.7 top_p=0.95 top_k=20 seed=S <ids of the 4K or 40K prompt>      (S = 1..4)

(strata generate has no temperature option, so the sampled rows go through --serve.) Greedy, tok/s, individual runs, then the mean; "accepted" is the engine's own draft acceptance:

arm 4,096 accepted 40,960 accepted
level 06, --mtp 0 242.5 / 241.5 / 242.6 / 241.1 = 241.9 221.1 / 221 / 221.1 / 220.8 = 221.0
level 06, --mtp 2 296.1 / 293.2 = 294.6 (+21.8%) 67% 243.3 / 243.2 / 244.1 / 244.9 = 243.9 (+10.4%) 59.5%
level 07, --mtp 2 --spec-min-p 0.5 --mtp-sampled q --sample-gpu 296.3 / 299 / 299 / 298.9 = 298.3 (+23.3%) 83.8% 249.6 / 249.4 / 249.7 / 250 = 249.7 (+13.0%) 78.5%

(Changes against level 06 with --mtp 0.) Sampled, serve protocol, tok/s over the 4 seeds of one run, two runs per arm (per-seed values in the raw results):

arm 4,096 drafts accepted / offered 40,960 drafts accepted / offered
level 06, --mtp 0 232.7 / 231.5 = 232.1 210.2 / 210.1 = 210.1
level 07, --sample-gpu 244.6 / 243.6 = 244.1 (+5.2%) 218.4 / 217.9 = 218.2 (+3.8%)
level 07, --mtp 2 --spec-min-p 0.5 --mtp-sampled q --sample-gpu 276.2 / 289.1 = 282.6 (+21.8%) 520/774 (67%), 547/733 (75%) 238.5 / 242.6 = 240.6 (+14.5%) 529/776 (68%), 531/774 (69%)

The first pass of the level-06 --mtp 2 arm passed --spec-min-p, which level 06 does not have; it was re-run without it and only the re-run is shown.

Failed: none observed.

Not run:

  • Sampled default path against origin/main text for text on the real model (card sampling, fixed seed, flags off): the logits gate is greedy and does not cover it. q36_sampling_test covers sample() itself (above).
  • The distribution check of --mtp-sampled and --sample-gpu against off (q36_spec_sampled.py): the timing pass measured speed and acceptance only. --mtp-sampled match, --mtp 3 and above, a 16K prompt.
  • --batch slots with --mtp-sampled; vision.
  • HIP and SYCL builds (the new kernels k_cand_part / k_cand_merge are in q36_engine.cu; never compiled for HIP).

Limits

q needs top_k <= 64 and a temperature above 0 and at least STRATA_SPEC_MIN_TEMP; other sampled requests use match. --sample-gpu copies the whole row for a penalty that raises a logit or when K would pass 160. Measured on one model and one card.

Not specific to Sage-A1.5

Sage-A1.5 is a fine-tune of Qwen3.6-35B-A3B with the same architecture and tensor layout, so this path runs the base model
unchanged. The before/after numbers above are Sage-A1.5's. The base model was measured once, on my fork's build of the whole series
(xyehya/Strata branch q36-r2: these PRs' flags on, plus a few fork-only defaults), same card and server sweep, with
STRATA_Q8_PACKED=0 (that file keeps its attention and DeltaNet matrices in Q8_0, and the packed copy would take 1.9 GiB
from the expert slots): Unsloth's Qwen3.6-35B-A3B-UD-Q4_K_XL (from unsloth/Qwen3.6-35B-A3B-MTP-GGUF),
262K int8 cache, decode 221 / 208 / 199 / 187 / 164 / 159 tok/s and prompt read 6,473 / 7,010 / 6,277 / 4,656 / 3,411 /
2,506 tok/s at 4K / 16K / 40K / 90K / 160K / 240K (Sage-A1.5 on the same build: decode 231 / 210 / 213 / 187 / 179 / 162).
Not measured: this PR's own before/after on the base model.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3908 **Author:** [@xyehya](https://github.com/xyehya) **Created:** 10/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/q36-07-mtp-sampled` --- ### 📝 Commits (10+) - [`1883224`](https://github.com/Niko1221/Strata/commit/1883224f75d2f2fc29aa303e750c2918385f0af4) [Engine] qwen35: accept Q4_K down-projection experts - [`9903b66`](https://github.com/Niko1221/Strata/commit/9903b6609a29b699c088f78f29810d16458d45f8) [Engine] qwen35: a parity case for the Q4_K down experts at FF 512 - [`aab82b7`](https://github.com/Niko1221/Strata/commit/aab82b73b4a3c0be261c5432dc65d455ac216155) [Engine] qwen35: --kv int8 for the qwen35moe engine, and --tokens-file - [`0a2b727`](https://github.com/Niko1221/Strata/commit/0a2b72720c69800b811f8baea30fdfb4bb164ef3) [Engine] qwen35: grouped-query decode attention (#3641's kernel), --kv fp16 and k8v4 - [`73ba60e`](https://github.com/Niko1221/Strata/commit/73ba60e899f38d6698e9d857d04b7e08a3a4b54c) [Engine] qwen35: int8 decode attention reads the cache through shared memory, one pass per verify window - [`efb3066`](https://github.com/Niko1221/Strata/commit/efb3066fc0908c060cbccf749741d848381f2124) [Engine] qwen35: --attn-mma, decode attention on tensor cores for the int8 cache (not bit-identical) - [`6e21c89`](https://github.com/Niko1221/Strata/commit/6e21c895f215690eae1ae196b428e1090fcc1db9) [Engine] qwen35: --fused-prompt-attn, the prompt attention in one tensor-core kernel from the int8 cache - [`022982d`](https://github.com/Niko1221/Strata/commit/022982df36843763f7f43978bf3259d95a3948d0) [Engine] qwen35: --chunked-gdn, the prompt's gated delta rule in pieces of 16 tokens - [`a3c2dc4`](https://github.com/Niko1221/Strata/commit/a3c2dc4c8a7f9aaec120cd0594efe9893d4b95db) [Engine] qwen35: k_add_rms_q and k_moe_out in registers with a one-barrier same-order sum - [`9017b2f`](https://github.com/Niko1221/Strata/commit/9017b2fd45cea7a63e871a21c523d1065fe455eb) [Engine] qwen35: --side-stream: z, alpha / beta (and the attention k, v) on a stream beside the first matrix ### 📊 Changes **19 files changed** (+5869 additions, -240 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+39 -0) 📝 `docs/QWEN36.md` (+225 -3) 📝 `include/strata/kernels/cpu/pool.hpp` (+40 -1) 📝 `setup.py` (+2 -2) 📝 `src/kernels/cpu/pool.cpp` (+170 -37) ➕ `src/kernels/cpu/pool_warm_test.cpp` (+88 -0) 📝 `src/kernels/cuda/iq_kernels.cu` (+3 -3) 📝 `src/kernels/native_expert_parity.cpp` (+7 -2) ➕ `src/qwen35/q36_attn.cuh` (+890 -0) 📝 `src/qwen35/q36_engine.cu` (+1822 -188) ➕ `src/qwen35/q36_gdn.cuh` (+258 -0) 📝 `src/qwen35/q36_kernels.cuh` (+113 -4) ➕ `src/qwen35/q36_pattn.cuh` (+297 -0) ➕ `src/qwen35/q36_sampling.hpp` (+320 -0) ➕ `src/qwen35/q36_sampling_test.cpp` (+473 -0) ➕ `tools/qwen35/q36_attn_parity.cu` (+500 -0) ➕ `tools/qwen35/q36_gdn_parity.cu` (+199 -0) ➕ `tools/qwen35/q36_pattn_parity.cu` (+240 -0) ➕ `tools/qwen35/q36_spec_sampled.py` (+183 -0) </details> ### 📄 Description Series (each stacked on the one before; review in order): #3699 → #3903 → #3904 → #3905 → #3906 → #3907 → #3908 → #3909 → #3910. Scope discussion: #3700. This is 7 of 9; it builds on #3907. Branch `pr/q36-07-mtp-sampled`, stacked on `pr/q36-06-pool-warm`. ## Problem and result On the Qwen3.6 engine path only a strictly greedy request drafts with the MTP block. A request with a temperature above 0 or a repeat / frequency / presence penalty decodes one token at a time even with `--mtp 2`. That includes every request that names no sampling, because the server fills in the model card's sampling (#3354: `drafts accepted 0 of 0`, 73-88 tok/s where the same machine reaches about 150 with drafts). - `--mtp-sampled match | q`: sampled requests draft too. `match` drafts the block's greedy pick and keeps each window row's token exactly as a plain decode step would sample it (same seed, same text as without drafts, up to a near tie in the last bits). `q` samples the drafts from the block's own distribution and keeps them by the speculative-sampling rule; the text is a sample of the same distribution, not the same text. - `--spec-min-p P` (the main path's name): end a step's drafts at the first one the block is less sure of than P. - `--sample-gpu`: a sampled row comes to the host as a shortlist of the K highest logits (K = top_k + the ids the penalties touch, at most 160) instead of 1 MB of logits. Result on an RTX 5080 16 GB (same day, `--max-context 262144`, level 06 with its flags against this level; runs in Validation). Sampled requests (temperature 0.7, top-p 0.95, top-k 20, seeds 1 to 4, 256 tokens each, through `--serve`), tok/s: - `--sample-gpu` alone: 232.1 -> 244.1 (+5.2%) at a 4K prompt, 210.1 -> 218.2 (+3.8%) at 40K. - With `--mtp 2 --spec-min-p 0.5 --mtp-sampled q --sample-gpu`: 282.6 (+21.8%) at 4K and 240.6 (+14.5%) at 40K, 67 to 75% of drafts accepted at 4K and 68 to 69% at 40K. The two 4K runs of this arm are 276.2 and 289.1, so it is noisier than the others (the seed changes the text and so the acceptance). - Greedy, free-running with `--mtp 2`: level 06 already drafts greedy requests (294.6 tok/s at 4K, 243.9 at 40K); this level with `--spec-min-p 0.5` gives 298.3 and 249.7 (+1.3% / +2.4% over level 06). Against `--mtp 0` that is +23% / +13%. - `--mtp-sampled match` was not measured. ## Related discussion - #3354 (the problem above) and #3773 (baptisterajaut: the same `match` idea behind `STRATA_Q36_MTP_SAMPLED=1`, stacked on #3678). If #3773 lands first, `--mtp-sampled match` should keep its environment variable as an alias; I will rebase either way. - Existing opt-in sampled drafting of the main path (`STRATA_SPEC_PROB`, `--coupled-draft`, `DETAILS.md` "Sampled drafting"): different engine; the rule here reuses `core/spec_prob.hpp`, and `STRATA_SPEC_MIN_TEMP` is that path's variable. - The first commit of the branch (a penalty past a `--draft-vocab` row) is the separate fix 07a. - No scope issue; the flags are opt-in. ## Approach Flags off, the engine drafts for greedy requests only, as before. The sampler moves from `q36_engine.cu` to `src/qwen35/q36_sampling.hpp` (header-only) so a CPU test can check the rules without a GPU. **The default sampled path is unchanged:** the host's top-k keeps the comparator it had (`lg[a] > lg[b]`) unless `--mtp-sampled` or `--sample-gpu` is given; only then equal logits are ordered by the lower id (the shortlist kernel needs a total order, and `match` needs the plain steps and the window rows to sort alike). The one fix that does touch the default path, a penalty for a history id outside a `--draft-vocab` row that wrote past the row, is its own first commit and its own PR (07a, below). Greedy requests are untouched. `q36_sampling_test` (CPU): `sample()` against a copy of the old function on 8,000 random rows (tie rule off and on; same token, same rng state); `match` gives the plain sampler's text seed for seed; `match` and `q` give the exact joint of four tokens against the chain (chi-square), also with `--spec-min-p` and over a `--draft-vocab` row; three deliberately wrong rules fail as controls; the shortlist gives the whole row's chain, token and rng state (27,291 cases, ties and penalties). `tools/qwen35/q36_spec_sampled.py` measures the rules on the real model. ## Validation Revision: branch `pr/q36-07-mtp-sampled` (66da263), level 06 below it, `origin/main` 5c8dd32. Environment: Fedora 44 (Linux 7.2.11), CUDA 13.4.92 with g++-15 as host compiler, RTX 5080 16 GB (driver 615.78.08), Core Ultra 9 285K, 61 GB DDR5, 6400 MT/s configured, Sage-A1.5 Q4_K_M with the BF16 `ssm_alpha`/`ssm_beta` graft (the file of #3699). **Passed:** - Build CUDA sm_120 and "75;120" (commands as in the level-01 PR), targets `strata q36_sampling_test` and the earlier test tools. - `q36_sampling_test`: passed (GPU build tree; also built by hand with `g++ -std=c++17 -Iinclude src/qwen35/q36_sampling_test.cpp` and run: passed). - Greedy default path against level 01's binary, flags off, fixed 56 slots: logits `cmp` at 4K / 14K IDENTICAL / IDENTICAL; `gate_a.sh` against level 02's binary IDENTICAL / IDENTICAL. - Free-running slot count unchanged: 90 of 256 (fp32, 65K), 82 (int8, 262144). - The submitted revision `66da263` against the timed one (the revision before the last amend of the stack), full-logit `cmp` with the flags of level 07 on both sides (`--sample-gpu` on top of level 06's flags, fixed 56 slots, 4K and 14K): IDENTICAL / IDENTICAL (64,563,200 bytes each). This is a greedy compare; it says the timings hold for the submitted revision, not that sampling is unchanged. **Timing** (same box and day, 2026-10-23; one cold `strata` process per run under the GPU lock; CLI runs alternated, two runs each, four for level 06 with `--mtp 2`, level 07 and the 4K greedy rows; serve runs two each; both binaries from the revisions before the last amend of the stack). `<06 flags>` = `--kv int8 --gqa-attn --fused-prompt-attn --chunked-gdn --side-stream --split-stage-copy --expert-profile $PROFILE --expert-prefetch 2 --hybrid-zero-copy --decode-swaps 64 --async-swaps --lend-staging --pool-warm 3 --prefetch-copies 0` (`$PROFILE` is an expert profile saved from an agent session, not in the repository); 92 experts per layer in VRAM in every arm. Commands: ``` # greedy, free-running, 256 tokens (CLI) level 06: strata --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <06 flags> --mtp 2 --tokens-file $P --n 256 level 07: strata --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <06 flags> --mtp-sampled q --sample-gpu --mtp 2 --spec-min-p 0.5 --tokens-file $P --n 256 # sampled, serve protocol: one engine, per depth 4 requests, the 2nd to 4th reuse the held prompt strata --serve --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <06 flags> [--sample-gpu | --mtp-sampled q --sample-gpu --mtp 2 --spec-min-p 0.5] GEN 256 temperature=0.7 top_p=0.95 top_k=20 seed=S <ids of the 4K or 40K prompt> (S = 1..4) ``` (`strata generate` has no temperature option, so the sampled rows go through `--serve`.) Greedy, tok/s, individual runs, then the mean; "accepted" is the engine's own draft acceptance: | arm | 4,096 | accepted | 40,960 | accepted | |---|---|---|---|---| | level 06, `--mtp 0` | 242.5 / 241.5 / 242.6 / 241.1 = 241.9 | | 221.1 / 221 / 221.1 / 220.8 = 221.0 | | | level 06, `--mtp 2` | 296.1 / 293.2 = 294.6 (+21.8%) | 67% | 243.3 / 243.2 / 244.1 / 244.9 = 243.9 (+10.4%) | 59.5% | | level 07, `--mtp 2 --spec-min-p 0.5 --mtp-sampled q --sample-gpu` | 296.3 / 299 / 299 / 298.9 = 298.3 (+23.3%) | 83.8% | 249.6 / 249.4 / 249.7 / 250 = 249.7 (+13.0%) | 78.5% | (Changes against level 06 with `--mtp 0`.) Sampled, serve protocol, tok/s over the 4 seeds of one run, two runs per arm (per-seed values in the raw results): | arm | 4,096 | drafts accepted / offered | 40,960 | drafts accepted / offered | |---|---|---|---|---| | level 06, `--mtp 0` | 232.7 / 231.5 = 232.1 | | 210.2 / 210.1 = 210.1 | | | level 07, `--sample-gpu` | 244.6 / 243.6 = 244.1 (+5.2%) | | 218.4 / 217.9 = 218.2 (+3.8%) | | | level 07, `--mtp 2 --spec-min-p 0.5 --mtp-sampled q --sample-gpu` | 276.2 / 289.1 = 282.6 (+21.8%) | 520/774 (67%), 547/733 (75%) | 238.5 / 242.6 = 240.6 (+14.5%) | 529/776 (68%), 531/774 (69%) | The first pass of the level-06 `--mtp 2` arm passed `--spec-min-p`, which level 06 does not have; it was re-run without it and only the re-run is shown. **Failed:** none observed. **Not run:** - Sampled default path against `origin/main` text for text on the real model (card sampling, fixed seed, flags off): the logits gate is greedy and does not cover it. `q36_sampling_test` covers `sample()` itself (above). - The distribution check of `--mtp-sampled` and `--sample-gpu` against `off` (`q36_spec_sampled.py`): the timing pass measured speed and acceptance only. `--mtp-sampled match`, `--mtp 3` and above, a 16K prompt. - `--batch` slots with `--mtp-sampled`; vision. - HIP and SYCL builds (the new kernels `k_cand_part` / `k_cand_merge` are in `q36_engine.cu`; never compiled for HIP). ## Limits `q` needs `top_k` <= 64 and a temperature above 0 and at least `STRATA_SPEC_MIN_TEMP`; other sampled requests use `match`. `--sample-gpu` copies the whole row for a penalty that raises a logit or when K would pass 160. Measured on one model and one card. ## Not specific to Sage-A1.5 Sage-A1.5 is a fine-tune of Qwen3.6-35B-A3B with the same architecture and tensor layout, so this path runs the base model unchanged. The before/after numbers above are Sage-A1.5's. The base model was measured once, on my fork's build of the whole series (`xyehya/Strata` branch `q36-r2`: these PRs' flags on, plus a few fork-only defaults), same card and server sweep, with `STRATA_Q8_PACKED=0` (that file keeps its attention and DeltaNet matrices in Q8_0, and the packed copy would take 1.9 GiB from the expert slots): Unsloth's `Qwen3.6-35B-A3B-UD-Q4_K_XL` (from `unsloth/Qwen3.6-35B-A3B-MTP-GGUF`), 262K int8 cache, decode 221 / 208 / 199 / 187 / 164 / 159 tok/s and prompt read 6,473 / 7,010 / 6,277 / 4,656 / 3,411 / 2,506 tok/s at 4K / 16K / 40K / 90K / 160K / 240K (Sage-A1.5 on the same build: decode 231 / 210 / 213 / 187 / 179 / 162). Not measured: this PR's own before/after on the base model. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4825
No description provided.