mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1163] [CLOSED] conversation cache: a re-parked conversation reserves at most 1/8 of each K/V buffer instead of up to 16 MiB, so fewer get evicted #3278
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#3278
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1163
Author: @BlueKingMuch
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:cache-reserve📝 Commits (1)
ed63fa8conversation cache: a conversation parked again keeps at most an eighth of each K/V buffer in reserve (was up to 16 MiB per buffer, 0.4-0.5 GB per conversation)📊 Changes
3 files changed (+50 additions, -8 deletions)
View changed files
📝
docs/DETAILS.md(+3 -3)📝
include/strata/core/conversation_buffer.hpp(+11 -5)📝
src/core/conversation_cache_test.cpp(+36 -0)📄 Description
A conversation that was restored and is parked again keeps its unchanged K/V pages and appends the new ones (
92a3d5f, from #189). The appended segment also reserves room for later turns, growing geometrically up to 16 MiB, and it does that in every K/V buffer of the image: k, v, their scales and the indexer rows of each QSA layer, and the draft layer's. With Qwen3.8-Flash-Next (IQ3_S, int8 K/V) that came to 0.4 to 0.5 GiB of unused capacity per conversation parked again, about half the image on top. The cache counts capacity against--conversation-cache-mib, so the reserve decides which conversations get evicted.This bounds the reserve by an eighth of what the buffer held before the append (at least 64 KiB, and at most 16 MiB as before). Turns still fill the reserve instead of adding a restore transfer each: the 4096-append test keeps its bound, and 256 turns of 1 MiB onto a 16 MiB buffer take 28 segments instead of 17.
The docs said parking falls back to a full capture when the reserve would evict another conversation.
6cd29d9removed that check, since a fresh capture never evicts less - which did not hold with this reserve: below, the images parked again are about 1.5x the fresh size. With the reserve bounded, the two differ by at most an eighth of the K/V, and the docs now say what the reserve is instead.Measured
On 0.1.40.1, this commit against v0.1.40.1. RTX 4080 SUPER 32 GB, Ryzen 7 5800X3D, 96 GB DDR4, Windows 11, IQ3_S, 262K context,
--conversation-cache-mib 2816 --conversation-cache-slots 3, a fixed expert placement (--adapt-every 1000000 --expert-cache 8031), greedy, 64-token answers. A main agent P (30,000 tokens) and two subagents S1 and S2 with the same system prompt (15,000 each) take turns for two rounds, and every return adds 2,300 tokens: P1 S1 P2 S2 S1b S2b P3 S1c S2c P4.Parked images from the engine log, against (1 + checkpoints) x 0.11 GiB + 14.9 KiB per token:
What that does to the turns (prompt tokens read, time to first token):
(S2c in v0.1.40.1 loses S2 another way: S1c, reading from the shared system prompt, moves S2's checkpoint into the session and overwrites S2. That is the next PR: #1164)
With the cache on and the fixed placement, the main agent's four answers equal a run without subagents, in both runs.
conversation_cache_testpasses on Windows (its new checks fail on v0.1.40.1 without the change), as doconversation_snapshot_test(with CUDA) andconversation_file_test.cc @jeremiahritchey - the reserve came with your incremental capture; I kept its shape and only bounded it.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.