mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2265] [CLOSED] Conversation cache: --conversation-cache-park-gain N (opt-in, default 0): a turn that grew a few hundred tokens no longer rewrites a whole 3 GB snapshot #3952
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#3952
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/2265
Author: @Krypto-Whitehat
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:conversation-cache-park-gain📝 Commits (1)
58ca3f2Conversation cache: --conversation-cache-park-gain N stops a turn that grew a few hundred tokens from rewriting a whole snapshot (RTX 5090 Laptop, IQ3_XXS: 1,418 parks -> 1, 2,251.9 GB -> 3.26 GB host copy at 4.7 % read back; decode -3.4 %, inside the run-to-run spread)📊 Changes
3 files changed (+70 additions, -2 deletions)
View changed files
📝
include/strata/core/conversation_cache.hpp(+20 -0)📝
src/core/conversation_cache_test.cpp(+27 -0)📝
src/program/generate.cpp(+23 -2)📄 Description
Issue: Resolves #2264
Summary
--conversation-cache-park-gain Nmakes parking rate-limited by growth, opt-in and default 0 = park every turn, byte-identical to today. A conversation that advanced fewer than N tokens since the copy it would supersede keeps that copy: it still holds this conversation's prefix (a conversation only appends), and re-parking writes the whole snapshot only for the next turn to drop it again.The report behind this measured 1,418 successful parks for one long single conversation, 2,251.9 GB of host copy written and 105.8 GB (4.7 %) ever read back, with 425 superseded copies dropped and 1,548 s of copy time on the request path. With the gate on it measured 3 park events and 3.26 GB (-66.7 %), the remaining copy being the conversation's first park.
The default stays off because the measurement is from one rig. Deciding whether it should be on by default is the maintainer's call, and nothing here forecloses it.
What changed
include/strata/core/conversation_cache.hpp: one new const accessor,parked_prefix_tokens(ids, images, checkpoints, cvec). It reports, in tokens, the longest parked entry the outgoing state supersedes - exactly the entriesdrop_superseded()would remove, found the same waydrop_superseded()finds them (deepest checkpoint the outgoing chain still holds), so the gate can never name a different entry than the one a park would drop.src/program/generate.cpp, the park decision (line 10445 ata0116b27): the existing condition gains one term,park_worth. With the default 0 that term is constantly true and the line behaves as before.src/program/generate.cpp: the option, the--conversation-cache-park-gain Nparse (alongside the other--conversation-cache-*flags, sameINT32_MAXbound as--conversation-cache-slots), and the help text.src/core/conversation_cache_test.cpp: seven checks for the accessor - an empty cache, parking a conversation, the entry the chain supersedes, another conversation sharing only the root, the other steering mode, an appended tail, and an entry without checkpoints.Left alone on purpose: the default (
0, so no behaviour change without the flag), the copy path itself,drop_superseded()and the K/V retention, the physical-RAM admission gate, and every log line. This is one flag, one accessor and one term in one condition.Extra Notes
cmake -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=89with nvcc 13.4.92 and MSVC 14.44. Thestratatarget compiles and links with 0 errors (Windows CUDA, sm_89, so the Linux-only paths of this file are not what that compiles).conversation_cache_testbuilds and passes: 4,226 checks, exit 0.drop_superseded()keys on the checkpoint, so 5 is the right answer and the expectation was wrong.drop_superseded, and it is why this ships opt-in.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.