mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5145] [Engine] Qwen3.6-35B-A3B (q36): strata_prefix / pin=N is ignored, a shared long prefix is re-read on every request #3058
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#3058
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 @fedororsanskij28819-beep on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5145
What happens
On the Qwen3.6-35B-A3B engine path (
qwen35moe,strata-q36), a request with"strata_prefix"gets no reuse: every requestreads its whole prompt from token 0. With the same client code on Qwen3.8-Flash-Next, the pinned prefix works as documented
(
9650 reused, prompt read 13–17 s → 1.5–3 s).Workload: a batch of independent single-turn requests. Each prompt = the same ~9,650-token read-only document (opens the user
message) + a short, different question.
strata_prefix: {"message": 1, "chars": <end of the document>}on every request.Engine log on q36, every request:
(20 of 20 requests:
0 reused.) The prompt read is ~57 s of a ~60 s request, so the pin is the whole difference.Why (from reading the code)
serve/server.py(~L1450) turns the resolvedstrata_prefixintopin=Non the engine's request line — for both families.src/qwen35/q36_engine.cu, key loop ~L3460) accepts only the sampling keys andimg_keys; anunknown
key=valueis skipped silently, sopinis dropped without a log line.match_len(~L3404) — the session's whole held token list (prompt and answer)must be a proper start of the new prompt, because the recurrent (GDN) state cannot step back. Two requests that share only
a prefix therefore never match.
n_sess, up tokVerify= 8) andEngine::copy_session(src, dst)(recurrent state + the firstposKV cells).Ask
pin=Non q36: while reading a prompt, snapshot the session's state at token N (into a spare session or adedicated "prefix" buffer: recurrent state + conv state + KV cells
[0, N)), and on a later request whose ids start withthe same N tokens,
copy_sessionfrom it and read only the rest. One pinned prefix per engine would already cover our case(the same rule as Flash-Next).
pin=is given to an engine that does not support it (like the server'sstrata_prefix ... ignored: ...messages), so the cost is visible.Setup
7b3e2ea), engine 0.1.48 (BUILD.jsoncommit6f8800aefe), Windows 11, CUDA 13 build.Code references above are from GitHub
mainat7dd5cf1.--native <gguf> --max-context 16384 --prefill auto --mtp 2, one session.nextn_predict_layers = 1; the engineaccepted it:
753 tensors (layout checked),MTP block loaded). It is not one of the pinned Unsloth files — but thebehaviour above follows from the request parser and
match_len, so it should not depend on the file. Not re-tested withUD-Q4_K_XL.
Side note (may be a separate issue): in the same runs
draft_nstayed 0 (no MTP drafts accepted or offered) on shortgreedy-ish requests with
reasoning_effort: none. Not investigated yet.@pdmaclennan-art commented on GitHub (Nov 4, 2026):
Same cause seen from the agent side, without
strata_prefix: on 0.2.10 (engine 0.1.56, Windows HIP, Strix Halo gfx1151) the q36 path reused nothing for repeats and follow-up turns either, so an agent client re-reads its whole conversation every turn.Six requests in a row on one server (Unsloth Qwen3.6-35B-A3B-MTP-GGUF UD-Q4_K_XL, setup's config
--native <gguf> --max-context 131072 --prefill auto --mtp 2), an 18K-token system prompt, up to 200 new tokens,reasoning_budget_tokens: 100:cached_tokensThe engine log agrees (
prompt 18066 tokens = 0 reused + 18066 read in 31813 msfor request 6). Of the 54 engine requests that day, one reused anything: the server's own continuation after request 5's thinking budget (18122 reused + 18 read), which sends back exactly the generated tokens. The same continuation after request 6 read all 18,184 tokens again, which is why it took 67.9 s.So
match_lenbites even for a plain follow-up: request 3 sends back the answer as text, and that did not match the held tokens either (with thinking on, the template drops the reasoning, so it cannot).For comparison, on the same machine and harness, Flash-Next Q2_0 with setup's settings reused 18,005-18,055 tokens on requests 2, 3, 4 and 6 and answered them in 0.5-1.4 s (request 5, the first with thinking on after thinking-off requests, read everything again). llama.cpp on the same 35B file started its second turn in 0.4-0.5 s. A state snapshot at the end of the prompt (or at the last user turn), as you describe under "Ask", would cover the agent case too.
Full report and logs: https://github.com/Niko1221/Strata/pull/5182.