mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4729] [Engine] opt-in MTP window rule: stop drafting where the drafts' joint probability falls below a depth-scheduled threshold #2165
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:baseup to positiond0,deepfromd1(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_tunetakesspec_p_cumandspec_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:870aedd9plus this change and my AVX-only CPU changes, the same in every arm.--adapt-swaps 0 --prompt-cache 0,pcie_frac0), 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).spec_min_p0.5 with product 0.7, 6 runs). That is noise.0.9; 101K tokens 32.6 against 32.5.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.