[PR #3909] [Engine] qwen35: agent turns continue from cached state (--snapshots, --snapshot-host, splice_turns) #4827

Open
opened 2026-11-07 15:39:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3909
Author: @xyehya
Created: 10/24/2026
Status: 🔄 Open

Base: main ← Head: pr/q36-08-agent-turns


📝 Commits (10+)

  • 1883224 [Engine] qwen35: accept Q4_K down-projection experts
  • 9903b66 [Engine] qwen35: a parity case for the Q4_K down experts at FF 512
  • aab82b7 [Engine] qwen35: --kv int8 for the qwen35moe engine, and --tokens-file
  • 0a2b727 [Engine] qwen35: grouped-query decode attention (#3641's kernel), --kv fp16 and k8v4
  • 73ba60e [Engine] qwen35: int8 decode attention reads the cache through shared memory, one pass per verify window
  • efb3066 [Engine] qwen35: --attn-mma, decode attention on tensor cores for the int8 cache (not bit-identical)
  • 6e21c89 [Engine] qwen35: --fused-prompt-attn, the prompt attention in one tensor-core kernel from the int8 cache
  • 022982d [Engine] qwen35: --chunked-gdn, the prompt's gated delta rule in pieces of 16 tokens
  • a3c2dc4 [Engine] qwen35: k_add_rms_q and k_moe_out in registers with a one-barrier same-order sum
  • 9017b2f [Engine] qwen35: --side-stream: z, alpha / beta (and the attention k, v) on a stream beside the first matrix

📊 Changes

27 files changed (+6772 additions, -257 deletions)

View changed files

📝 CMakeLists.txt (+39 -0)
📝 apps/host/server/run-config-check.mjs (+1 -1)
📝 apps/host/tests/run-config-check.test.mjs (+5 -0)
📝 docs/DETAILS.md (+7 -0)
📝 docs/QWEN36.md (+252 -3)
📝 include/strata/kernels/cpu/pool.hpp (+40 -1)
📝 serve/server.py (+44 -5)
➕ serve/test_turn_splice.py (+171 -0)
➕ serve/turn_splice.py (+177 -0)
📝 setup.py (+2 -2)
📝 src/kernels/cpu/pool.cpp (+170 -37)
➕ src/kernels/cpu/pool_warm_test.cpp (+88 -0)
📝 src/kernels/cuda/iq_kernels.cu (+3 -3)
📝 src/kernels/native_expert_parity.cpp (+7 -2)
➕ src/qwen35/q36_attn.cuh (+890 -0)
📝 src/qwen35/q36_engine.cu (+2055 -199)
➕ src/qwen35/q36_gdn.cuh (+258 -0)
📝 src/qwen35/q36_kernels.cuh (+113 -4)
➕ src/qwen35/q36_pattn.cuh (+297 -0)
➕ src/qwen35/q36_sampling.hpp (+320 -0)

...and 7 more files

📄 Description

Series (each stacked on the one before; review in order): #3699 → #3903 → #3904 → #3905 → #3906 → #3907 → #3908 → #3909 → #3910. Scope discussion: #3700. This is 8 of 9; it builds on #3908.

Branch pr/q36-08-agent-turns, stacked on pr/q36-07-mtp-sampled.

Problem and result

The engine continues a conversation only when the new prompt starts with every token it holds (the DeltaNet state cannot step back). An agent's reply comes back as text and is encoded again; about once in 8,000 sampled tokens the model wrote a piece of text in other tokens than the tokenizer's own split, and the whole conversation is read again: 80-105K tokens, 30-45 s in the hybrid mode on an RTX 5080 with DDR5-6400 dual channel (two long agent sessions, a Qwen3.6-35B-A3B fine-tune). Three opt-ins. The server half (splice_turns, Python) and the engine half (--snapshots, --snapshot-host, C++) are independent: they share the problem, not code, so they can be opened as two PRs; the branch has them as two commits (snapshots + splicing, then --snapshot-host):

  • "splice_turns": true | "parsed" in strata-<model>.json (or STRATA_SPLICE_TURNS=1): a reply that comes back as the same text (parsed: the same reasoning, answer and calls) is sent as the ids the model wrote. A reply that holds a control token the model wrote is never spliced.
  • --snapshots K (--snapshot-min N): K copies of a session's recurrent state, taken after long prompt reads; a prompt that parts from the held tokens after one restores it and reads only the rest.
  • --snapshot-host: the snapshots in pinned host memory (62.8 MiB each leave VRAM, which the expert slots get).

Result on an RTX 5080 16 GB (same day, --max-context 262144, serve protocol, level 07 and level 08 with the flags off against level 08 with --snapshots 2 --snapshot-host; runs in Validation): the re-read after a re-encoded reply goes from a full re-read to a restore: an 88K-token conversation 19.2 s (all 88,064 tokens read) -> 0.28 s (87,700 reused, 364 read); a 40K one 6.71 s -> 0.26 s (40,000 reused, 364 read). Fresh reads (19.15 to 19.22 s at 87,700 tokens) and decode (243.9 against 243.0 tok/s at 4K, 220.2 against 220.2 at 40K) are unchanged. splice_turns is Python and was not exercised in the timing pass.

none yet. Not related to a filed issue that I found.

Approach

Everything is off by default. serve/turn_splice.py keeps, per recent conversation, the prompt the server sent and the ids generated after it, and splices only after an engine run of one pass (a wrap-up, tool-call opening or recovery pass reads another prompt). encode_prompt is split in two so the rendered text is available; with the option off the same code runs. STRATA_REUSE_DIAG=1 makes the engine and the server say where a prompt parts from the held tokens; it logs conversation content (a few tokens and the text there), so it is off by default and documented as such. docs/QWEN36.md and docs/DETAILS.md describe the options.

Validation

Revision: branch pr/q36-08-agent-turns (44ae57c), level 07 below it, origin/main 5c8dd32. Environment: Fedora 44 (Linux 7.2.11), CUDA 13.4.92 with g++-15 as host compiler, RTX 5080 16 GB (driver 615.78.08), Core Ultra 9 285K, 61 GB DDR5, 6400 MT/s configured, Sage-A1.5 Q4_K_M with the BF16 ssm_alpha/ssm_beta graft (the file of #3699).

Passed:

  • Build CUDA sm_120 and "75;120" (commands as in the level-01 PR), target strata and the earlier test tools.

  • python3 -m unittest serve.test_turn_splice: 8 tests OK (run on the level-09 tree, which has the same Python files).

  • splice_turns is a known key of the app's run-config check (apps/host/server/run-config-check.mjs, with a case in apps/host/tests/run-config-check.test.mjs); checked by loading the module and calling checkRunConfig; the node test file itself was not run (its esbuild dependency is not installed here).

  • Default path against level 01's binary, flags off, fixed 56 slots: logits cmp at 4K / 14K IDENTICAL / IDENTICAL; gate_a.sh against level 02's binary IDENTICAL / IDENTICAL.

  • Free-running slot count unchanged: 90 of 256 (fp32, 65K), 82 (int8, 262144).

  • The submitted revision 44ae57c against the timed one (the revision before the last amend of the stack), full-logit cmp with the flags of level 08 on both sides (--snapshots 2 --snapshot-host on top of level 07's, fixed 56 slots, 4K and 14K): IDENTICAL / IDENTICAL (64,563,200 bytes each), so the timings hold for the submitted revision.

Timing (same box and day, 2026-10-23; one cold engine per run under the GPU lock; the binaries are the revisions before the last amend of the stack; $PROFILE is an expert profile saved from an agent session, not in the repository). <07 flags> = --kv int8 --gqa-attn --fused-prompt-attn --chunked-gdn --side-stream --split-stage-copy --expert-profile $PROFILE --expert-prefetch 2 --hybrid-zero-copy --decode-swaps 64 --async-swaps --lend-staging --pool-warm 3 --prefetch-copies 0 --mtp-sampled q --sample-gpu. The CLI cannot send a second prompt, so the re-read goes through --serve:

strata --serve --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <07 flags> [--snapshots 2 --snapshot-host] --mtp 0
GEN 64 <ids[:BASE]>                                   # turn 1: fresh read; the 64 reply tokens R1 are held
GEN 1 <ids[:BASE] + R1' + ids[BASE:BASE+300]>          # R1' = R1 with token 10 replaced: parts from the held tokens 64 tokens after BASE
GEN 1 <ids[:BASE] + R1 + ids[BASE:BASE+300]>           # the original reply again (a second restore, not a plain reuse)

BASE is 40,000 (prompt of 40,960 ids) or 87,700 (prompt of 90,112 ids). The number kept is the engine's own line prompt N tokens = R reused + W read in MS ms. Per run: reused + read tokens, engine read ms:

request level 07, flags level 08, flags off level 08, --snapshots 2 --snapshot-host
40K fresh 0 + 40000, 6667 ms; 0 + 40000, 6663 ms 0 + 40000, 6661 ms 0 + 40000, 6669 ms; 0 + 40000, 6668 ms
40K re-encoded reply 0 + 40364, 6710 ms; 0 + 40364, 6711 ms 0 + 40364, 6709 ms 40000 + 364, 256 ms; 40000 + 364, 255 ms
40K original reply, after that 0 + 40364, 6723 ms; 0 + 40364, 6716 ms 0 + 40364, 6716 ms 40000 + 364, 255 ms; 40000 + 364, 255 ms
88K fresh 0 + 87700, 19150 ms; 0 + 87700, 19172 ms 0 + 87700, 19219 ms 0 + 87700, 19201 ms; 0 + 87700, 19135 ms
88K re-encoded reply 0 + 88064, 19249 ms; 0 + 88064, 19237 ms 0 + 88064, 19261 ms 87700 + 364, 276 ms; 87700 + 364, 275 ms
88K original reply, after that 0 + 88064, 19301 ms; 0 + 88064, 19301 ms 0 + 88064, 19310 ms 87700 + 364, 275 ms; 87700 + 364, 275 ms

Decode (CLI, forced 256 tokens, --mtp 0, same flags as above, with --tokens-file $P --n 256 --force "$G"), tok/s, individual runs, then the mean. Experts per layer in VRAM: 92 for all but the --snapshots 2 row, which holds the two 62.8 MiB snapshots in VRAM and has 90:

arm tg 4,096 tg 40,960
level 07, flags 244.2 / 241.8 = 243.0 220 / 220.3 = 220.2
level 08, flags off 244.5 / 243.5 = 244.0 220.2 / 220.2 = 220.2
level 08, --snapshots 2 --snapshot-host 243.8 / 244.1 / 243.9 / 243.7 = 243.9 220.2 / 220.4 / 220.3 / 220 = 220.2
level 08, --snapshots 2 (snapshots in VRAM, 90 slots) 239.2 / 243.9 = 241.6 (-0.9% against the row above) 219.5 / 219.1 = 219.3 (-0.4%)

The last row against the one above it is two runs against four, inside the noise. A host snapshot takes 1.6 ms to the host and 1.2 ms back (Limits).

Failed: none observed.

Not run:

  • STRATA_Q36_SNAPSHOT_TEST (a restore is bit-exact against the same split read) and tools/qwen35/q36_snapshot_check.py on this branch.
  • serve/test_server.py and the rest of the Python suite (only serve.test_turn_splice ran).
  • tools/reuse_replay.py on a recorded session; splice_turns in the timing pass.
  • The control request order "plain prefix reuse before the re-encoded request" (FU8_ORDER=control-first): the third request above is a second restore, not a plain reuse.
  • A 16K prompt.
  • splice_turns against a real agent client on this branch; --batch slots with snapshots; pictures (splicing is skipped for requests with images).
  • HIP and SYCL builds (cudaMemcpyDefault is used for the host snapshots; never compiled for HIP).

Limits

  • Snapshots cover the recurrent state and the first cache cells; K is at most 4. Each costs 62.8 MiB (VRAM or pinned host memory) per session.
  • A host snapshot takes 1.6 ms to the host and 1.2 ms back (RTX 5080, PCIe 5.0 x16, 262,144 cells, int8 KV).
  • STRATA_REUSE_DIAG=1 logs conversation content; it is off by default and the docs say so where it is described.

Not specific to Sage-A1.5

Sage-A1.5 is a fine-tune of Qwen3.6-35B-A3B with the same architecture and tensor layout, so this path runs the base model
unchanged. The before/after numbers above are Sage-A1.5's. The base model was measured once, on my fork's build of the whole series
(xyehya/Strata branch q36-r2: these PRs' flags on, plus a few fork-only defaults), same card and server sweep, with
STRATA_Q8_PACKED=0 (that file keeps its attention and DeltaNet matrices in Q8_0, and the packed copy would take 1.9 GiB
from the expert slots): Unsloth's Qwen3.6-35B-A3B-UD-Q4_K_XL (from unsloth/Qwen3.6-35B-A3B-MTP-GGUF),
262K int8 cache, decode 221 / 208 / 199 / 187 / 164 / 159 tok/s and prompt read 6,473 / 7,010 / 6,277 / 4,656 / 3,411 /
2,506 tok/s at 4K / 16K / 40K / 90K / 160K / 240K (Sage-A1.5 on the same build: decode 231 / 210 / 213 / 187 / 179 / 162).
Not measured: this PR's own before/after on the base model.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3909 **Author:** [@xyehya](https://github.com/xyehya) **Created:** 10/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/q36-08-agent-turns` --- ### 📝 Commits (10+) - [`1883224`](https://github.com/Niko1221/Strata/commit/1883224f75d2f2fc29aa303e750c2918385f0af4) [Engine] qwen35: accept Q4_K down-projection experts - [`9903b66`](https://github.com/Niko1221/Strata/commit/9903b6609a29b699c088f78f29810d16458d45f8) [Engine] qwen35: a parity case for the Q4_K down experts at FF 512 - [`aab82b7`](https://github.com/Niko1221/Strata/commit/aab82b73b4a3c0be261c5432dc65d455ac216155) [Engine] qwen35: --kv int8 for the qwen35moe engine, and --tokens-file - [`0a2b727`](https://github.com/Niko1221/Strata/commit/0a2b72720c69800b811f8baea30fdfb4bb164ef3) [Engine] qwen35: grouped-query decode attention (#3641's kernel), --kv fp16 and k8v4 - [`73ba60e`](https://github.com/Niko1221/Strata/commit/73ba60e899f38d6698e9d857d04b7e08a3a4b54c) [Engine] qwen35: int8 decode attention reads the cache through shared memory, one pass per verify window - [`efb3066`](https://github.com/Niko1221/Strata/commit/efb3066fc0908c060cbccf749741d848381f2124) [Engine] qwen35: --attn-mma, decode attention on tensor cores for the int8 cache (not bit-identical) - [`6e21c89`](https://github.com/Niko1221/Strata/commit/6e21c895f215690eae1ae196b428e1090fcc1db9) [Engine] qwen35: --fused-prompt-attn, the prompt attention in one tensor-core kernel from the int8 cache - [`022982d`](https://github.com/Niko1221/Strata/commit/022982df36843763f7f43978bf3259d95a3948d0) [Engine] qwen35: --chunked-gdn, the prompt's gated delta rule in pieces of 16 tokens - [`a3c2dc4`](https://github.com/Niko1221/Strata/commit/a3c2dc4c8a7f9aaec120cd0594efe9893d4b95db) [Engine] qwen35: k_add_rms_q and k_moe_out in registers with a one-barrier same-order sum - [`9017b2f`](https://github.com/Niko1221/Strata/commit/9017b2fd45cea7a63e871a21c523d1065fe455eb) [Engine] qwen35: --side-stream: z, alpha / beta (and the attention k, v) on a stream beside the first matrix ### 📊 Changes **27 files changed** (+6772 additions, -257 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+39 -0) 📝 `apps/host/server/run-config-check.mjs` (+1 -1) 📝 `apps/host/tests/run-config-check.test.mjs` (+5 -0) 📝 `docs/DETAILS.md` (+7 -0) 📝 `docs/QWEN36.md` (+252 -3) 📝 `include/strata/kernels/cpu/pool.hpp` (+40 -1) 📝 `serve/server.py` (+44 -5) ➕ `serve/test_turn_splice.py` (+171 -0) ➕ `serve/turn_splice.py` (+177 -0) 📝 `setup.py` (+2 -2) 📝 `src/kernels/cpu/pool.cpp` (+170 -37) ➕ `src/kernels/cpu/pool_warm_test.cpp` (+88 -0) 📝 `src/kernels/cuda/iq_kernels.cu` (+3 -3) 📝 `src/kernels/native_expert_parity.cpp` (+7 -2) ➕ `src/qwen35/q36_attn.cuh` (+890 -0) 📝 `src/qwen35/q36_engine.cu` (+2055 -199) ➕ `src/qwen35/q36_gdn.cuh` (+258 -0) 📝 `src/qwen35/q36_kernels.cuh` (+113 -4) ➕ `src/qwen35/q36_pattn.cuh` (+297 -0) ➕ `src/qwen35/q36_sampling.hpp` (+320 -0) _...and 7 more files_ </details> ### 📄 Description Series (each stacked on the one before; review in order): #3699 → #3903 → #3904 → #3905 → #3906 → #3907 → #3908 → #3909 → #3910. Scope discussion: #3700. This is 8 of 9; it builds on #3908. Branch `pr/q36-08-agent-turns`, stacked on `pr/q36-07-mtp-sampled`. ## Problem and result The engine continues a conversation only when the new prompt starts with every token it holds (the DeltaNet state cannot step back). An agent's reply comes back as text and is encoded again; about once in 8,000 sampled tokens the model wrote a piece of text in other tokens than the tokenizer's own split, and the whole conversation is read again: 80-105K tokens, 30-45 s in the hybrid mode on an RTX 5080 with DDR5-6400 dual channel (two long agent sessions, a Qwen3.6-35B-A3B fine-tune). Three opt-ins. **The server half (`splice_turns`, Python) and the engine half (`--snapshots`, `--snapshot-host`, C++) are independent**: they share the problem, not code, so they can be opened as two PRs; the branch has them as two commits (snapshots + splicing, then `--snapshot-host`): - `"splice_turns": true | "parsed"` in `strata-<model>.json` (or `STRATA_SPLICE_TURNS=1`): a reply that comes back as the same text (`parsed`: the same reasoning, answer and calls) is sent as the ids the model wrote. A reply that holds a control token the model wrote is never spliced. - `--snapshots K` (`--snapshot-min N`): K copies of a session's recurrent state, taken after long prompt reads; a prompt that parts from the held tokens after one restores it and reads only the rest. - `--snapshot-host`: the snapshots in pinned host memory (62.8 MiB each leave VRAM, which the expert slots get). Result on an RTX 5080 16 GB (same day, `--max-context 262144`, serve protocol, level 07 and level 08 with the flags off against level 08 with `--snapshots 2 --snapshot-host`; runs in Validation): the re-read after a re-encoded reply goes from a full re-read to a restore: an 88K-token conversation 19.2 s (all 88,064 tokens read) -> 0.28 s (87,700 reused, 364 read); a 40K one 6.71 s -> 0.26 s (40,000 reused, 364 read). Fresh reads (19.15 to 19.22 s at 87,700 tokens) and decode (243.9 against 243.0 tok/s at 4K, 220.2 against 220.2 at 40K) are unchanged. `splice_turns` is Python and was not exercised in the timing pass. ## Related discussion none yet. Not related to a filed issue that I found. ## Approach Everything is off by default. `serve/turn_splice.py` keeps, per recent conversation, the prompt the server sent and the ids generated after it, and splices only after an engine run of one pass (a wrap-up, tool-call opening or recovery pass reads another prompt). `encode_prompt` is split in two so the rendered text is available; with the option off the same code runs. `STRATA_REUSE_DIAG=1` makes the engine and the server say where a prompt parts from the held tokens; it **logs conversation content** (a few tokens and the text there), so it is off by default and documented as such. `docs/QWEN36.md` and `docs/DETAILS.md` describe the options. ## Validation Revision: branch `pr/q36-08-agent-turns` (44ae57c), level 07 below it, `origin/main` 5c8dd32. Environment: Fedora 44 (Linux 7.2.11), CUDA 13.4.92 with g++-15 as host compiler, RTX 5080 16 GB (driver 615.78.08), Core Ultra 9 285K, 61 GB DDR5, 6400 MT/s configured, Sage-A1.5 Q4_K_M with the BF16 `ssm_alpha`/`ssm_beta` graft (the file of #3699). **Passed:** - Build CUDA sm_120 and "75;120" (commands as in the level-01 PR), target `strata` and the earlier test tools. - `python3 -m unittest serve.test_turn_splice`: 8 tests OK (run on the level-09 tree, which has the same Python files). - `splice_turns` is a known key of the app's run-config check (`apps/host/server/run-config-check.mjs`, with a case in `apps/host/tests/run-config-check.test.mjs`); checked by loading the module and calling `checkRunConfig`; the node test file itself was not run (its `esbuild` dependency is not installed here). - Default path against level 01's binary, flags off, fixed 56 slots: logits `cmp` at 4K / 14K IDENTICAL / IDENTICAL; `gate_a.sh` against level 02's binary IDENTICAL / IDENTICAL. - Free-running slot count unchanged: 90 of 256 (fp32, 65K), 82 (int8, 262144). - The submitted revision `44ae57c` against the timed one (the revision before the last amend of the stack), full-logit `cmp` with the flags of level 08 on both sides (`--snapshots 2 --snapshot-host` on top of level 07's, fixed 56 slots, 4K and 14K): IDENTICAL / IDENTICAL (64,563,200 bytes each), so the timings hold for the submitted revision. **Timing** (same box and day, 2026-10-23; one cold engine per run under the GPU lock; the binaries are the revisions before the last amend of the stack; `$PROFILE` is an expert profile saved from an agent session, not in the repository). `<07 flags>` = `--kv int8 --gqa-attn --fused-prompt-attn --chunked-gdn --side-stream --split-stage-copy --expert-profile $PROFILE --expert-prefetch 2 --hybrid-zero-copy --decode-swaps 64 --async-swaps --lend-staging --pool-warm 3 --prefetch-copies 0 --mtp-sampled q --sample-gpu`. The CLI cannot send a second prompt, so the re-read goes through `--serve`: ``` strata --serve --native $MODEL --max-context 262144 --prefill auto --pool-workers 16 <07 flags> [--snapshots 2 --snapshot-host] --mtp 0 GEN 64 <ids[:BASE]> # turn 1: fresh read; the 64 reply tokens R1 are held GEN 1 <ids[:BASE] + R1' + ids[BASE:BASE+300]> # R1' = R1 with token 10 replaced: parts from the held tokens 64 tokens after BASE GEN 1 <ids[:BASE] + R1 + ids[BASE:BASE+300]> # the original reply again (a second restore, not a plain reuse) ``` BASE is 40,000 (prompt of 40,960 ids) or 87,700 (prompt of 90,112 ids). The number kept is the engine's own line `prompt N tokens = R reused + W read in MS ms`. Per run: reused + read tokens, engine read ms: | request | level 07, flags | level 08, flags off | level 08, `--snapshots 2 --snapshot-host` | |---|---|---|---| | 40K fresh | 0 + 40000, 6667 ms; 0 + 40000, 6663 ms | 0 + 40000, 6661 ms | 0 + 40000, 6669 ms; 0 + 40000, 6668 ms | | 40K re-encoded reply | 0 + 40364, 6710 ms; 0 + 40364, 6711 ms | 0 + 40364, 6709 ms | 40000 + 364, 256 ms; 40000 + 364, 255 ms | | 40K original reply, after that | 0 + 40364, 6723 ms; 0 + 40364, 6716 ms | 0 + 40364, 6716 ms | 40000 + 364, 255 ms; 40000 + 364, 255 ms | | 88K fresh | 0 + 87700, 19150 ms; 0 + 87700, 19172 ms | 0 + 87700, 19219 ms | 0 + 87700, 19201 ms; 0 + 87700, 19135 ms | | 88K re-encoded reply | 0 + 88064, 19249 ms; 0 + 88064, 19237 ms | 0 + 88064, 19261 ms | 87700 + 364, 276 ms; 87700 + 364, 275 ms | | 88K original reply, after that | 0 + 88064, 19301 ms; 0 + 88064, 19301 ms | 0 + 88064, 19310 ms | 87700 + 364, 275 ms; 87700 + 364, 275 ms | Decode (CLI, forced 256 tokens, `--mtp 0`, same flags as above, with `--tokens-file $P --n 256 --force "$G"`), tok/s, individual runs, then the mean. Experts per layer in VRAM: 92 for all but the `--snapshots 2` row, which holds the two 62.8 MiB snapshots in VRAM and has 90: | arm | tg 4,096 | tg 40,960 | |---|---|---| | level 07, flags | 244.2 / 241.8 = 243.0 | 220 / 220.3 = 220.2 | | level 08, flags off | 244.5 / 243.5 = 244.0 | 220.2 / 220.2 = 220.2 | | level 08, `--snapshots 2 --snapshot-host` | 243.8 / 244.1 / 243.9 / 243.7 = 243.9 | 220.2 / 220.4 / 220.3 / 220 = 220.2 | | level 08, `--snapshots 2` (snapshots in VRAM, 90 slots) | 239.2 / 243.9 = 241.6 (-0.9% against the row above) | 219.5 / 219.1 = 219.3 (-0.4%) | The last row against the one above it is two runs against four, inside the noise. A host snapshot takes 1.6 ms to the host and 1.2 ms back (Limits). **Failed:** none observed. **Not run:** - `STRATA_Q36_SNAPSHOT_TEST` (a restore is bit-exact against the same split read) and `tools/qwen35/q36_snapshot_check.py` on this branch. - `serve/test_server.py` and the rest of the Python suite (only `serve.test_turn_splice` ran). - `tools/reuse_replay.py` on a recorded session; `splice_turns` in the timing pass. - The control request order "plain prefix reuse before the re-encoded request" (`FU8_ORDER=control-first`): the third request above is a second restore, not a plain reuse. - A 16K prompt. - `splice_turns` against a real agent client on this branch; `--batch` slots with snapshots; pictures (splicing is skipped for requests with images). - HIP and SYCL builds (`cudaMemcpyDefault` is used for the host snapshots; never compiled for HIP). ## Limits - Snapshots cover the recurrent state and the first cache cells; K is at most 4. Each costs 62.8 MiB (VRAM or pinned host memory) per session. - A host snapshot takes 1.6 ms to the host and 1.2 ms back (RTX 5080, PCIe 5.0 x16, 262,144 cells, int8 KV). - `STRATA_REUSE_DIAG=1` logs conversation content; it is off by default and the docs say so where it is described. ## Not specific to Sage-A1.5 Sage-A1.5 is a fine-tune of Qwen3.6-35B-A3B with the same architecture and tensor layout, so this path runs the base model unchanged. The before/after numbers above are Sage-A1.5's. The base model was measured once, on my fork's build of the whole series (`xyehya/Strata` branch `q36-r2`: these PRs' flags on, plus a few fork-only defaults), same card and server sweep, with `STRATA_Q8_PACKED=0` (that file keeps its attention and DeltaNet matrices in Q8_0, and the packed copy would take 1.9 GiB from the expert slots): Unsloth's `Qwen3.6-35B-A3B-UD-Q4_K_XL` (from `unsloth/Qwen3.6-35B-A3B-MTP-GGUF`), 262K int8 cache, decode 221 / 208 / 199 / 187 / 164 / 159 tok/s and prompt read 6,473 / 7,010 / 6,277 / 4,656 / 3,411 / 2,506 tok/s at 4K / 16K / 40K / 90K / 160K / 240K (Sage-A1.5 on the same build: decode 231 / 210 / 213 / 187 / 179 / 162). Not measured: this PR's own before/after on the base model. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#4827
No description provided.