mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #484] [CLOSED] Monitor: show the conversation cache at work (reuse, hits on switches, slots, cache RAM) #2661
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#2661
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/484
Author: @xidus90
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:feat/monitor-conversation-cache📝 Commits (4)
e80498cengine: DONE carries the conversation cache - switched, restored, parked slots and bytes, evictionsf9760c9serve: GET /metrics sums up the conversation cache over the last N requests (--monitor-cache-window)61b1bbftools: the conversation cache parity gate checks the engine's switched/restored/parked fieldsad96f29web: the Monitor shows the conversation cache under Context fill📊 Changes
11 files changed (+566 additions, -23 deletions)
View changed files
📝
docs/DETAILS.md(+8 -1)📝
include/strata/core/conversation_cache.hpp(+11 -1)📝
serve/server.py(+81 -5)📝
serve/test_server.py(+321 -0)📝
serve/web/app.css(+1 -0)📝
serve/web/app.js(+28 -2)📝
serve/web/index.html(+15 -0)📝
src/core/conversation_cache_test.cpp(+30 -0)📝
src/program/generate.cpp(+23 -7)📝
tools/conversation_cache_parity.py(+20 -3)📝
tools/test_conversation_cache_parity.py(+28 -4)📄 Description
Summary
The Monitor tab shows the conversation cache (
--conversation-cache-mib) at work, under Context fill:--conversation-cache-slots.--conversation-cache-mib, with the evictions so far.Without the conversation cache the block stays hidden, so the Monitor looks as before. N is
--monitor-cache-window Nor"monitor_cache_window": Ninstrata-<model>.json; the default is 20.What a switch and a hit are
The engine decides, from what it found before it parks or restores anything:
A changed steering mode or thinking level counts as a switch, and as a miss when no parked snapshot matches. With #342's superseded-copy rule, one chat no longer fills the slots with its own earlier turns.
Changes
DONEline carries five more integers after #471's prompt tokens read (fields 15 to 19): switched, restored, parked, parked bytes and evictions. They are appended, so an older server reads the rest, and a newer server with an older engine shows "–". The root checkpoint is marked whereroot_atsaves it.INFOprints the budget in effect, so--prompt-cache 0shows as off.GET /metricsgainsconversation_cache, summed over the newest N history rows that carry the fields.monitor_cache_windowaccepts 1 to 500.nullcounts as absent and20.0as 20, as for the other keys. A bad value stops the start before the model loads.conversation_cache_parity.pychecks the new fields in both of its scenarios. Inreuse, A+, B-again and A+-checkpoint must report a restored switch. Inexchange, B-again must not report one, because B never parks there.Tests
On Windows 11 with an RTX 3090 (sm_86), CUDA 13.3 and the IQ3_S model, on this branch at
d9ab843(0.1.35):serve.test_server: 113 tests.tools: 255 tests (withSTRATA_GGUF_PYset). The new tests failed before their code, and each rule was checked by mutation.conversation_cache_test(4184 checks),conversation_validation_test(972) andconversation_snapshot_test(1889, GPU).reuse: pass, with byte-exact main-model state. Parityexchange --cache-mib 450: pass.reasoning_effort: medium): turn 2 is a continuation (switched 0), and turn 3 after a side request is a hit. Areasoning_budget_tokens: 20request reportsreused 0. An engine with--prompt-cache 0givesenabled: false.Rebased onto
mainat99f3dbd(nowad96f29): the cache fields moved behind #471's field 14, and the server parses them fromf[15]. On the rebased branch,serve.test_server(140 tests),serve.test_monitor,serve.test_lifecycle,serve.test_securityandtools.test_conversation_cache_paritypass. The engine has not been rebuilt or measured again since the rebase: the numbers above are fromd9ab843.For the
exchangegate on this engine, A+'s snapshot is now estimated at about 423 MiB, against 384 MB on 0.1.31. The 400 MiB from #189's repro therefore no longer exercises the exchange: use at least 450.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.