[GH-ISSUE #4332] [Engine] q36 hybrid mode: a 4096-token prompt chunk reads prompts 51-76% faster on a 16 GB card #1912

Open
opened 2026-11-04 01:55:16 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @rynwang on GitHub (Oct 27, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4332

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

Desktop app, Terminal or source? Source checkout, built from git

Reproduction status: Reproduced locally

Strata version: 0.2.11 (main 9f7d977, engine 0.1.57); first reported on 0.1.52. Built with the CUDA 12.4 toolkit and
-DSTRATA_ENABLE_CUDA=ON -DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES="61;89"

Graphics card, memory and system: RTX 4080 SUPER 16 GB (sm_89) and GTX 1080 Ti 11 GB (sm_61, not part of this
model's run), WSL2 Ubuntu 22.04 on an i7-14700KF (14C/28T), 24 GB of RAM given to WSL, driver 581.80. The engine and
the model file are on ext4 (not the 9p drive).

Model, size and settings: Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf (Unsloth, 22.85 GB, sha256
55983c5a75a1ab969824077b3bb3de4146e82a9234072b48ad4e8f92ad3fe9f1), run as
./strata --model ... --gpu 0 --max-context <8192|32768|65536> --tokens <4096 token ids> --n 128 --mtp 2 --chunk <2048|4096>.

What I measured

On a 16 GB card this model runs in the hybrid mode (79 of 256 experts per layer in VRAM at 8K context). The prompt
chunk there is picked by a fixed rule — 2048 above 7.5 GiB free, 1024 above 5.5, else 512 — with no 4096 arm. A prompt
chunk streams every layer's experts over PCIe once, so the cost is paid per chunk, not per token: a 4096-token prompt
(three alternating runs per arm, same binary, medians):

cells chunk prompt tok/s (ms) decode tok/s experts in VRAM
8192 2048 840 (4,830 / 4,872 / 4,885) 61.9 79 / 256
8192 4096 1,272 (3,224 / 3,208 / 3,218) 61.8 66 / 256
32768 2048 779 (5,256 / 5,370 / 5,032) 51.7 63 / 256
32768 4096 1,372 (3,120 / 2,847 / 2,852) 54.1 50 / 256

The decode does not pay for the bigger chunk here, and at 32K it gained (the MTP drafts were accepted more often in
the 4096 arm: 64% against 57%). Prompt time to first token is where the difference shows: 4.9 s against 3.2 s at 8K.

The same model also boots on the 11 GB GTX 1080 Ti (sm_61, 16 experts per layer), so the family's Pascal path runs;
that card is not part of the numbers above.

Re-tested on 0.2.11 (2026-11-06)

Rebuilt main 9f7d977 and repeated the 8,192-cell arm (4,096-token prompt, 128 generated, --mtp 2, two alternating
pairs): --chunk 2048 5,016.5 / 5,084.1 ms against the 4,096 chunk's 2,923.8 / 3,025.7 ms (1.70x prompt), decode
59.8 / 60.9 against 59.5 / 59.7 tok/s. The hybrid rule in 0.2.11 still has no 4,096 arm, so the report still applies.

Proposal

Take 4096 in the hybrid branch when the chunk's buffers (0.5 MiB per token, measured 0.47) fit in a third of the room
the expert slots keep at a 512-token chunk:

room = fr_raw - 2.97 GiB - ctx * n_attn * n_head_kv * head_dim * 8   # 2.97 GiB: engine buffers, staging pair, reserve
chunk = 4096 if (4096 - 512) * 0.5 MiB <= room / 3

and keep today's rule otherwise. On this card that is 4096 at 8K and 32K, and 2048 at 64K, where the K / V cache
comes out of the same room first (measured: 4.89 GiB free after init, 41 experts per layer, prompt 764 tok/s — the
same arm as 2048 today). A 12 GB card keeps 2048, where docs/QWEN36.md measured a 13% decode loss for chunk 4096 on
an RTX 3060.

This changes a default, so I am asking here before opening the pull request (CONTRIBUTING.md). I have the change and
the A/B ready, and I can test any other context sizes or cards you want numbers from.

What I have not tested

  • 12 GB and 8 GB cards. The rule's boundary comes from the measured 0.5 MiB/token and the RTX 3060 line already in
    the docs; only the 16 GB case is measured here.
  • Batch / parallel requests (the change keeps the smaller chunk there).
  • HIP, SYCL, Metal, and the Windows build.
Originally created by @rynwang on GitHub (Oct 27, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4332 **Area:** `[Engine]` (speed, kernels, models, the server and API) **Desktop app, Terminal or source?** Source checkout, built from git **Reproduction status:** Reproduced locally **Strata version:** 0.2.11 (`main` 9f7d977, engine 0.1.57); first reported on 0.1.52. Built with the CUDA 12.4 toolkit and `-DSTRATA_ENABLE_CUDA=ON -DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES="61;89"` **Graphics card, memory and system:** RTX 4080 SUPER 16 GB (sm_89) and GTX 1080 Ti 11 GB (sm_61, not part of this model's run), WSL2 Ubuntu 22.04 on an i7-14700KF (14C/28T), 24 GB of RAM given to WSL, driver 581.80. The engine and the model file are on ext4 (not the 9p drive). **Model, size and settings:** `Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf` (Unsloth, 22.85 GB, sha256 `55983c5a75a1ab969824077b3bb3de4146e82a9234072b48ad4e8f92ad3fe9f1`), run as `./strata --model ... --gpu 0 --max-context <8192|32768|65536> --tokens <4096 token ids> --n 128 --mtp 2 --chunk <2048|4096>`. ## What I measured On a 16 GB card this model runs in the hybrid mode (79 of 256 experts per layer in VRAM at 8K context). The prompt chunk there is picked by a fixed rule — 2048 above 7.5 GiB free, 1024 above 5.5, else 512 — with no 4096 arm. A prompt chunk streams every layer's experts over PCIe once, so the cost is paid per chunk, not per token: a 4096-token prompt (three alternating runs per arm, same binary, medians): | cells | chunk | prompt tok/s (ms) | decode tok/s | experts in VRAM | | --- | --- | --- | --- | --- | | 8192 | 2048 | 840 (4,830 / 4,872 / 4,885) | 61.9 | 79 / 256 | | 8192 | 4096 | **1,272** (3,224 / 3,208 / 3,218) | 61.8 | 66 / 256 | | 32768 | 2048 | 779 (5,256 / 5,370 / 5,032) | 51.7 | 63 / 256 | | 32768 | 4096 | **1,372** (3,120 / 2,847 / 2,852) | 54.1 | 50 / 256 | The decode does not pay for the bigger chunk here, and at 32K it gained (the MTP drafts were accepted more often in the 4096 arm: 64% against 57%). Prompt time to first token is where the difference shows: 4.9 s against 3.2 s at 8K. The same model also boots on the 11 GB GTX 1080 Ti (sm_61, 16 experts per layer), so the family's Pascal path runs; that card is not part of the numbers above. ## Re-tested on 0.2.11 (2026-11-06) Rebuilt `main` 9f7d977 and repeated the 8,192-cell arm (4,096-token prompt, 128 generated, `--mtp 2`, two alternating pairs): `--chunk 2048` 5,016.5 / 5,084.1 ms against the 4,096 chunk's 2,923.8 / 3,025.7 ms (**1.70x** prompt), decode 59.8 / 60.9 against 59.5 / 59.7 tok/s. The hybrid rule in 0.2.11 still has no 4,096 arm, so the report still applies. ## Proposal Take 4096 in the hybrid branch when the chunk's buffers (0.5 MiB per token, measured 0.47) fit in a third of the room the expert slots keep at a 512-token chunk: ``` room = fr_raw - 2.97 GiB - ctx * n_attn * n_head_kv * head_dim * 8 # 2.97 GiB: engine buffers, staging pair, reserve chunk = 4096 if (4096 - 512) * 0.5 MiB <= room / 3 ``` and keep today's rule otherwise. On this card that is 4096 at 8K and 32K, and 2048 at 64K, where the K / V cache comes out of the same room first (measured: 4.89 GiB free after init, 41 experts per layer, prompt 764 tok/s — the same arm as 2048 today). A 12 GB card keeps 2048, where docs/QWEN36.md measured a 13% decode loss for chunk 4096 on an RTX 3060. This changes a default, so I am asking here before opening the pull request (CONTRIBUTING.md). I have the change and the A/B ready, and I can test any other context sizes or cards you want numbers from. ## What I have not tested - 12 GB and 8 GB cards. The rule's boundary comes from the measured 0.5 MiB/token and the RTX 3060 line already in the docs; only the 16 GB case is measured here. - Batch / parallel requests (the change keeps the smaller chunk there). - HIP, SYCL, Metal, and the Windows build.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. 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:6660272795 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. 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

@rynwang commented on GitHub (Nov 6, 2026):

Re-tested on 0.2.11 (main 9f7d977, engine 0.1.57), built from source here (CUDA 12.4, -DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES="61;89"), RTX 4080 SUPER 16 GB, WSL2 Ubuntu 22.04, driver 581.80, Qwen3.6-35B-A3B-UD-Q4_K_XL (22.85 GB, sha256 55983c5a75a1ab969824077b3bb3de4146e82a9234072b48ad4e8f92ad3fe9f1), --gpu 0 --max-context 8192 --tokens <4096 ids> --n 128 --mtp 2, two alternating pairs on the same binary, page cache dropped before each run:

arm prompt ms prompt tok/s decode tok/s
--chunk 2048 (0.2.11 behaviour) 5,016.5 / 5,084.1 808 59.8 / 60.9
auto (the PR's 4,096) 2,923.8 / 3,025.7 1,380 59.5 / 59.7

So the report still applies on 0.2.11: the hybrid rule there is unchanged (no 4,096 arm), and the 4,096 chunk reads a 4,096-token prompt 1.70x faster with the decode unchanged. The PR (#4335) is rebased onto 0.2.11 as 61caa0d and mergeable.

/reopen

<!-- gh-comment-id:6674097841 --> @rynwang commented on GitHub (Nov 6, 2026): Re-tested on 0.2.11 (`main` 9f7d977, engine 0.1.57), built from source here (CUDA 12.4, `-DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES="61;89"`), RTX 4080 SUPER 16 GB, WSL2 Ubuntu 22.04, driver 581.80, Qwen3.6-35B-A3B-UD-Q4_K_XL (22.85 GB, sha256 `55983c5a75a1ab969824077b3bb3de4146e82a9234072b48ad4e8f92ad3fe9f1`), `--gpu 0 --max-context 8192 --tokens <4096 ids> --n 128 --mtp 2`, two alternating pairs on the same binary, page cache dropped before each run: | arm | prompt ms | prompt tok/s | decode tok/s | | --- | --- | --- | --- | | `--chunk 2048` (0.2.11 behaviour) | 5,016.5 / 5,084.1 | 808 | 59.8 / 60.9 | | auto (the PR's 4,096) | 2,923.8 / 3,025.7 | **1,380** | 59.5 / 59.7 | So the report still applies on 0.2.11: the hybrid rule there is unchanged (no 4,096 arm), and the 4,096 chunk reads a 4,096-token prompt **1.70x** faster with the decode unchanged. The PR (#4335) is rebased onto 0.2.11 as `61caa0d` and mergeable. /reopen
Author
Owner

@rynwang commented on GitHub (Nov 6, 2026):

/reopen

Re-tested on 0.2.11 today (see the body): 8,192 cells, 4,096-token prompt -> 5,016/5,084 ms at --chunk 2048 against 2,923/3,025 ms with 4,096, decode unchanged. The hybrid rule in 0.2.11 still has no 4,096 arm, so this still applies.

<!-- gh-comment-id:6674135323 --> @rynwang commented on GitHub (Nov 6, 2026): /reopen Re-tested on 0.2.11 today (see the body): 8,192 cells, 4,096-token prompt -> 5,016/5,084 ms at `--chunk 2048` against 2,923/3,025 ms with 4,096, decode unchanged. The hybrid rule in 0.2.11 still has no 4,096 arm, so this still applies.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 6, 2026):

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

<!-- gh-comment-id:6674138961 --> @github-actions[bot] commented on GitHub (Nov 6, 2026): Reopened, thank you. A maintainer will pick it up from here.
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#1912
No description provided.