[GH-ISSUE #528] Conversation cache: decode drops ~4-6x on continued conversations (0.1.36, Windows, RTX 5090, IQ3_XXS) #248

Closed
opened 2026-11-04 01:41:18 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @NikolaFC on GitHub (Oct 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/528

Summary

With the conversation cache enabled (--conversation-cache-mib 8192 --conversation-cache-slots 4), decode speed on continued conversations drops to roughly 18–31 tokens/s. With the same engine build, model, flags otherwise, and the same conversation, but those two flags omitted, the conversation decodes at 87–116 tokens/s. Fresh (non-restored) decoding runs at ~80–95 tokens/s in both configurations. So on 0.1.36 the feature currently costs ~4–6× decode throughput on exactly the workload it targets (multi-turn agent-style flows).

Environment

  • Windows 11, RTX 5090 (32 GB), 96 GB system RAM
  • Strata 0.1.36 — Windows prebuilt binary
  • Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS native pack
  • Engine flags: --kv int8 --kv-resident 32768 --max-context 262144 --spec 4 --prompt-cache 6
    • Config A: plus --conversation-cache-mib 8192 --conversation-cache-slots 4
    • Config B: without those two

Measurements

A/B on the same night, same engine binary, same conversation (~100 K tokens), 300-token generations, reading timings.predicted_per_second from the OpenAI-compatible endpoint:

Config Request Decode (tokens/s)
A — cache on continue ~100 K conversation (restored from parked snapshot) 17.6, 20.4, 26.0, 31.1
B — cache off continue the same conversation (prompt reuse) 86.6, 100.5, 115.8
B — cache off fresh ~100 K read 80.4, 83.0, 94.5

A longer session under config A (27 turns, prompt growing 71 K → 101 K tokens) showed turns 1–2 at 59–64 tokens/s, then turns 3–27 at 13–40 tokens/s (most 15–31). The GPU stayed at full boost the whole time (2.88–2.90 GHz core, 48–57 °C, well under power limits), so this is not throttling. KV streaming was at 97–98 % VRAM-resident and the expert cache at 93–98 % hit in both the fast and slow cases — it does not look like cache pressure.

What the engine log shows

After each turn the engine parks a snapshot (≈2.1–2.4 GB, ~0.6–0.9 s); each following turn restores it in a few hundred ms, and it is the restored state that decodes slowly. A from-scratch read of comparable size under the same config decodes fast — the cost tracks the restore path, not general memory pressure.

Reproduction

  1. Load the pack with config A.
  2. Send a ~100 K-token prompt, generate 300 tokens — note predicted_per_second.
  3. Continue the same conversation with small deltas a few times — decode settles at ~18–31 tokens/s.
  4. Restart with config B and repeat — the same conversation decodes at ~87–116 tokens/s.

Happy to share the small client script and the raw engine logs.

Question

Is decode on restored conversations currently expected to pay a reconstruction penalty of this size (e.g. retained-KV handling in the snapshot path), or is 4–6× outside the intent of the RAM tier? Happy to run any diagnostics on this machine.

Related: #57 (multi-conversation cache tracker).

Originally created by @NikolaFC on GitHub (Oct 2, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/528 **Summary** With the conversation cache enabled (`--conversation-cache-mib 8192 --conversation-cache-slots 4`), decode speed on continued conversations drops to roughly **18–31 tokens/s**. With the same engine build, model, flags otherwise, and the same conversation, but those two flags omitted, the conversation decodes at **87–116 tokens/s**. Fresh (non-restored) decoding runs at ~80–95 tokens/s in both configurations. So on 0.1.36 the feature currently costs ~4–6× decode throughput on exactly the workload it targets (multi-turn agent-style flows). **Environment** - Windows 11, RTX 5090 (32 GB), 96 GB system RAM - Strata 0.1.36 — Windows prebuilt binary - Model: `Qwen3.8-Flash-Next` GSQ-RCO IQ3_XXS native pack - Engine flags: `--kv int8 --kv-resident 32768 --max-context 262144 --spec 4 --prompt-cache 6` - Config **A**: plus `--conversation-cache-mib 8192 --conversation-cache-slots 4` - Config **B**: without those two **Measurements** A/B on the same night, same engine binary, same conversation (~100 K tokens), 300-token generations, reading `timings.predicted_per_second` from the OpenAI-compatible endpoint: | Config | Request | Decode (tokens/s) | |---|---|---| | A — cache on | continue ~100 K conversation (restored from parked snapshot) | 17.6, 20.4, 26.0, 31.1 | | B — cache off | continue the same conversation (prompt reuse) | 86.6, 100.5, 115.8 | | B — cache off | fresh ~100 K read | 80.4, 83.0, 94.5 | A longer session under config A (27 turns, prompt growing 71 K → 101 K tokens) showed turns 1–2 at 59–64 tokens/s, then turns 3–27 at 13–40 tokens/s (most 15–31). The GPU stayed at full boost the whole time (2.88–2.90 GHz core, 48–57 °C, well under power limits), so this is not throttling. KV streaming was at 97–98 % VRAM-resident and the expert cache at 93–98 % hit in both the fast and slow cases — it does not look like cache pressure. **What the engine log shows** After each turn the engine parks a snapshot (≈2.1–2.4 GB, ~0.6–0.9 s); each following turn restores it in a few hundred ms, and it is the restored state that decodes slowly. A from-scratch read of comparable size under the same config decodes fast — the cost tracks the restore path, not general memory pressure. **Reproduction** 1. Load the pack with config A. 2. Send a ~100 K-token prompt, generate 300 tokens — note `predicted_per_second`. 3. Continue the same conversation with small deltas a few times — decode settles at ~18–31 tokens/s. 4. Restart with config B and repeat — the same conversation decodes at ~87–116 tokens/s. Happy to share the small client script and the raw engine logs. **Question** Is decode on restored conversations currently expected to pay a reconstruction penalty of this size (e.g. retained-KV handling in the snapshot path), or is 4–6× outside the intent of the RAM tier? Happy to run any diagnostics on this machine. Related: #57 (multi-conversation cache tracker).
Author
Owner

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

Thanks for the careful A/B. No, that isn't intended: a restored conversation should decode at the same speed as one kept live. The slowdown is in the engine's restore path for parked conversations and needs work there. For now, leaving out the two flags is the faster setup. The normal checkpoints (--prompt-cache) still reuse a continued conversation.

To narrow it down, could you attach the engine log (strata-<model>.log) covering one slow restored turn and one fast turn? The strata serve: prompt ..., decode expert cache hit rate and KV streaming lines are the ones we need. Also: does it happen on a shorter conversation (~20K tokens) too? If you can, one run without --kv-resident (with a smaller --max-context so the K/V fits in VRAM) would show whether the K/V window is what the restore leaves slow.

<!-- gh-comment-id:5964030355 --> @Niko1221 commented on GitHub (Oct 3, 2026): Thanks for the careful A/B. No, that isn't intended: a restored conversation should decode at the same speed as one kept live. The slowdown is in the engine's restore path for parked conversations and needs work there. For now, leaving out the two flags is the faster setup. The normal checkpoints (`--prompt-cache`) still reuse a continued conversation. To narrow it down, could you attach the engine log (`strata-<model>.log`) covering one slow restored turn and one fast turn? The `strata serve: prompt ...`, `decode expert cache hit rate` and `KV streaming` lines are the ones we need. Also: does it happen on a shorter conversation (~20K tokens) too? If you can, one run without `--kv-resident` (with a smaller `--max-context` so the K/V fits in VRAM) would show whether the K/V window is what the restore leaves slow.
Author
Owner

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

We couldn't reproduce this on the current engine. On an RTX 5070 we ran a 75K-token IQ3_XXS conversation (--kv int8 --kv-resident 32768 --spec 4 --prompt-cache 6 --conversation-cache-mib 8192 --conversation-cache-slots 4) with an unrelated conversation parking it between turns, so every turn after the first was restored from its snapshot. The restored turns decoded at the same speed as the same turns kept live, with the same tokens; a 37K Q2_0 conversation behaved the same. The bench is tools/conversation_restore_speed.py if you'd like to run it on your machine.

To see where your slow turns lose the time, could you run one slow and one fast turn with STRATA_DECODE_TIMING=1 in the config's "env" block and paste the strata decode timing lines? They split each window into GPU wait, CPU experts and drafting. The strata serve: prompt ... / conversation cache: ... lines around them would also help, plus Task Manager's free RAM during a slow turn. Does anything else run in between, like a title or summary request from the client?

<!-- gh-comment-id:5979967691 --> @Niko1221 commented on GitHub (Oct 4, 2026): We couldn't reproduce this on the current engine. On an RTX 5070 we ran a 75K-token IQ3_XXS conversation (`--kv int8 --kv-resident 32768 --spec 4 --prompt-cache 6 --conversation-cache-mib 8192 --conversation-cache-slots 4`) with an unrelated conversation parking it between turns, so every turn after the first was restored from its snapshot. The restored turns decoded at the same speed as the same turns kept live, with the same tokens; a 37K Q2_0 conversation behaved the same. The bench is `tools/conversation_restore_speed.py` if you'd like to run it on your machine. To see where your slow turns lose the time, could you run one slow and one fast turn with `STRATA_DECODE_TIMING=1` in the config's `"env"` block and paste the `strata decode timing` lines? They split each window into GPU wait, CPU experts and drafting. The `strata serve: prompt ...` / `conversation cache: ...` lines around them would also help, plus Task Manager's free RAM during a slow turn. Does anything else run in between, like a title or summary request from the client?
Author
Owner

@NikolaFC commented on GitHub (Oct 4, 2026):

Thanks for the detailed follow-ups — and for conversation_restore_speed.py. We re-ran everything on the same box as the report (RTX 5090, 96 GB), with the engine updated 0.1.36 → 0.1.39 in between. We can't reproduce the slowdown on 0.1.39 either: restored conversations decode at live speed, and in the clean runs the outputs are token-identical. Everything you asked for is below.

1. Your bench, all three modes (IQ3_XXS, ~65K-token conversation A, unrelated conversation parking it between turns; same flags as the report; --tokens 65000 --set=--expert-cache=9800; tok/s of the turns after the first):

mode baseline (live) candidate (restored) tokens
switch 122.0 / 119.4 155.5 / 139.6 identical
same 101.3 / 111.9 99.0 / 111.1 identical
pair 137.0 / 126.9 147.1 / 140.1 identical

All PASS. (One same-mode run showed a single late-token divergence in one turn that a re-run didn't reproduce — looked like a rare near-tie, not the restore path; flagging it just in case.)

2. The original scenario — direct ~100K-token continuation with the cache on: 135.9 tok/s (the same request shape measured 17.6 tok/s on 0.1.36 with the cache on, 115.8 with it off).

3. strata decode timing for a restored turn (plus the lines around it):

strata serve: conversation cache: restored 81656 tokens (live) in 245.1 ms; parked=1 bytes=1517915836
strata serve: prompt 81679 tokens = 81656 reused + 23 read in 460 ms (50.0 tok/s), 160 generated in 1029 ms (155.5 tok/s), drafts accepted 130 of 137, 6 checkpoints
strata decode timing: 31 windows, avg T 5.42, 5.16 tokens/window, 33.20 ms/window = verify 31.14 (GPU-reach wait 19.00 + per-layer host 11.38 [plan 0.32 actq 0.62 jobs 0.03 CPU 10.39] + stage 0.02) + commit/emit 0.16 + draft 1.90; per layer-window: CPU experts 5.59 (9.18 entries), VRAM hits 38.09, PCIe 5.77

Free physical RAM sat at ~19–24 GiB while the engine was loaded (sampled every 2 s during the runs) — normal for this box with the arena pinned.

4. Two things running the bench on a 32 GB card threw at us (maybe worth handling in the bench):

  • With --expert-cache auto, our two side-loads came up with slightly different slot counts (14336 vs 14352 — the free-VRAM reading moves between loads). Since cached experts round differently on the GPU than on the CPU (as the engine's own note says), a few greedy tokens flip — all A turns fail the token check, including the fresh A1, so it's cache composition, not the restore path. Pinning --expert-cache gives both sides identical composition and the bench passes.
  • A manual --expert-cache N on a native pack is a byte budget over the largest blob (the final slot count lands above N) and it skips the auto path's shrink retry: at N=14000 both loads ended at 0 MiB free, WDDM paged, and everything crawled (prompt reads ~900 tok/s, decode ~40 tok/s). N=9800 stays under the free room (~2.4 GiB free) and is clean — a clamp or reserve check there would have saved us two runs.

5. The 0.1.36 lines from the report day (you asked for these in the first comment — one slow restored turn per config):

0.1.36 log lines (cache on vs off, same ~100K conversation)
[config A — conversation cache on]
strata serve: conversation cache: restored 100070 tokens (checkpoint) in 618.0 ms; parked=2 bytes=5082506208
strata serve: prompt 100075 tokens = 100070 reused + 5 read in 1023 ms (4.9 tok/s), 300 generated in 14741 ms (20.4 tok/s), drafts accepted 213 of 223, 6 checkpoints
strata serve: prompt 100113 tokens = 98304 reused + 1809 read in 2929 ms (617.6 tok/s), 300 generated in 17048 ms (17.6 tok/s), drafts accepted 216 of 221, 6 checkpoints

[config B — same engine restarted without the two cache flags]
strata serve: prompt 100113 tokens = 98304 reused + 1809 read in 1015 ms (1782.0 tok/s), 300 generated in 2591 ms (115.8 tok/s), drafts accepted 217 of 224, 6 checkpoints

So, on our side it's gone everywhere we can test: all three bench modes and the original workload are clean on 0.1.39 with the cache on. Nothing in the 0.1.37–0.1.39 notes names a restore-path fix we can point at — was something reworked in that window, or should we treat #528 as not reproducible and leave it? Happy to run anything else on this box (a longer soak with the cache on, layer-split parking paths, or a rerun with specific values pinned).

<!-- gh-comment-id:5980722535 --> @NikolaFC commented on GitHub (Oct 4, 2026): Thanks for the detailed follow-ups — and for `conversation_restore_speed.py`. We re-ran everything on the same box as the report (RTX 5090, 96 GB), with the engine updated **0.1.36 → 0.1.39** in between. **We can't reproduce the slowdown on 0.1.39 either**: restored conversations decode at live speed, and in the clean runs the outputs are token-identical. Everything you asked for is below. **1. Your bench, all three modes** (IQ3_XXS, ~65K-token conversation A, unrelated conversation parking it between turns; same flags as the report; `--tokens 65000 --set=--expert-cache=9800`; tok/s of the turns after the first): | mode | baseline (live) | candidate (restored) | tokens | |---|---|---|---| | `switch` | 122.0 / 119.4 | 155.5 / 139.6 | identical | | `same` | 101.3 / 111.9 | 99.0 / 111.1 | identical | | `pair` | 137.0 / 126.9 | 147.1 / 140.1 | identical | All PASS. (One `same`-mode run showed a single late-token divergence in one turn that a re-run didn't reproduce — looked like a rare near-tie, not the restore path; flagging it just in case.) **2. The original scenario** — direct ~100K-token continuation with the cache on: **135.9 tok/s** (the same request shape measured 17.6 tok/s on 0.1.36 with the cache on, 115.8 with it off). **3. `strata decode timing` for a restored turn** (plus the lines around it): ``` strata serve: conversation cache: restored 81656 tokens (live) in 245.1 ms; parked=1 bytes=1517915836 strata serve: prompt 81679 tokens = 81656 reused + 23 read in 460 ms (50.0 tok/s), 160 generated in 1029 ms (155.5 tok/s), drafts accepted 130 of 137, 6 checkpoints strata decode timing: 31 windows, avg T 5.42, 5.16 tokens/window, 33.20 ms/window = verify 31.14 (GPU-reach wait 19.00 + per-layer host 11.38 [plan 0.32 actq 0.62 jobs 0.03 CPU 10.39] + stage 0.02) + commit/emit 0.16 + draft 1.90; per layer-window: CPU experts 5.59 (9.18 entries), VRAM hits 38.09, PCIe 5.77 ``` Free physical RAM sat at ~19–24 GiB while the engine was loaded (sampled every 2 s during the runs) — normal for this box with the arena pinned. **4. Two things running the bench on a 32 GB card threw at us** (maybe worth handling in the bench): - With `--expert-cache auto`, our two side-loads came up with slightly different slot counts (14336 vs 14352 — the free-VRAM reading moves between loads). Since cached experts round differently on the GPU than on the CPU (as the engine's own note says), a few greedy tokens flip — **all A turns fail the token check, including the fresh A1**, so it's cache composition, not the restore path. Pinning `--expert-cache` gives both sides identical composition and the bench passes. - A manual `--expert-cache N` on a native pack is a byte budget over the largest blob (the final slot count lands above N) and it skips the auto path's shrink retry: at N=14000 both loads ended at 0 MiB free, WDDM paged, and everything crawled (prompt reads ~900 tok/s, decode ~40 tok/s). N=9800 stays under the free room (~2.4 GiB free) and is clean — a clamp or reserve check there would have saved us two runs. **5. The 0.1.36 lines from the report day** (you asked for these in the first comment — one slow restored turn per config): <details><summary>0.1.36 log lines (cache on vs off, same ~100K conversation)</summary> ``` [config A — conversation cache on] strata serve: conversation cache: restored 100070 tokens (checkpoint) in 618.0 ms; parked=2 bytes=5082506208 strata serve: prompt 100075 tokens = 100070 reused + 5 read in 1023 ms (4.9 tok/s), 300 generated in 14741 ms (20.4 tok/s), drafts accepted 213 of 223, 6 checkpoints strata serve: prompt 100113 tokens = 98304 reused + 1809 read in 2929 ms (617.6 tok/s), 300 generated in 17048 ms (17.6 tok/s), drafts accepted 216 of 221, 6 checkpoints [config B — same engine restarted without the two cache flags] strata serve: prompt 100113 tokens = 98304 reused + 1809 read in 1015 ms (1782.0 tok/s), 300 generated in 2591 ms (115.8 tok/s), drafts accepted 217 of 224, 6 checkpoints ``` </details> So, on our side it's gone everywhere we can test: all three bench modes and the original workload are clean on 0.1.39 with the cache on. Nothing in the 0.1.37–0.1.39 notes names a restore-path fix we can point at — was something reworked in that window, or should we treat #528 as not reproducible and leave it? Happy to run anything else on this box (a longer soak with the cache on, layer-split parking paths, or a rerun with specific values pinned).
Author
Owner

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

You re-ran it on 0.1.39 and could not reproduce the slow decode after a restored conversation, and our own restore benchmark (conversation_restore_speed.py) is clean too, token-identical and at live speed. Closing as not reproducible. If it happens again, open a new issue with the version and the engine log lines from the restore.

<!-- gh-comment-id:6037702926 --> @Niko1221 commented on GitHub (Oct 7, 2026): You re-ran it on 0.1.39 and could not reproduce the slow decode after a restored conversation, and our own restore benchmark (conversation_restore_speed.py) is clean too, token-identical and at live speed. Closing as not reproducible. If it happens again, open a new issue with the version and the engine log lines from the restore.
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#248
No description provided.