mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3354] [Engine] qwen35moe: the model-card sampling is applied silently and disables MTP drafting (drafts accepted 0 of 0) #1361
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#1361
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 @conlododo on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3354
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
With a Qwen3.6-35B-A3B (
qwen35moe) model,--mtp 2loads the MTP block and the engine warms up with "a speculative step", but every served request reportsdrafts accepted 0 of 0, so decode stays at the no-drafting speed (73-88 tok/s where the same machine reaches ~150 tok/s with drafts). Sending the same request straight to the engine's own protocol (GEN 64 <ids>on its stdin, bypassingserve/server.py) produces drafts normally:DONE 64 16 132.3 431.5 length 43 44(43 of 44 accepted) andDONE 256 16 117.8 1631.6 length 167 176(167 of 176, ~157 tok/s).The cause is that the server fills in the model card's sampling when a request names none, and the q36 engine only drafts for a strictly greedy request. In
serve/server.py,MODEL_CARD_SAMPLING["qwen35moe"]is{"thinking": {"temperature": 1.0, "top_p": 0.95, "top_k": 20, "presence_penalty": 1.5}, "instruct": {...}}; insrc/qwen35/q36_engine.cu:3584the door isconst bool spec = E.mtp_d > 0 && !smp.needs_logits() && !adm;andneeds_logits() = temperature > 0 || repeat != 1 || freq != 0 || present != 0(line 3013). A plain OpenAI request ({"messages": [...], "max_tokens": 64}, no sampling fields) therefore reaches the engine asGEN 64 temperature=1.0 top_p=0.95 top_k=20 penalty_present=1.5 penalty_last_n=64 <ids>, andspecis false for every window. Setups where MTP is the main reason to run this family lose the whole benefit without any error or warning.Smallest steps or command that reproduce it
To see the difference without reading the server sources, point the config's
exeat a one-file pass-through proxy that logs stdin before forwarding; that is how theGENline above was captured.Reproduction status
Reproduced locally
Strata version
strata 0.1.45 (built from source;
engine/strata --versionreportsstrata 0.1.45)Graphics card, memory and system
RTX 5060 Ti 16 GB · 30 GB RAM · Ubuntu 24.04, Linux 7.0.0-38
Model, size and settings
Qwen3.6-35B-A3B-UD-Q4_K_XL · UD-Q4_K_XL (Unsloth Dynamic, 22 GB, 753 tensors, 5.15 BPW) · context 81920 · --mtp 2 · --prefill auto. The GGUF is an upstream file with a LoRA merged back in; its tensor types were restored to the base file's per-tensor types and it loads normally.
Logs
Workaround that works
Put a
samplingblock in the run config so it overrides the model card's set:top_kmust be left out (the config validation accepts 1..64 only). With that in place, drafts come back on the same machine and model: code-heavy 300-token output went from ~88 to 104 tok/s at--mtp 2(187/224 drafts accepted) and 113 tok/s at--mtp 4(221/320); a 256-token chat answer went from ~77 to 95 tok/s (62/128).What would help (one of these)
drafts disabled: temperature 1.0), instead of leaving the user to discover it from0 of 0.--mtp Nis given, keep the request greedy unless the client asked for sampling itself, or document that MTP requirestemperature=0with no penalties and that the model-card set turns it off.--mtp-greedyor config switch that drops the model-card defaults when MTP is on, keeping them for the plain path.Happy to test a patch on a 16 GB and a 32 GB card and report the numbers.
@github-actions[bot] commented on GitHub (Oct 20, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 20, 2026):
Thanks, this follows the format now.
@Bunkmil commented on GitHub (Oct 22, 2026):
An independent confirmation from a third machine: a Radeon 890M (gfx1150, Strix Point, 61 GB of unified memory, CachyOS, Linux 7.2, HIP), engine 0.1.47 built from source at
011c9e60, Qwen3.6-35B-A3B UD-Q4_K_XL, 32768 context,--mtp 2.Same signature as above: with the 0.2.2 server as shipped, a bare
temperature 0request (thinking off) is not greedy —drafts accepted 0 of 0, 14.7 tok/s. Same 60-token prompt,max_tokens 220, thinking off:temperature 0temperature 0+presence_penalty 0,frequency_penalty 0,repetition_penalty 1.0Service._run(below)top_p 1.0 top_k 0The second row is the telling one: the drafts run and are accepted at 69%, so the engine speculates correctly — the request simply never qualified. Its decode rate only looks lower because the drafted tokens commit against the same 220-token budget.
Two things that may help whichever fix lands:
presence_penalty 1.5in place (103 of 203 drafts attemperature 0, 15.5 tok/s). Onlysrc/qwen35/q36_engine.cugates onneeds_logits()being false, so the impact is model-family specific even though the merge is not.samplingworkaround has a price."sampling": {"presence_penalty": 0}in the run config works today, but the config block also wins for sampled requests, which then lose the card's anti-loop penalty. A server-side fix is the right one.A third implementation of the same fix exists in a local branch (
serve-card-penalties-temperature-0, commitdc3e409e, 2 files, +33/-5, addingtest_temperature_zero_drops_the_card_penalties): the merge moves into a module-levelsampling_for_request(), which drops the two penalties when the request asks for temperature 0. It is smaller than #3295 (model_card_sampling(..., greedy=...)+asks_greedy(), which also covers/props) and than #3676 (merge_samplingplus a note), so I would rather see one of those two land than open a fourth PR.Validation of that local branch:
serve/test_model_card_sampling.py7 tests pass, including the new one; the fullservesuite has the same 3 failures (keepawake, the portable lifeline watcher,GpuChoice.test_hip_ordinal) on a pristine worktree of the parent commit. Not run: CUDA or SYCL builds, and no Flash-Next comparison (the change is Python only).@schmittcn commented on GitHub (Oct 24, 2026):
#3773 (opt-in
STRATA_Q36_MTP_SAMPLED=1) makes these requests draft. A HIP / gfx1030 run of it is in the comments of#3773: sampled decode +16 to +48% per prompt at a 16K window, and the same text for the same seed with fixed slots.
@sarge18 commented on GitHub (Nov 5, 2026):
Still present in 0.2.10 (engine
0.1.56 linux-x86_64-cuda-cuda12, the signed package), on a different card class: Tesla P40 (sm_61), Qwen3.6-35B-A3B UD-Q4_K_XL,--mtp 2, Linux.A greedy request (
temperature 0, top_k 1) that does not name the penalties goes through with the card'spresence_penalty 1.5. Every request then logsdrafts accepted 0 of 0, and decode stays at 48–50 tok/s. Sendingpresence_penalty 0, frequency_penalty 0, repetition_penalty 1explicitly brings drafting back: 124 of 130 accepted on the same three prompts, and 89% over a 69-task suite, with decode at 67 tok/s on a short prompt.The same default also applies to the generic Flash-Next path. There it does not switch drafting off, but it does make a "temperature 0" request penalised, so its output is not greedy. A client that wants greedy output from Strata 0.2.x has to send all three fields; leaving them out does not mean "off".
Measured with the help of an AI assistant (Claude).
@schmittcn commented on GitHub (Nov 7, 2026):
sarge18's comment (0.2.10, P40) adds one point the issue text doesn't cover yet: the model-card default also reaches the generic Flash-Next path. There it doesn't switch drafting off, but a
temperature 0request that doesn't name the penalties still runs withpresence_penalty 1.5, so its output isn't greedy. A client that wants greedy output from Strata 0.2.x has to sendpresence_penalty 0,frequency_penalty 0andrepetition_penalty 1explicitly; leaving them out doesn't mean "off". Maybe worth adding to the description, since the bug isn't limited to MTP.