[GH-ISSUE #4729] [Engine] opt-in MTP window rule: stop drafting where the drafts' joint probability falls below a depth-scheduled threshold #2165

Open
opened 2026-11-04 01:57:10 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Keoian on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4729

Area

[Engine] (speed, kernels, models, the server and API)

What do you want to do?

Add an opt-in MTP window rule that also stops drafting where the drafts, taken together, are unlikely to be accepted. I am asking whether you want it in Strata before opening the pull request: it is a new decode option, and the gain I can show on my own hardware is small.

The problem. The serial decode loop ends an MTP window at the first draft below --spec-min-p. Each draft is judged on its own, so a window of four drafts at p = 0.85 each passes the 0.8 floor, but the chance that all four are accepted is about 0.52. Every drafted token is verified. Where a verify token is expensive (dense attention deep in the context, or CPU expert rows on a CPU-bound box), the tail of such a window costs more than it returns.

The rule. STRATA_SPEC_PCUM=base[,deep[,d0,d1]] also ends the window where the product of the drafted tokens' top-1 probabilities falls below a threshold that follows the depth: base up to position d0, deep from d1 (16384 / 49152 by default), a straight line between. The drafter stops at the same token through the existing chain-rule hook, so nothing is drafted that the window drops. Per request, strata_tune takes spec_p_cum and spec_p_cum_deep. Unset, there is no rule and no chain callback, so the default path is unchanged. Only the window's length changes and every token is still verified.

Where it comes from. A depth-scheduled draft cutoff in my llama.cpp fork for 2x Tesla P100 (https://github.com/Keoian/dual-p100-qwen-3-8-27b, branch p100-optimizations, OPTLOG 198 / 218). There, a verify token costs a dense-attention pass over the whole cache, and the cutoff gave +10-16% decode deep in the context.

What I measured in Strata. 2x RX 5700 XT 8 GB (gfx1010, layer split 27), i7-3770 (AVX, no AVX2), 32 GB DDR3-1600, Linux, ROCm 7.14.0a20260612 (TheRock gfx101X-dgpu), Qwen3.8-Flash-Next ISTA-DASLab Q2_0, --spec 4 --spec-min-p 0.8, 256-token answers, thinking off. Engine: 870aedd9 plus this change and my AVX-only CPU changes, the same in every arm.

  • Exact: with the expert placement fixed (--adapt-swaps 0 --prompt-cache 0, pcie_frac 0), 6 greedy prompts x 256 tokens gave byte-identical text with the rule off, at 0.6 and at 0.75 (and in a second run with it off).
  • Greedy, short prompts: 31.0 tok/s off (12 runs) against 31.3 at best (spec_min_p 0.5 with product 0.7, 6 runs). That is noise.
  • Greedy, deep in the context (one fixed document, arms in ABBA order, 2 rounds): 31K tokens 33.5 tok/s off against 33.7 with 0.9; 101K tokens 32.6 against 32.5.
  • Sampled (temperature 1.0, top_p 0.95, top_k 20, seeded, 9 runs an arm): 29.9 / 30.0 off (two arms) against 30.4 with 0.9 (+1.5%, 7 of 9 pairs faster, 1 equal, 1 slower). Drafts accepted: 74% -> 84%.

Why so little here: Qwen3.8-Flash-Next's sparse attention keeps the verify cost nearly flat with depth (a ~1.7-token window took 45.7 ms at 31K and 46.7 ms at 101K). The extra cost of a verify token is about 16.6 ms of CPU expert rows at any depth, so the per-token floor of 0.8 already sits near the break-even point. The rule should matter more where a verify token gets expensive with depth, which I cannot test.

The branch is ready (one commit with a docs entry and a server unit test): https://github.com/Keoian/Strata/tree/mtp-spec-pcum. I will open the pull request if you want this as an opt-in, or leave it in my fork if not.

What do you do today instead?

I run my fork with STRATA_SPEC_PCUM=0.9.

Originally created by @Keoian on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4729 ### Area [Engine] (speed, kernels, models, the server and API) ### What do you want to do? Add an opt-in MTP window rule that also stops drafting where the drafts, taken together, are unlikely to be accepted. I am asking whether you want it in Strata before opening the pull request: it is a new decode option, and the gain I can show on my own hardware is small. **The problem.** The serial decode loop ends an MTP window at the first draft below `--spec-min-p`. Each draft is judged on its own, so a window of four drafts at p = 0.85 each passes the 0.8 floor, but the chance that all four are accepted is about 0.52. Every drafted token is verified. Where a verify token is expensive (dense attention deep in the context, or CPU expert rows on a CPU-bound box), the tail of such a window costs more than it returns. **The rule.** `STRATA_SPEC_PCUM=base[,deep[,d0,d1]]` also ends the window where the product of the drafted tokens' top-1 probabilities falls below a threshold that follows the depth: `base` up to position `d0`, `deep` from `d1` (16384 / 49152 by default), a straight line between. The drafter stops at the same token through the existing chain-rule hook, so nothing is drafted that the window drops. Per request, `strata_tune` takes `spec_p_cum` and `spec_p_cum_deep`. Unset, there is no rule and no chain callback, so the default path is unchanged. Only the window's length changes and every token is still verified. **Where it comes from.** A depth-scheduled draft cutoff in my llama.cpp fork for 2x Tesla P100 (https://github.com/Keoian/dual-p100-qwen-3-8-27b, branch `p100-optimizations`, OPTLOG 198 / 218). There, a verify token costs a dense-attention pass over the whole cache, and the cutoff gave +10-16% decode deep in the context. **What I measured in Strata.** 2x RX 5700 XT 8 GB (gfx1010, layer split 27), i7-3770 (AVX, no AVX2), 32 GB DDR3-1600, Linux, ROCm 7.14.0a20260612 (TheRock gfx101X-dgpu), Qwen3.8-Flash-Next ISTA-DASLab Q2_0, `--spec 4 --spec-min-p 0.8`, 256-token answers, thinking off. Engine: 870aedd9 plus this change and my AVX-only CPU changes, the same in every arm. - Exact: with the expert placement fixed (`--adapt-swaps 0 --prompt-cache 0`, `pcie_frac` 0), 6 greedy prompts x 256 tokens gave byte-identical text with the rule off, at 0.6 and at 0.75 (and in a second run with it off). - Greedy, short prompts: 31.0 tok/s off (12 runs) against 31.3 at best (`spec_min_p` 0.5 with product 0.7, 6 runs). That is noise. - Greedy, deep in the context (one fixed document, arms in ABBA order, 2 rounds): 31K tokens 33.5 tok/s off against 33.7 with `0.9`; 101K tokens 32.6 against 32.5. - Sampled (temperature 1.0, top_p 0.95, top_k 20, seeded, 9 runs an arm): 29.9 / 30.0 off (two arms) against 30.4 with `0.9` (+1.5%, 7 of 9 pairs faster, 1 equal, 1 slower). Drafts accepted: 74% -> 84%. Why so little here: Qwen3.8-Flash-Next's sparse attention keeps the verify cost nearly flat with depth (a ~1.7-token window took 45.7 ms at 31K and 46.7 ms at 101K). The extra cost of a verify token is about 16.6 ms of CPU expert rows at any depth, so the per-token floor of 0.8 already sits near the break-even point. The rule should matter more where a verify token gets expensive with depth, which I cannot test. The branch is ready (one commit with a docs entry and a server unit test): https://github.com/Keoian/Strata/tree/mtp-spec-pcum. I will open the pull request if you want this as an opt-in, or leave it in my fork if not. ### What do you do today instead? I run my fork with `STRATA_SPEC_PCUM=0.9`.
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#2165
No description provided.