mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #528] Conversation cache: decode drops ~4-6x on continued conversations (0.1.36, Windows, RTX 5090, IQ3_XXS) #248
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#248
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @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
Qwen3.8-Flash-NextGSQ-RCO IQ3_XXS native pack--kv int8 --kv-resident 32768 --max-context 262144 --spec 4 --prompt-cache 6--conversation-cache-mib 8192 --conversation-cache-slots 4Measurements
A/B on the same night, same engine binary, same conversation (~100 K tokens), 300-token generations, reading
timings.predicted_per_secondfrom the OpenAI-compatible endpoint: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
predicted_per_second.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).
@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? Thestrata serve: prompt ...,decode expert cache hit rateandKV streaminglines 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-contextso the K/V fits in VRAM) would show whether the K/V window is what the restore leaves slow.@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 istools/conversation_restore_speed.pyif 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=1in the config's"env"block and paste thestrata decode timinglines? They split each window into GPU wait, CPU experts and drafting. Thestrata 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?@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):switchsamepairAll 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 timingfor a restored turn (plus the lines around it):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):
--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-cachegives both sides identical composition and the bench passes.--expert-cache Non 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)
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).
@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.