[GH-ISSUE #2464] [Engine] Qwen3.6-35B-A3B decode falls with context (V100: 109 to 14.6 tok/s at 114K on 0.2.0-beta); llama.cpp holds ~90 #1008

Open
opened 2026-11-04 01:47:40 +07:00 by bsakaguchi · 13 comments
Owner

Originally created by @christopherrobertbrooks-tech on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2464

Area

Engine

Desktop app, Terminal or source?

Source: built from the v0.2.0-beta tag for sm_70 (-DCMAKE_CUDA_ARCHITECTURES=70 -DSTRATA_EXPERIMENTAL_SM60=ON, CUDA 12.9).

What happened

On the Qwen3.6 engine (strata-q36), decode falls steeply as the context fills, with and without MTP drafts, while llama.cpp barely moves on the same card and file. Re-tested on 0.2.0-beta: still the same.

Decode tok/s, strata-bench-v100/benchmark.py (fresh prompts filled to each size, greedy, 256-token answers, engine /metrics, 3 runs per size, medians):

prompt tokens 256 1,000 4,096 16,384 32,768 65,536 114,688
0.2.0-beta, temperature 0 (no drafts: #2940) 109.3 104.7 85.7 59.7 40.3 23.4 14.6
0.2.0-beta, presence_penalty: 0 (MTP drafts on) 156.9 157.2 117.0 57.7 34.6 19.6 11.6
llama.cpp 5e03bdd, same file (0.1.44 run below) 92.2 92.1 91.3 87.3

Prefill: 1,169 / 1,734 / 1,795 / 1,607 / 1,360 / 984 / 602 tok/s. The answers are correct; it is only the decode speed.

@kirinriki7777-sys sees the same shape on an L4 (sm_89) in the hybrid mode on 0.2.0-beta (comment below), so it is not Volta-only.

An int8 K/V cache helped a lot on this card: #2698 (--kv int8, closed in the reset, not merged) decoded 52.5 tok/s at 65,536 vs 17.3 on its base (296b59d), and #3084 (FP16 K/V by default) gave +8% at 65,536. Neither is in 0.2.0-beta: the q36 engine still stores the K/V cache in FP32.

Smallest steps or command that reproduce it

./setup.sh --family qwen36 --model UD-Q4_K_XL, then the engine with --native <gguf> --max-context 131072 --prefill auto --mtp 2 (setup's config) and any prompt of 16K tokens or more; compare decode with a short prompt.

Reproduction status

Reproduced locally on 0.2.0-beta (2026-10-19), and by @kirinriki7777-sys on an NVIDIA L4.

Strata version

0.2.0-beta (3d1fb48, engine 0.1.45.3)

Graphics card, memory and system

Tesla V100-PCIe-32GB (sm_70), i7-13700KF, 16 GB RAM, Linux, CUDA 12.9, driver 580.173.02

Model, size and settings

Qwen3.6-35B-A3B UD-Q4_K_XL (setup's pinned file from unsloth/Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238), --native --max-context 131072 --prefill auto --mtp 2, every routed expert in VRAM (19.31 GiB free after load).

Original report (0.1.44)

Tested v0.1.44 (ed4773e) with Qwen3.6-35B-A3B UD-Q4_K_XL (setup's pinned file from unsloth/Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238, SHA-256 checked) on one Tesla V100-PCIe-32GB (i7-13700KF, 16 GB RAM), CUDA 12.9, built with -DSTRATA_EXPERIMENTAL_SM60=ON and libstrata_kq.so next to the engine. Config as setup writes it: --native <gguf> --max-context 131072 --prefill auto --mtp 2. Every routed expert fit in VRAM (18.75 GiB, after "the packed Q8_0 decode copies (1.78 GiB) given back"). Greedy, 256-token answers, the same benchmark.py prompts as our other V100 reports, 3 runs per size, medians. Decode tok/s, with time to first token in brackets:

prompt --mtp 2 --mtp 0 (decode) llama.cpp, same file
256 153.8 (0.23 s) 111.3 92.2 (0.55 s)
1,000 154.2 (0.60 s) 106.3 92.1 (1.54 s)
4,096 114.8 (2.38 s) 86.3 91.3 (6.01 s)
16,384 56.5 (10.56 s) 59.2 87.3 (25.38 s)

llama.cpp = mainline 5e03bdd built for sm_70, -ngl 99 -fa on, the identical request bodies (thinking off), streamed.

Short prompts are great on this card: MTP drafts are accepted 69% of the time and decode is ~1.7x llama.cpp's. But decode falls with context with and without MTP, while llama.cpp's barely moves, so at 16K Strata decodes ~35% slower than llama.cpp on the same card (it still reads the prompt 2.4x faster). Our guess is the full-attention layers' decode on sm_70, but we haven't profiled it, and we know Volta is experimental. HumanEval (thinking off) was 155/164 in 4.0 min, the same score as our earlier llama.cpp test of this model.

Happy to run variants (STRATA_Q36_KEEP_PACKED=1, longer contexts) if that helps.

Originally created by @christopherrobertbrooks-tech on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2464 ### Area Engine ### Desktop app, Terminal or source? Source: built from the v0.2.0-beta tag for sm_70 (`-DCMAKE_CUDA_ARCHITECTURES=70 -DSTRATA_EXPERIMENTAL_SM60=ON`, CUDA 12.9). ### What happened On the Qwen3.6 engine (strata-q36), decode falls steeply as the context fills, with and without MTP drafts, while llama.cpp barely moves on the same card and file. Re-tested on 0.2.0-beta: still the same. Decode tok/s, `strata-bench-v100/benchmark.py` (fresh prompts filled to each size, greedy, 256-token answers, engine `/metrics`, 3 runs per size, medians): | prompt tokens | 256 | 1,000 | 4,096 | 16,384 | 32,768 | 65,536 | 114,688 | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | 0.2.0-beta, temperature 0 (no drafts: #2940) | 109.3 | 104.7 | 85.7 | 59.7 | 40.3 | 23.4 | 14.6 | | 0.2.0-beta, `presence_penalty: 0` (MTP drafts on) | 156.9 | 157.2 | 117.0 | 57.7 | 34.6 | 19.6 | 11.6 | | llama.cpp 5e03bdd, same file (0.1.44 run below) | 92.2 | 92.1 | 91.3 | 87.3 | | | | Prefill: 1,169 / 1,734 / 1,795 / 1,607 / 1,360 / 984 / 602 tok/s. The answers are correct; it is only the decode speed. @kirinriki7777-sys sees the same shape on an L4 (sm_89) in the hybrid mode on 0.2.0-beta (comment below), so it is not Volta-only. An int8 K/V cache helped a lot on this card: #2698 (`--kv int8`, closed in the reset, not merged) decoded 52.5 tok/s at 65,536 vs 17.3 on its base (296b59d), and #3084 (FP16 K/V by default) gave +8% at 65,536. Neither is in 0.2.0-beta: the q36 engine still stores the K/V cache in FP32. ### Smallest steps or command that reproduce it `./setup.sh --family qwen36 --model UD-Q4_K_XL`, then the engine with `--native <gguf> --max-context 131072 --prefill auto --mtp 2` (setup's config) and any prompt of 16K tokens or more; compare decode with a short prompt. ### Reproduction status Reproduced locally on 0.2.0-beta (2026-10-19), and by @kirinriki7777-sys on an NVIDIA L4. ### Strata version 0.2.0-beta (3d1fb48, engine 0.1.45.3) ### Graphics card, memory and system Tesla V100-PCIe-32GB (sm_70), i7-13700KF, 16 GB RAM, Linux, CUDA 12.9, driver 580.173.02 ### Model, size and settings Qwen3.6-35B-A3B UD-Q4_K_XL (setup's pinned file from unsloth/Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238), `--native --max-context 131072 --prefill auto --mtp 2`, every routed expert in VRAM (19.31 GiB free after load). ### Original report (0.1.44) Tested v0.1.44 (ed4773e) with Qwen3.6-35B-A3B UD-Q4_K_XL (setup's pinned file from unsloth/Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238, SHA-256 checked) on one Tesla V100-PCIe-32GB (i7-13700KF, 16 GB RAM), CUDA 12.9, built with `-DSTRATA_EXPERIMENTAL_SM60=ON` and `libstrata_kq.so` next to the engine. Config as setup writes it: `--native <gguf> --max-context 131072 --prefill auto --mtp 2`. Every routed expert fit in VRAM (18.75 GiB, after "the packed Q8_0 decode copies (1.78 GiB) given back"). Greedy, 256-token answers, the same benchmark.py prompts as our other V100 reports, 3 runs per size, medians. Decode tok/s, with time to first token in brackets: | prompt | `--mtp 2` | `--mtp 0` (decode) | llama.cpp, same file | |---|---|---|---| | 256 | 153.8 (0.23 s) | 111.3 | 92.2 (0.55 s) | | 1,000 | 154.2 (0.60 s) | 106.3 | 92.1 (1.54 s) | | 4,096 | 114.8 (2.38 s) | 86.3 | 91.3 (6.01 s) | | 16,384 | 56.5 (10.56 s) | 59.2 | 87.3 (25.38 s) | llama.cpp = mainline 5e03bdd built for sm_70, `-ngl 99 -fa on`, the identical request bodies (thinking off), streamed. Short prompts are great on this card: MTP drafts are accepted 69% of the time and decode is ~1.7x llama.cpp's. But decode falls with context with and without MTP, while llama.cpp's barely moves, so at 16K Strata decodes ~35% slower than llama.cpp on the same card (it still reads the prompt 2.4x faster). Our guess is the full-attention layers' decode on sm_70, but we haven't profiled it, and we know Volta is experimental. HumanEval (thinking off) was 155/164 in 4.0 min, the same score as our earlier llama.cpp test of this model. Happy to run variants (`STRATA_Q36_KEEP_PACKED=1`, longer contexts) if that helps.
Author
Owner

@merbanan commented on GitHub (Oct 14, 2026):

Strata only supports Flash next. Try this branch https://github.com/merbanan/project-maya/commits/qwen38/ I am getting ~200 t /s.

<!-- gh-comment-id:6176065339 --> @merbanan commented on GitHub (Oct 14, 2026): Strata only supports Flash next. Try this branch https://github.com/merbanan/project-maya/commits/qwen38/ I am getting ~200 t /s.
Author
Owner

@christopherrobertbrooks-tech commented on GitHub (Oct 14, 2026):

Thanks! Strata 0.1.44 does run it: the release notes list Qwen3.6-35B-A3B, strata --families prints qwen4exp qwen35moe, and the numbers above come from that path (the engine log shows strata-q36: ... MTP block loaded and every routed expert in VRAM (18.75 GiB)). Which GPU and model is your ~200 t/s on, and does the qwen38 branch run Qwen3.6-35B-A3B? Its recent commits look like DSv4 MTP work.

<!-- gh-comment-id:6176162546 --> @christopherrobertbrooks-tech commented on GitHub (Oct 14, 2026): Thanks! Strata 0.1.44 does run it: the release notes list Qwen3.6-35B-A3B, `strata --families` prints `qwen4exp qwen35moe`, and the numbers above come from that path (the engine log shows `strata-q36: ... MTP block loaded` and `every routed expert in VRAM (18.75 GiB)`). Which GPU and model is your ~200 t/s on, and does the qwen38 branch run Qwen3.6-35B-A3B? Its recent commits look like DSv4 MTP work.
Author
Owner

@merbanan commented on GitHub (Oct 14, 2026):

Sure it can run it because it is based on llama.cpp.

Anyway I use a 32GB V100 and I am doing work on all MoE based models so Qwen3.6-35B-A3B got caught in the crossfire. Qwen3.8 seems to runs at 70+ t/s (which is nice).

<!-- gh-comment-id:6176443747 --> @merbanan commented on GitHub (Oct 14, 2026): Sure it can run it because it is based on llama.cpp. Anyway I use a 32GB V100 and I am doing work on all MoE based models so Qwen3.6-35B-A3B got caught in the crossfire. Qwen3.8 seems to runs at 70+ t/s (which is nice).
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271074147 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Author
Owner

@kirinriki7777-sys commented on GitHub (Oct 19, 2026):

Re-tested on 0.2.0-beta (3d1fb48, engine 0.1.45.3): the same decode-vs-context fall on an NVIDIA L4 (sm_89), in the hybrid mode this time.

Setup: Google Colab L4 (24 GB VRAM, 53 GB RAM, 12 vCPU Xeon 2.2 GHz), Linux, CUDA 13 engine built by setup. ./setup.sh --family qwen36 --model UD-Q6_K_XL --context 131072 --vision cpu --yes (setup's pinned file from unsloth/Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238). The engine line: --native <gguf> --max-context 131072 --prefill auto --mtp 2 --vision; strata-q36: hybrid experts: 60 of 256 per layer in VRAM (6.57 GiB), all 28.03 GiB in pinned host memory, ... on 6 CPU threads; context 131072 cells, prompt chunk 2048, MTP block loaded, 8.97 GiB of VRAM free.

What happened: one request at a time, sampled (default sampling of the chat API, so no MTP drafts: drafts accepted 0 of 0), a document of Python/Markdown source with a question at the end. Decode tok/s from the server's own session 0: lines / /metrics:

prompt tokens decode tok/s prompt read tok/s
46 38.7 —
16,511 28.2 763
35,149 12.2 760
70,176 6.2 648
116,130 4.1 462

Beyond ~16K the time per token grows by about 2.3 ms per 1,000 tokens of context (roughly 1/context). nvidia-smi showed 97% GPU utilization while decoding at 116K, so it does not look like PCIe waiting. The answers were correct (a passphrase placed once at the start of the 116K document was found).

Same box, llama.cpp b11467 (UD-Q4_K_XL from the same repo and revision, -fit on -ctk q8_0 -ctv q8_0 -fa on --spec-type draft-mtp --spec-draft-n-max 3 -c 262144, same documents): 55.2 / 48.7 / 44.8 / 37.2 tok/s at 16.5K / 35K / 70K / 116K, and 30.5 at 191K. The quantization differs (Q4 there, Q6 here), so this is only a reference for the shape of the curve, not a like-for-like speed comparison.

So the V100 report above (full VRAM, 16K) and this one (hybrid, sm_89, up to 116K) show the same pattern on two architectures and both placements. I did not profile the kernels; the guess in the original report (the full-attention layers' decode) fits what I see, but that is not confirmed.

Not tested: UD-Q4_K_XL in Strata on this card, greedy requests with MTP drafts at long context, other context settings than 131072.

<!-- gh-comment-id:6275677675 --> @kirinriki7777-sys commented on GitHub (Oct 19, 2026): Re-tested on 0.2.0-beta (3d1fb48, engine 0.1.45.3): the same decode-vs-context fall on an NVIDIA L4 (sm_89), in the hybrid mode this time. **Setup**: Google Colab L4 (24 GB VRAM, 53 GB RAM, 12 vCPU Xeon 2.2 GHz), Linux, CUDA 13 engine built by setup. `./setup.sh --family qwen36 --model UD-Q6_K_XL --context 131072 --vision cpu --yes` (setup's pinned file from unsloth/Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238). The engine line: `--native <gguf> --max-context 131072 --prefill auto --mtp 2 --vision`; `strata-q36: hybrid experts: 60 of 256 per layer in VRAM (6.57 GiB), all 28.03 GiB in pinned host memory, ... on 6 CPU threads`; `context 131072 cells, prompt chunk 2048, MTP block loaded, 8.97 GiB of VRAM free`. **What happened**: one request at a time, sampled (default sampling of the chat API, so no MTP drafts: `drafts accepted 0 of 0`), a document of Python/Markdown source with a question at the end. Decode tok/s from the server's own `session 0:` lines / `/metrics`: | prompt tokens | decode tok/s | prompt read tok/s | |---:|---:|---:| | 46 | 38.7 | — | | 16,511 | 28.2 | 763 | | 35,149 | 12.2 | 760 | | 70,176 | 6.2 | 648 | | 116,130 | 4.1 | 462 | Beyond ~16K the time per token grows by about 2.3 ms per 1,000 tokens of context (roughly 1/context). `nvidia-smi` showed 97% GPU utilization while decoding at 116K, so it does not look like PCIe waiting. The answers were correct (a passphrase placed once at the start of the 116K document was found). **Same box, llama.cpp b11467** (UD-Q4_K_XL from the same repo and revision, `-fit on -ctk q8_0 -ctv q8_0 -fa on --spec-type draft-mtp --spec-draft-n-max 3 -c 262144`, same documents): 55.2 / 48.7 / 44.8 / 37.2 tok/s at 16.5K / 35K / 70K / 116K, and 30.5 at 191K. The quantization differs (Q4 there, Q6 here), so this is only a reference for the shape of the curve, not a like-for-like speed comparison. So the V100 report above (full VRAM, 16K) and this one (hybrid, sm_89, up to 116K) show the same pattern on two architectures and both placements. I did not profile the kernels; the guess in the original report (the full-attention layers' decode) fits what I see, but that is not confirmed. Not tested: UD-Q4_K_XL in Strata on this card, greedy requests with MTP drafts at long context, other context settings than 131072.
Author
Owner

@christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026):

Thanks @kirinriki7777-sys for re-testing on an L4: it matches what the V100 shows on 0.2.0-beta. I've updated the description with the 0.2.0-beta numbers.

<!-- gh-comment-id:6280339036 --> @christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026): Thanks @kirinriki7777-sys for re-testing on an L4: it matches what the V100 shows on 0.2.0-beta. I've updated the description with the 0.2.0-beta numbers.
Author
Owner

@christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026):

/reopen

<!-- gh-comment-id:6280339895 --> @christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026): /reopen
Author
Owner

@github-actions[bot] commented on GitHub (Oct 20, 2026):

Reopened, thank you. A maintainer will pick it up from here.

<!-- gh-comment-id:6280341772 --> @github-actions[bot] commented on GitHub (Oct 20, 2026): Reopened, thank you. A maintainer will pick it up from here.
Author
Owner

@christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026):

Profiled: the slowdown is k_attn_part (src/qwen35/q36_engine.cu)

Tesla V100-PCIe-32GB, Strata 0.1.45 (q36 engine, --native UD-Q4_K_XL, --prefill auto, no --mtp), temperature 0 with presence and frequency penalty 0. Nsight Systems with the capture limited to the requests; decode-only window (kernels after the last prompt GEMM), 256 written tokens per context.

per written token 1K context 16K context
all GPU kernels 11.47 ms 18.64 ms
k_attn_part (10 calls) 1.68 ms 8.71 ms
k_attn_merge (10 calls) 0.06 ms 0.20 ms
the other ~637 kernels flat flat

Untraced, same build: 93.7 / 79.8 / 55.9 tok/s at 1K / 4K / 16K (with --mtp 2: 134.5 / 110.7 / 58.2). llama.cpp on the same file: 91.7 / 90.5 tok/s at 1K / 16K; its flash-attention kernels take 0.33 / 0.80 ms per token.

From the source (unchanged in main 9ae93f7b), three things multiply the bytes read:

  • the K/V cache is fp32 (const float* kc, vc);
  • the grid is (chunk, query row) with kvh = h / (H / HKV), so the 8 query heads that share each KV head (H = 16, HKV = 2) each read that head's K and V chunk separately;
  • each thread reads a whole 256-float K row (kp[i], a stride of HD between threads), so the K loads are not coalesced.

fp32 K + V for one KV head at 16K is 33.5 MB, larger than the V100's 6 MB L2, so the eight re-reads go to HBM. Scaling 8.71 ms by 114K / 16K gives about 60 ms per token, which matches the 14.6 tok/s at 114K above.

Not tested: other cards (with a larger L2 the re-reads would partly hit cache), and whether --kv int8 changes this engine's path.

<!-- gh-comment-id:6291779543 --> @christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026): **Profiled: the slowdown is `k_attn_part` (src/qwen35/q36_engine.cu)** Tesla V100-PCIe-32GB, Strata 0.1.45 (q36 engine, `--native` UD-Q4_K_XL, `--prefill auto`, no `--mtp`), temperature 0 with presence and frequency penalty 0. Nsight Systems with the capture limited to the requests; decode-only window (kernels after the last prompt GEMM), 256 written tokens per context. | per written token | 1K context | 16K context | | --- | ---: | ---: | | all GPU kernels | 11.47 ms | 18.64 ms | | `k_attn_part` (10 calls) | 1.68 ms | 8.71 ms | | `k_attn_merge` (10 calls) | 0.06 ms | 0.20 ms | | the other ~637 kernels | flat | flat | Untraced, same build: 93.7 / 79.8 / 55.9 tok/s at 1K / 4K / 16K (with `--mtp 2`: 134.5 / 110.7 / 58.2). llama.cpp on the same file: 91.7 / 90.5 tok/s at 1K / 16K; its flash-attention kernels take 0.33 / 0.80 ms per token. From the source (unchanged in main 9ae93f7b), three things multiply the bytes read: - the K/V cache is fp32 (`const float* kc, vc`); - the grid is (chunk, query row) with `kvh = h / (H / HKV)`, so the 8 query heads that share each KV head (H = 16, HKV = 2) each read that head's K and V chunk separately; - each thread reads a whole 256-float K row (`kp[i]`, a stride of HD between threads), so the K loads are not coalesced. fp32 K + V for one KV head at 16K is 33.5 MB, larger than the V100's 6 MB L2, so the eight re-reads go to HBM. Scaling 8.71 ms by 114K / 16K gives about 60 ms per token, which matches the 14.6 tok/s at 114K above. Not tested: other cards (with a larger L2 the re-reads would partly hit cache), and whether `--kv int8` changes this engine's path.
Author
Owner

@christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026):

Follow-up: the same kernel also explains why --mtp stops helping at long context on this card (134.5 vs 93.7 tok/s at 1K, 58.2 vs 55.9 at 16K). The grid is dim3(nc, nt * H), so verifying a 3-token draft reads every KV chunk once per verified token as well as once per query head; llama.cpp's draft-mtp on the same file keeps a 1.31-1.39x speed-up from 1K to 64K.

<!-- gh-comment-id:6292626483 --> @christopherrobertbrooks-tech commented on GitHub (Oct 20, 2026): Follow-up: the same kernel also explains why `--mtp` stops helping at long context on this card (134.5 vs 93.7 tok/s at 1K, 58.2 vs 55.9 at 16K). The grid is `dim3(nc, nt * H)`, so verifying a 3-token draft reads every KV chunk once per verified token as well as once per query head; llama.cpp's draft-mtp on the same file keeps a 1.31-1.39x speed-up from 1K to 64K.
Author
Owner

@kirinriki7777-sys commented on GitHub (Oct 21, 2026):

Another data point for the decode-vs-context fall on the Qwen3.6 engine path, this time with a larger qwen35moe model (Ornith-1.5-122B, 32 query / 2 KV heads, 12 full-attention layers + the MTP block; the setup and the patch needed to load it are in #3574). Same L4 box and the same documents as my comment above.

--max-context 131072, STRATA_Q8_PACKED=0, 8 expert slots per layer, sampled chat requests (no drafts), decode from the server's session 0: lines:

prompt tokens decode tok/s prompt read tok/s Qwen3.6-35B-A3B on the same card (earlier comment)
18,671 6.0 485 28.2 at 16,511
42,204 2.8 476 12.2 at 35,149
83,802 1.8 317 6.2 at 70,176
116,130 1.4 207 4.1 at 116,130

Between 18.7K and 83.8K the time per token grows by about 6.0 ms per 1,000 tokens of context (Qwen3.6: about 2.3 ms). The ratio, 2.6, is close to the ratio of query heads x attention layers, (32 x 13) / (16 x 11) = 2.36.

The same model with every expert in VRAM (Colab A100 80 GB, same file, same patch, same documents, every routed expert in VRAM (44.69 GiB), no CPU pool): 64.0 tok/s on a 2.5K prompt, 35.4 at 18,671, 13.3 at 83,802. Answers were right at both lengths. The growth there is 0.72 ms per 1,000 tokens, 8.3x less than on the L4, close to the ratio of the two cards' memory bandwidth. If every query head reads the fp32 K and V of its cells, 1,000 cells cost 13 layers x 32 heads x 1,000 x 256 x 4 B x 2 = 852 MB per token: that is ~1.18 TB/s on the A100 and ~142 GB/s on the L4, i.e. both cards look bandwidth-bound on these reads.

Reading k_attn_part (src/qwen35/q36_engine.cu), two things look like they would give exactly this shape. I have not profiled the kernel, so please treat this as a reading of the code, not a measurement:

  1. Each query head reads the K/V cells on its own. The grid is (chunks of 256 cells, T * H rows) and a block maps its row to kvh = h / (H / HKV), so the 16 query heads of one KV head (8 on Qwen3.6) each read the same K and V. At 84K one layer's fp32 K+V is ~344 MB, far above the L4's 48 MB L2. Doing the H / HKV query heads of a KV head in one block (load each K row and V row once) would cut the reads by that factor.
  2. The KV cache is fp32 on this path (alloc_session uses dalloc for kc / vc; setup.py's kv_bytes_per_token says "K and V in fp32 (strata-q36)"). The Flash-Next engine takes --kv fp16 / int8 / q4_0 / k8v4. fp16 or q8_0 here would halve or roughly quarter both the bytes read per token and the VRAM: on this model the 128K cache is ~6.5 GiB of a 22.5 GiB card, which is what leaves only 8 expert slots per layer.

Also in k_attn_part, each thread reads one cell's full 256-float K row (kp[i] over i), so neighbouring threads read addresses 1 KB apart; the V loop is laid out across threads.

Not tested: a fixed kernel, fp16 KV, other context settings, and whether the L4 answers at 116K were right (my probe's output was lost on that run).

<!-- gh-comment-id:6323500641 --> @kirinriki7777-sys commented on GitHub (Oct 21, 2026): Another data point for the decode-vs-context fall on the Qwen3.6 engine path, this time with a larger `qwen35moe` model (Ornith-1.5-122B, 32 query / 2 KV heads, 12 full-attention layers + the MTP block; the setup and the patch needed to load it are in #3574). Same L4 box and the same documents as my comment above. `--max-context 131072`, `STRATA_Q8_PACKED=0`, 8 expert slots per layer, sampled chat requests (no drafts), decode from the server's `session 0:` lines: | prompt tokens | decode tok/s | prompt read tok/s | Qwen3.6-35B-A3B on the same card (earlier comment) | |---:|---:|---:|---| | 18,671 | 6.0 | 485 | 28.2 at 16,511 | | 42,204 | 2.8 | 476 | 12.2 at 35,149 | | 83,802 | 1.8 | 317 | 6.2 at 70,176 | | 116,130 | 1.4 | 207 | 4.1 at 116,130 | Between 18.7K and 83.8K the time per token grows by about 6.0 ms per 1,000 tokens of context (Qwen3.6: about 2.3 ms). The ratio, 2.6, is close to the ratio of query heads x attention layers, (32 x 13) / (16 x 11) = 2.36. **The same model with every expert in VRAM** (Colab A100 80 GB, same file, same patch, same documents, `every routed expert in VRAM (44.69 GiB)`, no CPU pool): 64.0 tok/s on a 2.5K prompt, 35.4 at 18,671, 13.3 at 83,802. Answers were right at both lengths. The growth there is 0.72 ms per 1,000 tokens, 8.3x less than on the L4, close to the ratio of the two cards' memory bandwidth. If every query head reads the fp32 K and V of its cells, 1,000 cells cost 13 layers x 32 heads x 1,000 x 256 x 4 B x 2 = 852 MB per token: that is ~1.18 TB/s on the A100 and ~142 GB/s on the L4, i.e. both cards look bandwidth-bound on these reads. Reading `k_attn_part` (`src/qwen35/q36_engine.cu`), two things look like they would give exactly this shape. I have not profiled the kernel, so please treat this as a reading of the code, not a measurement: 1. **Each query head reads the K/V cells on its own.** The grid is (chunks of 256 cells, `T * H` rows) and a block maps its row to `kvh = h / (H / HKV)`, so the 16 query heads of one KV head (8 on Qwen3.6) each read the same K and V. At 84K one layer's fp32 K+V is ~344 MB, far above the L4's 48 MB L2. Doing the `H / HKV` query heads of a KV head in one block (load each K row and V row once) would cut the reads by that factor. 2. **The KV cache is fp32 on this path** (`alloc_session` uses `dalloc` for `kc` / `vc`; setup.py's `kv_bytes_per_token` says "K and V in fp32 (strata-q36)"). The Flash-Next engine takes `--kv fp16 / int8 / q4_0 / k8v4`. fp16 or q8_0 here would halve or roughly quarter both the bytes read per token and the VRAM: on this model the 128K cache is ~6.5 GiB of a 22.5 GiB card, which is what leaves only 8 expert slots per layer. Also in `k_attn_part`, each thread reads one cell's full 256-float K row (`kp[i]` over `i`), so neighbouring threads read addresses 1 KB apart; the V loop is laid out across threads. Not tested: a fixed kernel, fp16 KV, other context settings, and whether the L4 answers at 116K were right (my probe's output was lost on that run).
Author
Owner

@storm-ace commented on GitHub (Nov 3, 2026):

Another data point, on AMD: the same decode fall on a Strix Halo (Radeon 8060S, gfx1151, Windows), and what the GQA-group read and an FP16 cache give there. The fix itself is the one in #3903; I am not opening a competing PR, these are measurements.

Environment: Ryzen AI MAX+ PRO 395, Radeon 8060S (gfx1151, unified memory, ~200 GB/s), Windows 11, engine 0.1.55 built from c62d5e3a with tools/hip/build_windows.bat (STRATA_HIP_ARCHS=gfx1151, ROCm 10.2.0a20260930), Qwen3.6-35B-A3B UD-Q4_K_XL, every routed expert in VRAM, --max-context 131072 --prefill auto --mtp 2.

The fall (unchanged engine 0.1.55), through the server, salted prompts of q36_engine.cu source, nothing reused, temperature 0.6 (so no drafts), 300 new tokens, the engine's session 0: lines:

prompt tokens decode tok/s
8,938 36.7
35,602 13.9

The same requests after reading each K / V cell once per GQA group (one block per KV head and 256-cell chunk computing its 8 query heads, K staged in LDS and loaded coalesced; same idea as #3903's --gqa-attn, written independently on storm-ace/Strata q36-strix-halo, commit fbf6976a):

prompt tokens decode tok/s
8,957 37.0
35,654 27.1

Each head keeps k_attn_part's summation order, so STRATA_Q36_VERIFY=1 --no-graph on a 2,600-token prompt reported 22512 comparisons, 0 mismatches.

The MTP verify window (the follow-up above about dim3(nc, nt * H)): launching the window's rows on the same chunk next to each other (grid (rows, chunks)) so they meet the chunk's cells in cache took sampled decode with drafts at ~36K from 29.1 to 33.2 tok/s (one request each).

FP16 K / V cache on top (--bench-pp 65536 --bench-tg 64, greedy, no drafts; three arms in this order, each a fresh start with 3 repetitions):

cache decode after 64K (rep 0 / 1 / 2)
FP32 20.8 / 23.7 / 21.6 tok/s
FP16 23.5 / 25.1 / 24.2
FP32 again 20.6 / 20.9 / 21.1

KL of the FP16 cache against FP32 (1,229-token real-text prompt, 32 teacher-forced steps): 1.9e-6 mean, top-1 32 of 32.

Not run: #3903 / #3678 themselves on this card, other AMD cards, NVIDIA. If it helps the review of #3903, I can run that branch on this Strix Halo with the same requests.

<!-- gh-comment-id:6597808258 --> @storm-ace commented on GitHub (Nov 3, 2026): Another data point, on AMD: the same decode fall on a **Strix Halo (Radeon 8060S, gfx1151, Windows)**, and what the GQA-group read and an FP16 cache give there. The fix itself is the one in #3903; I am not opening a competing PR, these are measurements. **Environment:** Ryzen AI MAX+ PRO 395, Radeon 8060S (gfx1151, unified memory, ~200 GB/s), Windows 11, engine 0.1.55 built from `c62d5e3a` with `tools/hip/build_windows.bat` (`STRATA_HIP_ARCHS=gfx1151`, ROCm 10.2.0a20260930), Qwen3.6-35B-A3B UD-Q4_K_XL, every routed expert in VRAM, `--max-context 131072 --prefill auto --mtp 2`. **The fall (unchanged engine 0.1.55),** through the server, salted prompts of `q36_engine.cu` source, nothing reused, temperature 0.6 (so no drafts), 300 new tokens, the engine's `session 0:` lines: | prompt tokens | decode tok/s | | ---: | ---: | | 8,938 | 36.7 | | 35,602 | 13.9 | **The same requests after reading each K / V cell once per GQA group** (one block per KV head and 256-cell chunk computing its 8 query heads, K staged in LDS and loaded coalesced; same idea as #3903's `--gqa-attn`, written independently on [storm-ace/Strata `q36-strix-halo`](https://github.com/storm-ace/Strata/tree/q36-strix-halo), commit `fbf6976a`): | prompt tokens | decode tok/s | | ---: | ---: | | 8,957 | 37.0 | | 35,654 | 27.1 | Each head keeps `k_attn_part`'s summation order, so `STRATA_Q36_VERIFY=1 --no-graph` on a 2,600-token prompt reported `22512 comparisons, 0 mismatches`. **The MTP verify window** (the follow-up above about `dim3(nc, nt * H)`): launching the window's rows on the same chunk next to each other (grid `(rows, chunks)`) so they meet the chunk's cells in cache took sampled decode with drafts at ~36K from 29.1 to 33.2 tok/s (one request each). **FP16 K / V cache** on top (`--bench-pp 65536 --bench-tg 64`, greedy, no drafts; three arms in this order, each a fresh start with 3 repetitions): | cache | decode after 64K (rep 0 / 1 / 2) | | --- | --- | | FP32 | 20.8 / 23.7 / 21.6 tok/s | | FP16 | 23.5 / 25.1 / 24.2 | | FP32 again | 20.6 / 20.9 / 21.1 | KL of the FP16 cache against FP32 (1,229-token real-text prompt, 32 teacher-forced steps): 1.9e-6 mean, top-1 32 of 32. **Not run:** #3903 / #3678 themselves on this card, other AMD cards, NVIDIA. If it helps the review of #3903, I can run that branch on this Strix Halo with the same requests.
Author
Owner

@pdmaclennan-art commented on GitHub (Nov 4, 2026):

Same shape on a Strix Halo laptop under Windows (gfx1151), on the 0.2.10 release (engine 0.1.56, windows-x86_64-hip-rdna3).

Machine: ASUS ProArt PX13, Ryzen AI Max+ 395, Radeon 8060S, 128 GB with a 96 GB BIOS carve-out, Windows 11 build 26300, AMD driver 32.0.22032.6002. Model: Unsloth Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238, UD-Q4_K_XL, setup's own settings (--native <gguf> --max-context 131072 --prefill auto --mtp 2), every routed expert in VRAM (18.75 GiB). The llama.cpp column is halo-box/strix-llama.cpp 93e6d0285 (gfx1151 ROCm build), -ngl 99 -fa on -b 2048 -ub 2048, on the same file, same day.

Fresh prompts, 256 new tokens, temperature 0 with presence_penalty: 0 (so the MTP drafts run), thinking on, one run each. Client-side TTFT s / decode tok/s:

Prompt tokens Strata --mtp 2 Strata --mtp 0 llama.cpp
4,033 5.5 / 67.2 5.3 / 49.0 2.1 / 51.6
16,034 27.2 / 35.7 26.1 / 31.3 7.7 / 50.0
32,036 69.7 / 12.8 66.1 / 14.3 18.1 / 42.2
64,036 212.3 / 6.4 198.0 / 7.6 48.6 / 39.9

The engine's own lines for the MTP run agree: 67.5 / 35.9 / 12.9 / 6.4 tok/s decode, prompt 733 / 591 / 460 / 302 tok/s. Full report, logs and a standard-v1 run: https://github.com/Niko1221/Strata/pull/5182.

For contrast, Flash-Next Q2_0 (setup's settings) on the same machine and harness held 49.3 / 37.3 / 39.5 / 44.2 tok/s decode at 4K / 16K / 32K / 64K, so the fall looks specific to the 35B path here too.

Not profiled here, so I can't say whether k_attn_part dominates on gfx1151 as on the V100.

<!-- gh-comment-id:6623864361 --> @pdmaclennan-art commented on GitHub (Nov 4, 2026): Same shape on a Strix Halo laptop under Windows (gfx1151), on the 0.2.10 release (engine 0.1.56, `windows-x86_64-hip-rdna3`). Machine: ASUS ProArt PX13, Ryzen AI Max+ 395, Radeon 8060S, 128 GB with a 96 GB BIOS carve-out, Windows 11 build 26300, AMD driver 32.0.22032.6002. Model: Unsloth Qwen3.6-35B-A3B-MTP-GGUF @ 5bc3e238, UD-Q4_K_XL, setup's own settings (`--native <gguf> --max-context 131072 --prefill auto --mtp 2`), every routed expert in VRAM (18.75 GiB). The llama.cpp column is halo-box/strix-llama.cpp `93e6d0285` (gfx1151 ROCm build), `-ngl 99 -fa on -b 2048 -ub 2048`, on the same file, same day. Fresh prompts, 256 new tokens, temperature 0 with `presence_penalty: 0` (so the MTP drafts run), thinking on, one run each. Client-side TTFT s / decode tok/s: | Prompt tokens | Strata `--mtp 2` | Strata `--mtp 0` | llama.cpp | | ---: | --- | --- | --- | | 4,033 | 5.5 / 67.2 | 5.3 / 49.0 | 2.1 / 51.6 | | 16,034 | 27.2 / 35.7 | 26.1 / 31.3 | 7.7 / 50.0 | | 32,036 | 69.7 / 12.8 | 66.1 / 14.3 | 18.1 / 42.2 | | 64,036 | 212.3 / 6.4 | 198.0 / 7.6 | 48.6 / 39.9 | The engine's own lines for the MTP run agree: 67.5 / 35.9 / 12.9 / 6.4 tok/s decode, prompt 733 / 591 / 460 / 302 tok/s. Full report, logs and a standard-v1 run: https://github.com/Niko1221/Strata/pull/5182. For contrast, Flash-Next Q2_0 (setup's settings) on the same machine and harness held 49.3 / 37.3 / 39.5 / 44.2 tok/s decode at 4K / 16K / 32K / 64K, so the fall looks specific to the 35B path here too. Not profiled here, so I can't say whether `k_attn_part` dominates on gfx1151 as on the V100.
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#1008
No description provided.