mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2510] [CLOSED] serve: a durable on-disk conversation tier with a warm→cold cascade that degrades instead of deleting, per-stage segments, a prefix restore ladder, Windows chunked large pages, and a parking target (ram|disk|auto) that spills a re… #4087
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#4087
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/2510
Author: @shahrokhzargarpour
Created: 10/14/2026
Status: ❌ Closed
Base:
main← Head:aporte/entrega-0.1.44📝 Commits (10+)
07613f4serve: durable disk tier for the conversation cache (spill, archive, system-prompt cache)c514173serve: two-pass streaming session restore (read pass validates, apply pass copies 16 MiB at a time)26d29b5serve: per-segment disk tier for the conversation cache (content-addressed segments)7cd8001serve: anchor the segment frontier at the <|im_start|> opener, not the role token1cc359dserve: prefix restore ladder when a parked image fails validation (STRATA_RESTORE_LADDER)3e14ba4cuda: reserve the expert arena before the PLE/GGUF, and Windows chunked large pages0269a3cserve: continuous agenda for batched reads (STRATA_BATCH_AGENDA, opt-in)940eb9bdocs: document the disk tier, restore ladder, anchored frontier and chunked large pagesacc0986serve: --conversation-cache-park (ram|disk|auto), and a rejected park spills to disk instead of discarding571f120serve: the transient disk floor decides the sibling disk hits and the API session save/restore too📊 Changes
46 files changed (+12699 additions, -226 deletions)
View changed files
📝
CMakeLists.txt(+41 -1)📝
README.md(+10 -0)📝
docs/DETAILS.md(+139 -4)➕
docs/FLAGS.md(+287 -0)➕
docs/SPILL_AND_PROMPT_CACHE.md(+621 -0)➕
include/strata/core/agenda.hpp(+179 -0)📝
include/strata/core/conversation_cache.hpp(+145 -15)📝
include/strata/core/conversation_file.hpp(+33 -1)📝
include/strata/core/conversation_memory.hpp(+55 -0)➕
include/strata/core/conversation_prompt_cache.hpp(+138 -0)➕
include/strata/core/conversation_restore_ladder.hpp(+90 -0)➕
include/strata/core/conversation_segments.hpp(+291 -0)📝
include/strata/core/conversation_snapshot.hpp(+58 -0)➕
include/strata/core/conversation_spill.hpp(+504 -0)➕
include/strata/core/conversation_spill_dir.hpp(+134 -0)📝
include/strata/core/expert_source.hpp(+14 -0)📝
include/strata/core/pinned.hpp(+64 -4)➕
include/strata/core/system_prompt_cache_dir.hpp(+119 -0)📝
serve/runconfig.py(+92 -5)📝
serve/server.py(+381 -15)...and 26 more files
📄 Description
Title
serve: a durable on-disk conversation tier with a warm→cold cascade that degrades instead of deleting, per-stage segments, a prefix restore ladder, Windows chunked large pages, and a parking target (ram|disk|auto) that spills a rejected park
Issue: Resolves #2597
Summary
This series is built, and it is what runs. The engine binary produced from this tree is the one serving on the machine that took every measurement in this body; the numbers below are that binary's. Where this document says "applies, not verified", it refers to the cherry-pick-alone case in The commits each capability needs: a commit applied on its own to
mainwas checked for conflicts, and nothing was compiled in that scratch tree. It is not a statement that the code was never built.Fourteen capabilities in one series; all of it opt-in and off by default. With every flag absent the tree is byte-for-byte upstream, and the series applies clean in order on the base. The map, one line each:
07613f4b) — the conversation cache gets a disk copy (spill, archive, system-prompt cache).c514173e) — restore a parked image without holding its K/V in RAM.26d29b52,7cd80013) — the shared prefix as addressable pieces, with the frontier anchored at the<|im_start|>opener.1cc359d4,STRATA_RESTORE_LADDER) — a parked image that fails validation no longer loses the prefix.3e14ba41) — the CUDA side.0269a3c2,STRATA_BATCH_AGENDA, opt-in).acc09864,571f1203) — the transistorram|disk|auto.2f8d3cad,b0c177f1) — the folder resolves without a flag.20e5760b,b9b83c86,16b67c46,1f572df4) — engineINFO,/metrics, Monitor rows.ac5a1746,33d41214,686d0b57,bb31e4e4) — a warm level; a level at budget degrades instead of deleting; only the cold deletes.ba89b7fc) — the cold evicts by its MiB budget, not by a hidden cap of 256 entries.de0f1f3a,8f6bfa10,5320268c,1895e7ed,256d76b3) — per-slot clocks, a tachometer, the solo speed, the RAM row.528be20f,6a93aadf) — several requests at once, and the conversations kept on disk.940eb9bf,d40cb783,957d27b0) — the tier, the ladder, the frontier, the pages, the parking, the identity.Three of the fourteen apply alone on
296b59d2— A, B and E ("apply alone" means the cherry-pick is conflict-free, not that the capability runs on its own). The rest are a chain, and each says in its own section which commits it needs. Every capability below is a self-sufficient unit: its problem, its flags and defaults, its numbers with their source, what it does not claim, and the minimal set of commits to take it.Two framings hold for the whole series. The parking work adds a parking target and the rule that closes the hole the disk tier was built for: when the physical-RAM gate rejects a park, the capture is no longer discarded — it spills to disk under a transient floor, and a discard is now counted and printed (
discards=N). The cascade gives the disk tier a level above it: the conversation cache runs RAM → warm M.2 → cold disk, and a level that runs out of budget demotes its oldest entry instead of deleting it; only the cold level deletes, and each level is switched off by its own budget.The installer's always-path does not change, and that is measured rather than asserted:
setup.pybefore and after the change, across 5 machines × 5 sizes × (--yesor Enter), gives 50 cases and 50 identical results, with--yesasking nothing at all.What changed
A. Durable on-disk conversation tier (spill, archive, system-prompt cache)
The problem. With four parallel slots, long contexts and a bounded
--kv-resident, host RAM runs out while a conversation is being parked, and the disk tier sits after the physical-RAM admission gate. When the gate failed, the engine dropped the capture instead of spilling it, so the next turn re-prefilled the whole prompt from token 0. There was no durable on-disk copy of a parked conversation to fall back on at all.What it does. The conversation cache keeps a durable on-disk copy.
--conversation-cache-spill-dir+--conversation-cache-spill-on park— the spill folder and the moment it is written; the folder survives a restart and theSCSMsidecar is rescanned on open.SCSMsidecar carries tokens and images, not K/V;best()/load()restore on re-entry.SessionFileIdentity(model fingerprint + config fingerprint,engine = STRATA_VERSION).kMetaVersion = 2; v1 is still read.--conversation-cache-disk-mib(default8192),--conversation-cache-spill-when-full evict-oldest|reject,--conversation-cache-spill-max-age-days.--session-min-free-mib(default4096).--system-prompt-cache(dir/budget/slots/max-age/key) and the shared-Sysdedup of the segment tier.--conversation-cache-similarityand--conversation-cache-n-min, both at their defaults (0), so a disk hit is accepted with no minimum overlap. (These two are not in upstreammain.)What was measured.
prev_frontier), and the system prompt is the first segment — the root of the chain; the matcher cuts at the first divergence (a segment after a hole can never be a valid reuse). Source:src/core/conversation_segments.cppand09-implementacion/2026-10-15-system-prompt-recalculable-v1.0.0.md.Updates we plan (design, not implementation, no date promised): stop the segment identity from chaining the frontier; store the K de-rotated and re-anchor them; and recompute the recurrent state (GDN) bounded to the changed span.
What this does not claim. The C++ of this commit was not compiled: the state is applies, not verified, never a tilde. The ≈24× is against the 6.6 s reload, not the 657 ms read. One machine, one model, one pass per cell — not a benchmark and no throughput promise.
Upstream issues. Related — #47 and #661 (both closed/completed) are the origin requests for a conversation tier on disk; #2596 (ours, open) reports and documents that a different
Kinvalidates the whole on-disk tier.The commits it needs.
07613f4b296b59d2;serve/runconfig.py,serve/server.py,serve/test_monitor.py,serve/test_runconfig.py,setup.py→py_compileOK; the C++ not compiled → applies, not verifiedB. Two-pass streaming session restore
The problem. Restoring a parked image materialised the K/V in host RAM; a large image held its whole K/V in RAM during the restore.
What it does. The session restore runs two passes: the read pass validates the image, the apply pass copies it in 16 MiB blocks — so the K/V is not held in RAM as one whole.
What was measured. No separate figure of its own — no measurable before/after: the mechanism is measured through A's restore pair (171,516 tokens / 657 ms read / 6.6 s reload / 158.6 s cold), where the two-pass restore is the path that reads it back. Source: the tier note of 2026-10-14.
What this does not claim. Only C++/
.cu/docs — the C++ was not compiled: applies, not verified. There is no isolated measurement of the streaming pass itself.Upstream issues. Related — #1269 (open PR) carries a nearly identical streaming-restore title; #747 (closed/completed) is the multi-GPU parking terrain the streamed restore reads back.
The commits it needs.
c514173e296b59d2; only C++/.cu/docs → applies, not verifiedC. Per-stage content-addressed segments (and the anchored frontier)
The problem. A park rewrites the whole image at once, and the shared root of a prompt (
Sys) is written far more often than it is read back: the engine had no way to address the reusable pieces of a prompt separately.What it does.
--conversation-cache-segments+--conversation-cache-segment-budget-mib— a content-addressed per-stage segment tier;conversation_segments.{hpp,cpp}.7cd80013— the frontier of the segment store is anchored at the<|im_start|>opener, not at the role token.What was measured. Nothing live for this commit on its own — no measurable before/after: the note declares host checks 174 → 188 — declared, not reproduced. The shared-
Sysdedup is not conclusively measured (one pass, concurrent traffic).What this does not claim. Not verified (the measurement does not run a parse per commit, and the C++ is not compiled here). The segment plan currently cuts three pieces (
Sys,Other,Answer);Think/Read/Write/ToolCall/ToolResultexist in the enum but are not materialised (the cutter is missing). TheSysdedup is not conclusively measured.Upstream issues. Related — #2508 (ours, open) proposes compacting the stationary KV components, the same territory as the segment dedup; #1962 (open) proposes sharing prefix KV blocks. No upstream issue covers the cutter itself.
The commits it needs.
26d29b52,7cd80013D. Prefix restore ladder (
STRATA_RESTORE_LADDER)The problem. A parked image that fails validation — e.g.
discard snapshot (stage count: saved=0 current=1)— loses the prefix, and the turn re-prefills. (#2595 is 40 of these in one boot, one of 165,543 tokens.)What it does.
STRATA_RESTORE_LADDER— when a parked image fails validation, the ladder rescues the prefix from the bad image so the turn does not lose it;conversation_restore_ladder.hpp.What was measured. The ladder's
image rejectedbranch did not fire in the live matrix, so its in-serve effect is host-tested, not measured — no measurable before/after. The note declares host checks (1164/1404 in its tests) — declared, not reproduced.What this does not claim. It does not fix the cause: why the tier produced a 1-token image with a different stage count is not investigated, and our own notes say so (#2595 mitigates). Not verified.
Upstream issues. Mitigates #2595 (ours, open) — the ladder rescues the prefix from the bad image; it does not fix the cause.
The commits it needs.
1cc359d4E. Windows chunked large pages + expert-arena-first (CUDA)
The problem. On Windows, the expert arena is reserved after the PLE/GGUF, and large pages are not chunked; the reservation order and the chunked large pages were not the ones this box wants.
What it does.
3e14ba41— reserve the expert arena before the PLE/GGUF, and use Windows chunked large pages. This is the CUDA side of the series.What was measured. Nothing live here: only C++/
.cu/docs, and no CUDA toolchain in this environment — declared, not reproduced.What this does not claim. C++/
.cunot compiled → applies, not verified, never a tilde.Upstream issues. Related — #2185 (closed PR) added the Windows
enable_large_pages.ps1helper forSeLockMemoryPrivilege; #2271 (open PR) is--shared-expert-arena.The commits it needs.
3e14ba41296b59d2; only C++/.cu/docs → applies, not verifiedF. Continuous batch-read agenda (
STRATA_BATCH_AGENDA, opt-in)The problem. On the serve thread a batched read is an uninterrupted run: from
pipe_drain()to the end of the request nothing else drives a decode window.What it does.
0269a3c2— a continuous agenda for batched reads, behindSTRATA_BATCH_AGENDA(opt-in).What was measured. The note declares a host correctness test; the effect on throughput is NOT measured — no measurable before/after.
What this does not claim. Not verified. The throughput effect is not measured. Its dependency on C and D is by text, not by function — the regions of
CMakeLists.txt/docs/FLAGS.md, which the note itself calls "a dependency of context, not functional".Upstream issues. Related — #2275 (open) and PR #2050 (open, opt-in
STRATA_PIPED_READ_PIECE) cover the pipelined prompt read this agenda sits beside; also #1906 and #1603.The commits it needs.
0269a3c2G. Parking target + spill-instead-of-discard + transient floor (the transistor
ram|disk|auto)The problem. Measured over the window of real use of 2026-10-14 (19:32:30 → 20:22:03, the configuration before the parking target):
skip parking (physical RAM admission …))disk hit skipped)Two readings that matter:
snapshot + flooris. Host free RAM sat below the 2560 MiB floor in only 65 of 1,277 samples (5%), while the real condition isavailable ≥ snapshot + 2560and a snapshot measures 1.6–2.9 GB (working figure ≈2.5 GB per conversation). In every rejection the log readsevicted 0, 0 still parked: the RAM cache was empty, so there was nothing to evict — it was system RAM, not the cache's budget.Refusing did not even save RAM. A disk restore is indistinguishable from RAM —
disk/checkpoint95,661 tokens in 273.7 ms againstlive102,362 tokens in 267.6 ms — and the re-prefill rebuilds in the slot the same K/V the disk copy would have loaded (the final state is identical;/metricsreports the sameheld_tokens). The engine refused to do in 274 ms what it then did in 197 s, and ended at the same consumption.What it does.
--conversation-cache-park ram|disk|auto(defaultram) — the parking target.ram— capture to host RAM, keep it, mirror it to disk (spill-on=park). What the engine did before.disk— park to disk only: capture, hand the copy to the asynchronous spill writer, and free the RAM copy at once. The RAM cache keeps nothing for that park (conversations.size()does not grow;put()is not called for it).auto— resolved once at startup, after the arena and the model are resident:diskwhen the free RAM cannot hold one snapshot per cache slot beside the floor,ramotherwise. Reported on stderr (park target auto -> disk|ram).--conversation-cache-park-min-free-mib(default512) — the transient RAM floor a disk-bound capture may take, as opposed to the parking floor--conversation-cache-min-free-mib(default2560) that a capture which stays in RAM must leave. Two floors because the big one exists to stop the OS paging during a capture that stays; a disk-bound capture is transient — its RAM is freed right after — so refusing it only pays the re-prefill.0= require onlyneed.diskneeds the disk tier (--conversation-cache-spill-dirwith--conversation-cache-spill-on park); without it the parking stays in RAM with a warning rather than parking nothing.conversation_disk_placement, the park rule with the destination fixed to disk): the conversation disk hit, the segment-tier hit, the system-prompt-cache hit, the streamed session restore and the API session save are admitted under the transient floor when the parking floor does not hold, and refused only when neither holds — each printing… hit under the transient RAM floor (need … plus 512 MiB, not 2560 MiB). A copy already on disk is never ignored for RAM it would not keep.Measured motivation for
disk: with 4 slots the RAM cache's committed parking is up to the 8 GiB budget (two parked conversations alone measured 4.51 GB, at 1.6–2.9 GB per conversation); indiskmode that committed RAM becomes reclaimable file cache instead.What was measured. The window above (2026-10-14 19:32:30 → 20:22:03), and the production boot with the disk target (
--conversation-cache-park disk; engine run 2026-10-14 23:20:24 → 2026-10-15 07:02:42, closed):skip parking0; park-to-disk decisions 365; parks completed 272; restores from disk 277;discard snapshot (stage count)53; K/V re-processed 3,123,699 / 26,117,121 = 12.0 %. Host free RAM under the disk target (window 2026-10-15 00:13:23 → 00:18:40, 136 samples): mean 7,102 MiB (min 4,475 · max 9,936). Sources: the engine log of that run, re-counted in the measurements note of 2026-10-15; the window's own capture (raw-timestamped.log,events.jsonl,snapshots.csv).What this does not claim. Not verified. The live run cited is of the binary
strata-parkdisco.exe(another layer), not of this integrated binary. The window's counts are a snapshot of a live log; the baseline window and the after window are different traffic, not an A/B. Functionally this capability needs only A (the tier, with-spill-on park); the cherry-pick requires the whole chain because every commit touchessrc/program/generate.cpp.Upstream issues. Mitigates #1347 (closed/completed — the physical-RAM park gate; this closes the residue where the copy is already on disk and the read is admitted under the transient floor); related — #1620 (closed/not planned) proposed the provisional park this series implements, and #2502 (open) reports a refused park.
The commits it needs.
acc09864,571f1203generate.cppH. Default spill dir + default system-prompt-cache dir
The problem. The disk tier required the operator to name the spill folder; without the flag there was no disk tier at all.
What it does.
2f8d3cad—--conversation-cache-spill-dirresolves a default instead of requiring the flag (conversation_spill_dir_resolve).b0c177f1—--system-prompt-cache-dirdefaults the same way.What was measured. Nothing measurable before/after: the note declares host resolver tests (29 checks,
ctest20/20) — declared, not reproduced.What this does not claim. Not verified. The resolver tests are declared by the commit's note, not observed here.
Upstream issues. No upstream issue reports the missing default directory; related — #1090 and #1331 (closed/completed, the system prompt on disk) touch the same system-prompt-cache path.
The commits it needs.
2f8d3cad,b0c177f1b0c177f1additionally Jctest20/20 — declared, not reproducedI. Disk-tier & cache observability (engine
INFO+/metrics+ Monitor rows)The problem. The disk tier's folder and live state were invisible, and an absent counter was being reported as
0.What it does.
conversation_cache_spill_dir,conversation_cache_disk, theloading … from disk/from coldline, and thelive.admissionfield);serve/server.pyparses them, and the web Monitor shows the parking by destination, the per-slot speeds and the admission state.16b67c46/1f572df4— expose the system-prompt cache's folder and budget in theINFOline, and stop reporting an absent counter as 0.conversation_cache_warm_dir/conversation_cache_warm_mib/conversation_cache_warmto theINFOline, adegraded N conversations to the cold levelline, and a third row per destination in the Monitor.What was measured. System-prompt cache (the whole engine log, read 2026-10-15 11:27): 8 hits / 106 misses. The notes declare
py_compile/pytestand fixtures in Chrome headless — but only synthetic: against a simulated/metrics, without a live engine.What this does not claim. Not verified against a live engine: the fixtures run against a simulated
/metrics. The 8/106 is the shared root written far more often than it is read back — it is one read of one log.Upstream issues. Related — #596 (closed/completed) asked for a conversation-cache view in the Monitor tab.
The commits it needs.
20e5760b,b9b83c86,16b67c46,1f572df4py_compile/pytestand Chrome-headless fixtures against a simulated/metrics; no live engineJ. The cascade: a warm level, and degrade instead of delete
The problem. The conversation cache had no level above the disk tier: a level that ran out of budget deleted its oldest entry instead of demoting it to a colder one.
What it does. The cache now runs VRAM → RAM → warm → cold. The warm level is new and opt-in; the cold level is the disk tier this series already had.
--conversation-cache-warm-dir+--conversation-cache-warm-mib(empty /0= the warm level is off). This is the new pair.--conversation-cache-cold-dir+--conversation-cache-cold-mibare the canonical names of the existing disk tier — the same field, the same directory, the same files.--conversation-cache-spill-dirand--conversation-cache-disk-mibkeep working as aliases of the same field; two names pointing at one field with different values is a start-up error. The cold level is the existing directory so that the tier the operator already runs — hundreds of GiB of parked conversations — is inherited with zero migration: the engine recognises a directory by thestrata-conv-name prefix and the sidecar identity, not by which flag opened it, and it rewrites nothing on open.enforce_budget,enforce_age) and a next level is set, the entry is handed to the next level (degrade_to_next→adopt): the cold level writes its own sidecar, relocates the session files (relocate_file— a rename on one volume, a copy+delete across two) and re-seals the entry's age; the warm level then drops its own copy. Only the last level (the cold) deletes — FIFO by budget, and by age if the operator asked for it. A degradation is not an eviction: the warm level'sdisk_evictionsandage_evictionscounters do not move.when-full=reject, an oversized image, an I/O failure), nothing is moved and the entry stays in the warm level. The whole move is reverted on any failure.--conversation-cache-min-free-miband the transient--conversation-cache-park-min-free-mibstay what they are; the cascade reuses the same transistor, adding no third admission rule.from diskand returns the same instance as before, and the tree is byte-for-byte the one that ships without this change. The gate for a level is the same one the existing tier uses (a non-empty directory and a non-zero budget).What was measured. The cascade's warm level against the cold one — measured on the live engine (2026-10-15) as a 2×2 by level and freshness (22 synthetic conversations of ~5,700 prompt tokens, six randomized rounds with the order shuffled; an old round first reads 10 GiB of unrelated files to push the images out of the OS page cache). The engine's own figure for restoring a parked image —
restored N tokens (<level>/…) in X ms— is:disk/…)cold/…)The level does not weigh, and neither does freshness command the median: a floor of ~100 ms does, and freshness appears only as a tail of the warm volume — 9 of 69 warm restores took 300–2834 ms, against 0 of 125 cold ones. Pooled (warm n=69, median 100.5 ms · cold n=125, median 97.3 ms) the ratio is 0.97 with interval [0.906–1.076], which includes 1 → no ratio is asserted.
Why the two earlier runs differed: they ran on different builds — one without the eviction fix, one with it. They did not contradict each other: they measured different things. And the datum that refutes the OS page-cache hypothesis: the images truly old (14, intact for hours) were the fastest measured (74.8 ms), so age alone does not make a restore slow. The warm level's
degradedcounter went 0 → 45 in the first synthetic run and 0 → 21 in the re-test, holding at ~10,112 MiB of its 10,240 MiB budget while the cold absorbed the overflow: it degrades, it does not drop. Source:09-implementacion/2026-10-15-ab-por-nivel-y-frescura-v1.0.0.md; the earlier pair from09-implementacion/2026-10-15-test-sintetico-cascada-v1.0.0.mdand09-implementacion/2026-10-15-re-test-cascada-con-arreglo-v1.0.0.md.No gain in this machine, with the cause. Measured on this machine (X870P) and this configuration: the two levels give the same median because the bottleneck is the disk path, not the level — in the small-read regime it delivers ~0.5-1 GB/s against the 7 GB/s the drive can do. A large restore (171.5k tokens) did reach 657 ms ≈ 2.8 GB/s, so the ~1 GB/s ceiling belongs to the small-read regime, not to the drive.
What this does not claim. Not verified. The 2×2 is not a controlled media comparison —
warmlives onC:andcoldonD:, two physical SSDs, and the cold images were, on average, written earlier than the warm ones, so the OS page-cache state is not equalised; no ratio is asserted (the pooled CI contains 1, and the "old" manipulation is a page-cache flush, not age); the request latency includes prefill and admission and whatever else the engine was doing (:5011is production, the window was not isolated);restored … in X msis the engine's figure for the load it closes, not isolated disk I/O; and one synthetic workload with a single client is not a load profile. The warm level is new code: its 406 host checks and its mutation check pass, but nothing of it has been served. The cascade is not safe to take without K: without the cold-level eviction fix, the warm level degrades into a cold that deletes by a hidden cap of 256, and taking J without K erases parked material.Upstream issues. Closes #2597 (ours, open) — the cache degrades across levels instead of deleting, each level switched off by its own budget. Related — #1920 (open: two alternating long conversations evict each other), #2264 (open: it re-parks every turn) and #2448 (open: an incremental write and a fill policy).
The commits it needs.
ac5a1746,33d41214,686d0b57,bb31e4e433d41214); I (ac5a1746→16b67c46). Do not take without the cold-eviction fix (K)K. Cold-level eviction fix: budget, not a hidden count of 256
The problem. The same synthetic run exposed a real defect, and it is stated as what it is — a defect of ours, caught by our own test. The cold level had a hidden ceiling of 256 entries (
kMaxSidecarEntries), named in no log line and in no/metricsfield, andadopt()runs the cold level's GC unconditionally — so every warm→cold degradation deleted exactly one cold copy, with460800MiB configured and only265848MiB in use. Over the test window that was 45 degradations and 45 removals: ≈48.5 GiB of already-parked state deleted, not archived (≈44 conversations at ≈1,128 MiB each; the net byte drop read smaller, −30.1 GiB, only because the same 45 degradations had just written ≈18.5 GiB in). The cap was also pre-existing to the cascade (07613f4b, the original durable tier): any spill into a cold pinned at 256 deletes the same way.What it does.
ba89b7fc— the count term is gone from the removal: the cold now evicts by its MiB budget, the lever the operator sets. The entry cap keeps only its other role, arejectlevel refusing new work instead of evicting for it. The cap also stopped being invisible: the startup lines declaremax-conversations,/metricsexposes it per destination, and each removal and each degradation writes a line naming the victim and the lever (budgetorage). A regression test (T11) fills the cold to its entry cap with MiB to spare and degrades one copy in: nothing may be removed.What was measured. Before the fix: 45 degradations → 45 cold evictions (exact 1:1), ≈48.5 GiB of previously-parked material deleted. After the fix (re-test, 2026-10-15): 21 degradations → 0 cold evictions, the cold grew +21 conversations and +8,544 GiB (the Δ bytes; GiB, not MiB) and lost 0 — the counts rest on a host test and its mutation, declared, not reproduced. Sources:
09-implementacion/2026-10-15-diagnostico-eviccion-del-frio-v1.0.0.mdand09-implementacion/2026-10-15-fix-eviccion-del-frio-y-visibilidad-v1.0.0.md.What this does not claim. The fix rests on a host test and its mutation, not a served run — it has no live measurement of its own; and the mutation was not executed (declared by the note). With no cascade configured the cold level behaves as before (same flag, folder, inheritance and read path; it is still the only level that removes, by budget and age). Owner's note: the test left ~26 GiB of synthetic material in the tier, and through this eviction the cold level lost ≈48.5 GiB of previously-parked material — the production tier changed content while it was being measured.
Upstream issues. No upstream issue covers the fix — it is a defect of ours, caught by our own test; related — #2448 (open) reads the eviction order as least-recently-used, where the code is FIFO.
The commits it needs.
ba89b7fcb0c177f1), L (256d76b3)L. Monitor: per-slot clocks, tachometer, solo speed, RAM row
The problem. The Monitor did not list every batch slot or clock its context, its aggregate clock did not sum its slots, and the RAM row did not count what the slots hold.
What it does.
de0f1f3a— the Monitor draws the cascade's warm and cold levels.8f6bfa10— lists every batch slot and clocks its context;5320268c— the aggregate clock sums its slots, and the slot texts move right;1895e7ed— the Context fill clocks flank the big one, a tachometer.256d76b3— the slot speeds name the solo request, and the RAM row counts what the slots hold.What was measured. No measurable before/after: the notes declare
test_monitor.py(up to 38→47) +node --check+ textual asserts; no browser render; the estimated row (kv_estimated) is not validated against a live engine.What this does not claim. Not verified; no render in a browser; the
kv_estimatedrow is not validated against the live engine; the asserts are textual.Upstream issues. Related — #596 (closed/completed) asked for the conversation-cache view in the Monitor tab.
The commits it needs.
de0f1f3a,8f6bfa10,5320268c,1895e7ed,256d76b3test_monitor.py(38→47) +node --check+ textual asserts; no browser render;kv_estimatednot validated liveM. Installer: several requests at once, and the conversations kept on disk
The problem. The installer asked nothing about running several requests at once or keeping the conversations on disk, and it chose the slot count after the context size was already fixed.
What it does.
528be20fadds two questions to the flow it already has — one request or several, and whether the conversations are kept on disk — placed after the model and the machine bench and before the context size, so the slot count is chosen with the model and the context already known.layer_args) writes--conversation-cache-mib 8192,--conversation-cache-warm-dir <install>\slots\warm --conversation-cache-warm-mib 8192and the cold via--conversation-cache-disk-mib(the alias of the canonical-cold-*, so an engine older than the rename is not broken by a name). No new flag:--parallel Nalready existed, and a--parallelon the command line is the answer to the first question.6a93aadf— the conversation cache's RAM is off at 0, not unlimited, and it is not the KV cache (a text fix insetup.py; its message correction is "0 = off", not "0 = no limit").setup.pybefore and after this change, across 5 machines × 5 sizes × (--yesor Enter), gives 50 cases and 50 identical results, with--yesasking nothing at all. No answer means the previous behaviour.What was measured. The 50 cases / 50 identical results above, plus the golden
50/50;py_compileOK;tools/test_setup_*.py→ 40 files, 580 tests, 0 failures.6a93aadfdeclarespy_compileOK + golden. Sources:09-implementacion/2026-10-15-instalador-pasos-multislot-y-disco-v1.0.0.md.What this does not claim. Not verified as a real install (no model downloaded, no engine started — the start is stubbed and fails if called).
6a93aadfis not published yet. The golden is declared, not reproduced here. Functionally the disk question needs J (it writes--conversation-cache-warm-*, which an engine older than the rename rejects).Upstream issues. No upstream issue covers the installer flow (the parallel-requests path it surfaces is the engine's own
--parallel N).The commits it needs.
528be20f,6a93aadfd40cb783) for528be20f; functionally J (it writes--conversation-cache-warm-*)py_compile+ golden 50/50 identical;6a93aadfdeclarespy_compile+ golden — declared, not reproduced.6a93aadfis not publishedN. Documentation
The problem. The new flags and behavior needed documenting: a parked image's identity bound to the engine version, and the lever named.
What it does.
940eb9bf— documents the disk tier, the restore ladder, the anchored frontier and the chunked large pages.d40cb783— documents the parking destination and the resolved spill directory.957d27b0— binds a parked image's identity to the engine version, and names the lever.docs/FLAGS.md,docs/SPILL_AND_PROMPT_CACHE.md,docs/DETAILS.md.What was measured. Nothing — no measurable before/after: this is prose — not verified (there is nothing to measure).
What this does not claim. Prose, not verified. It documents the other capabilities; it does not by itself change behavior.
Upstream issues. No upstream issue — this is the documentation of the series.
The commits it needs.
940eb9bf,d40cb783,957d27b0940eb9bf); A, I (d40cb783);d40cb783for957d27b0Extra Notes
Measurements
Every figure below is real and carries its origin; each capability has its own table instead of one global one. A capability with no live figure says so.
A — durable on-disk conversation tier
system prompt cache: hit \d+ tokens/prefix changed (missB — two-pass streaming session restore
C — per-stage content-addressed segments
SysdedupD — prefix restore ladder
image rejectedbranch did not fire in the live matrix → host-tested, not measuredE — Windows chunked large pages + expert-arena-first
F — continuous batch-read agenda
G — parking target + spill-instead-of-discard + transient floor
--conversation-cache-park disk; 2026-10-14 23:20:24 → 2026-10-15 07:02:42, closed)skip parking0; park-to-disk 365; parks completed 272; restores from disk 277;discard snapshot (stage count)53; K/V re-processed 3,123,699 / 26,117,121 = 12.0 %skip parking24;disk hit skipped15; K/V re-processed 1,458,547 tokens = 2,110,865 ms (35.2 min)raw-timestamped.log,events.jsonl), re-counted in the measurements notesnapshots.csvI — disk-tier & cache observability
INFO//metrics/ Monitor rows/metrics— no live engineJ — the cascade
disk/…)cold/…)The level does not weigh, and neither does freshness command the median: a floor of ~100 ms does (freshness only as a tail of the warm volume: 9 of 69 warm restores at 300–2834 ms, against 0 of 125 cold). Pooled (warm n=69, median 100.5 ms · cold n=125, median 97.3 ms) the ratio is 0.97 with interval [0.906–1.076] — it contains 1, so no ratio is asserted. The two earlier runs differed because they ran on different builds (one without the eviction fix, one with it): not contradictory, they measured different things. The datum that refutes the OS page-cache hypothesis: the images truly old (14, intact for hours) were the fastest (74.8 ms). The warm level's
degradedcounter went 0 → 45 in the first synthetic run and 0 → 21 in the re-test, holding at ~10,112 MiB of its 10,240 MiB budget. Source:09-implementacion/2026-10-15-ab-por-nivel-y-frescura-v1.0.0.md.K — cold-level eviction fix
ba89b7fc)The regression test T11 fills the cold to its entry cap with MiB to spare and degrades one copy in: nothing may be removed. Sources:
09-implementacion/2026-10-15-diagnostico-eviccion-del-frio-v1.0.0.md,09-implementacion/2026-10-15-fix-eviccion-del-frio-y-visibilidad-v1.0.0.md.L — Monitor
test_monitor.pynode --check+ textual assertskv_estimatedrowM — installer
setup.pybefore vs after, 5 machines × 5 sizes × (--yesor Enter)--yesasking nothing at all09-implementacion/2026-10-15-instalador-pasos-multislot-y-disco-v1.0.0.md50/50;tools/test_setup_*.py→ 40 files, 580 tests, 0 failuresN — documentation
Where each number comes from. Working notes of the author, on disk (paths relative to this repository's working tree):
09-implementacion/2026-10-15-mediciones-y-procedencia-v1.0.0.md— every figure above with its exact pattern or command, the file it lives in, its window, and whether it reproduces.docs/SPILL_AND_PROMPT_CACHE.mdanddocs/FLAGS.md.2026-10-14 23:20:24(--conversation-cache-park disk) and the 2026-10-14 window (_medicion/2026-10-14-eviction/raw-timestamped.log,events.jsonl,snapshots*.csv) — read directly, and a directory listing ofD:\AI\servers\strata\slots\xl.2026-10-14-entrega-por-commit/01-tier-de-disco-y-system-prompt-cache.md) and the published body's demo table.Relationship to the issues and PRs this series sits beside
The verb is the strong verb the code supports, and no stronger.
discard snapshot (stage count: saved=0 current=1), 40 in one boot, one of 165,543 tokenslayer-split autois not stable between starts and a different K invalidates the whole on-disk tier--layer-splitis the mitigation. It is not implemented here: a search of the series for any change to the split returns 0 commits.Carried over from the published body, unchanged:
BYIELDon the pipelined route is theirs:batch_read_piece()returns 0 for the pipelined groups, so the decode-share block and theBYIELDpoint below it are unreachable by construction, and #2050 fixes it opt-in (STRATA_PIPED_READ_PIECE, measured pause 12.2 s → 4.2 s). This series cites both and does not re-implement them; see also #1906 and #1603.parkscounter does not count that path, so it under-counts the real parking decisions; the metric is left as is.session_save_reclaim(...)still aims at the large floor while the save's gate now admits the transient one.Relationship to the other on-disk tiers in flight, measured. Five open PRs implement a durable conversation tier on disk: #1271 (ANBAL534), #1480 (routhjim), #1529 (konijiwa110), #1810 (CC-David-CC) and #1937 (xrip). #1271, #1480, #1529 and #1810 introduce the same three new paths this series does (
include/strata/core/conversation_spill.hpp,src/core/conversation_spill.cpp,src/core/conversation_spill_test.cpp), so one of us will merge and the rest will be add/add conflicts; #1937 takes the other route and modifies the cache in place with its ownconversation_disk.*. What follows is what this package covers, what each of the others covers that it does not, and what none of us covers. Every claim below is pointed at a flag or a file, and the facts about the other PRs were read from their patches and threads through the GitHub API, read-only.What this package covers, with the pointer
--conversation-cache-spill-dir,--conversation-cache-spill-on park;conversation_spill.{hpp,cpp}best()/load(); the sidecar carries tokens and images, not K/Vconversation_park_placement()inconversation_memory.hppSCSMsidecar is rescanned on openSessionFileIdentity(model fingerprint + config fingerprint,engine = STRATA_VERSION)SCSM—MetaWriter/MetaReaderkMetaVersion = 2; v1 is still read — the v1 sidecar of #1271/#1480/#1529/#1810 is accepted--conversation-cache-warm-dir/-warm-mib; the cold is--conversation-cache-cold-dir/-cold-mib(aliases of the historical-spill-dir/-disk-mib);set_next/degrade_to_next/adopt; only the cold deletes — no PR in the group has this--conversation-cache-disk-mib(8192),--conversation-cache-spill-when-full evict-oldest|reject--conversation-cache-spill-max-age-days--system-prompt-cache(its own dir/budget/slots/max-age/key) and the shared-Sysdedup of the segment tier--conversation-cache-segments,--conversation-cache-segment-budget-mib;conversation_segments.{hpp,cpp}— no PR in the group has thisSTRATA_RESTORE_LADDER;conversation_restore_ladder.hpp— no PR in the group has this--conversation-cache-park ram|disk|auto— no PR in the group has this--conversation-cache-park-min-free-mib(512) against the parking floor's 2560, applied to the disk hit, the segment hit, the system-prompt-cache hit, the streamed restore and the API session save — no PR in the group has this--session-min-free-mib(4096)serve/server.pyconversation_cache.destinations,spill_on,live.admission; the Monitor tabWhere another PR covers something this one does not
SessionKvSource), so a park never materialises a host image; #1529 and #1810 additionally write it on a background thread (spill_async). This series captures to host RAM and only the write is asynchronous. One of #1937's testers priced the difference at 27x between the capture and the streamed write. If the smaller memory bill at park time is what the maintainer wants, that work is in those PRs.SessionKvTarget,conversation_snapshot_restore_streamed), with no host copy of the K/V, measured at 3,048 MiB into the GPUs in 4.1 s. This series' two-pass restore streams in 16 MiB blocks but through host RAM; there is noSessionKvTargetin this tree.smartctl(131.8 GB in 70 min, ~2.7 TB/day on a 256 GB NVMe), and oneCONTRIBUTORwho found a correctness bug (index vs payload binding) and saw it fixed. The newest commits of this series have had no live run.--conversation-cache-similarity F,--conversation-cache-n-min N); this series' match is an exact prefix from the start, as the RAM cache's is.--conversation-cache-disk-min-tokens(do not write a conversation shorter than N) and keeps two checkpoints — the deepest and the root — which halves the file (603-699 MiB against 1149-1618 MiB) and is exactly what a new chat resumes from.strata-conv-prefix-N): never dropped as superseded, evicted last, deduped across restarts. This series reaches a similar goal with the system-prompt cache and the segment tier, by a different mechanism.conversation_spill.hppandconversation_spill.cppare byte-identical between #1529 and #1810 at the heads measured (same content hash).Where this package covers something the others do not
not enough RAM even for the running state: 2895 MiB available, and asked for a separate, lower floor for the read.--conversation-cache-park-min-free-mib(512 against 2560) is that floor, and it is applied to every path whose copy is already on disk.spill_onmode, and whether an admission in progress is loading or reading). #1480, #1529 and #1810 add a card; #1937 logs lines and a totals line.What none of us covers
discard snapshot (stage count), the run-to-run instability of--layer-split auto, and the pipelined prompt read that cannot give way (#2275, fixed opt-in by PR #2050): all declared below, none fixed here.Why one PR and not several. The contribution was verified as one tree: it was built, deployed and measured integrated, and its capabilities were not validated in isolation — 27 of the 31 commits need the ones before them, and some capabilities are unsafe without their companions (the cascade, taken without the cold-eviction fix, deletes parked state instead of degrading). Splitting this series would publish configurations whose behaviour was never measured. For a reviewer who wants a subset, The commits each capability needs gives the minimal ordered set for each capability and marks the independent ones — the disk tier, for instance, can be taken without the cascade.
The commits each capability needs
The series is a chain: on a clean
296b59d2, only07613f4b,c514173e,3e14ba41and7b965cb3apply alone; the other 27 need the earlier commit(s) that touch the same files. To take a capability, take its commits plus everything it lists under needs, in the order of this table. 14 capabilities (A–N); 31 commits = 30 published (296b59d2→ba89b7fc) +6a93aadf(child, not published yet); 3 independent — A, B and E.07613f4bc514173e26d29b52,7cd800131cc359d43e14ba410269a3c2acc09864,571f12032f8d3cad,b0c177f1b0c177f1INFO,/metrics, Monitor rows)20e5760b,b9b83c86,16b67c46,1f572df4/metricsac5a1746,33d41214,686d0b57,bb31e4e416b67c46). Do not take without the cold-eviction fix belowba89b7fcde0f1f3a,8f6bfa10,5320268c,1895e7ed,256d76b3528be20f,6a93aadf--conversation-cache-warm-*)6a93aadfis not published yet940eb9bf,d40cb783,957d27b07b965cb3ba89b7fc(+6a93aadfnext push)The one grab worth calling out: the durable on-disk tier (
07613f4b) — and the whole first chain (tier → streaming restore → segments → ladder → large pages → batch agenda + docs) — is self-contained: it needs nothing from the parking work, the cascade or the installer. And the cascade (J) is not a safe take without the cold-eviction fix (K): withoutba89b7fcthe warm level degrades into a cold that deletes by a hidden cap of 256.The series in order, oldest first: thirty commits on
296b59d2, messages verbatim (no hashes by hand -git logat the tip, published2026-10-15).07613f4b- serve: durable disk tier for the conversation cache (spill, archive, system-prompt cache)c514173e- serve: two-pass streaming session restore (read pass validates, apply pass copies 16 MiB at a time)26d29b52- serve: per-segment disk tier for the conversation cache (content-addressed segments)7cd80013- serve: anchor the segment frontier at the <|im_start|> opener, not the role token1cc359d4- serve: prefix restore ladder when a parked image fails validation (STRATA_RESTORE_LADDER)3e14ba41- cuda: reserve the expert arena before the PLE/GGUF, and Windows chunked large pages0269a3c2- serve: continuous agenda for batched reads (STRATA_BATCH_AGENDA, opt-in)940eb9bf- docs: document the disk tier, restore ladder, anchored frontier and chunked large pagesacc09864- serve: --conversation-cache-park (ram|disk|auto), and a rejected park spills to disk instead of discarding571f1203- serve: the transient disk floor decides the sibling disk hits and the API session save/restore too2f8d3cad- serve: default the conversation spill directory (--conversation-cache-spill-dir)20e5760b- serve: expose the disk tier's folder and live state, and the admission source, to the Monitorb9b83c86- serve: the Monitor shows the parking by destination, the per-slot speeds and the admission stated40cb783- docs: document the parking destination and the resolved spill directory7b965cb3- test: cover the admission source, the INFO line and the disk lifecycle in the Monitor16b67c46- serve: expose the system-prompt cache's folder and budget in the INFO line1f572df4- serve: expose the system-prompt cache's folder and budget, and stop reporting an absent counter as 0957d27b0- docs: bind a parked image's identity to the engine version, and name the leverac5a1746- serve: name the disk tier's cold level (--conversation-cache-cold-dir)33d41214- cache: the disk tier degrades to a next level instead of removing (delta 6)686d0b57- serve: the conversation cache gains the warm level of the cascadede0f1f3a- serve: the Monitor draws the cascade's warm and cold levelsbb31e4e4- serve: the run config and the docs carry the cascadeb0c177f1- serve: default --system-prompt-cache-dir like the spill directory8f6bfa10- serve: the Monitor lists every batch slot and clocks its context5320268c- serve: the Monitor's aggregate clock sums its slots, and the slot texts move right1895e7ed- serve: the Context fill clocks flank the big one, a tachometer528be20f- setup: several requests at once, and the conversations kept on disk256d76b3- serve: the Monitor's slot speeds name the solo request, and the RAM row counts what the slots holdba89b7fc- conversation cache: the cold level evicts by its MiB budget, not by a hidden cap of 256 entriesKnown limitations and what is not in this PR
This section keeps the items of the earlier body's
## Declared limitationsand## What we do not claimand extends them. Where upstream already tracks a problem the issue is cited so the reviewer can route it; where it does not, the limitation is simply stated and is not a claim.Declared limitations.
--layer-split autois non-deterministic between starts: the 100k reload's first attempt failed (unreadable chain … saved with another layer range) and re-prefilled; the retry with a stable split restored 99,715/99,722. Pinning the split is the mitigation. (Reacted in #2596; issues #509, #1238 and #2463 discuss which Kautopicks, none covers run-to-run stability or the invalidated tier.)page_sizecan be rejected for a live restore.Sys,Other,Answer);Think/Read/Write/ToolCall/ToolResultexist in the enum but are not materialized (the cutter is missing).Known limitations of the newer work.
pipe_drain()sits at the top of the serve loop, before the admission is processed, and from there to the end of the request nothing else drives a decode window:pump()andbatch_step()run on the single serve thread. The disk match, the two-pass stream, the restore into the session, the device-to-device copy into the batch slot and — on the production (pipelined) route — the prefill of the new prompt's tail all run inside that one admission. What is asynchronous is the write of the park mirror; the read is not. On the pipelined routebatch_read_piece()returns0, soread_parttakes one uninterrupted run and both theBYIELDhand-over and the decode-share interleave are unreachable there. That last finding is #2275's, cited above, not ours.STRATA_VERSION. The engine recognises a directory by thestrata-conv-prefix and the sidecar identity, not by which flag opened it, so the cold level inherits the existing tier with zero migration — but aSTRATA_VERSIONbump makes every on-disk imageforeignsilently. On the first real start after this lands, the cold level's start line must readforeign kept=0; if it is not 0, the inheritance failed and the run must stop.STRATA_VERSIONis not touched in this series.renametocopy_file+removeacross two volumes is the one path in the degradation that no test exercises: the harness cannot mount a second volume, so it is left uncovered rather than invented. What is covered is its consequence — a move that fails leaves nothing half-done on either side (the test takes the file exclusively so both the rename and the copy fail).degradedis a single total (budget and age together), not two; and a degradation performed by the writer thread is reported on the counter's next read, not at the instant. The segment store and the archive stay inside the cold level; moving them is another PR.--batch) engine with the disk tier and--conversation-cache-park disk|auto, nor any configuration where--conversation-cache-slotsdiffers from--batch, was exercised on a live engine; only the host policy tests cover them.--batch 1itself is refused by the engine ("it needs 2 or more slots"), so "one slot" means the serial serve.diskmode, a rejected disk write has no RAM fallback (the capture is counted and logged asdiscards=N), and a provisional park stays in RAM by decision. Inrammode, a parkprovisional(cancelled request) also keeps the large floor.4224-byte KV block used to convert block-read misses to MiB is hard-coded in the engine; a different model geometry would leave it stale, silently.disk hit skipped).Not covered, with its name (this is the honest shortfall of the package; each is named so it can be routed).
--conversation-cache-similarityand--conversation-cache-n-min, commit serve: durable disk tier for the conversation cache, and they are not in upstreammain) — and both sit at their defaults (0), so a disk hit is accepted with no minimum overlap. This package adds no policy on top of them.generate.cppobject; there is no live engine run andstrata.exewas not linked. #1480, #1529, #1810 and #1937 bring their own end-to-end measurements; this is the largest evidence gap in the package.What the numbers do not say.
tok/sfigures are contaminated by concurrent traffic on the live server. No absolute PCIe bytes (no DCGM on this box; the engine's own per-request proxies were used).Sysdedup is not conclusively measured (one pass, concurrent traffic); the restore ladder'simage rejectedbranch did not fire in the live matrix, so its in-serve effect is host-tested, not measured.diskmode on decode or answer quality was measured.ctestrun and by acl /Zssyntax check ofgenerate.cpp; no CUDA build, no live engine run, andstrata.exewas not linked. The cascade's warm level is new code: its 406 host checks and its mutation check pass, but nothing of it has been served.Credits
This layer is authored and directed by Shahrokh Zargarpour. The parking target, the transient floor and the cascade were written and verified with the Grok Build coding agent.
🤖 Generated with Grok Build — Flash Next XL Strata · DeepSeek V4 Flash
The on-disk spill sidecar format we build on — the
SCSMheader and theMetaWriter/MetaReaderpair, version 1 — is credited to the authors whose PRs carry it: #1271 (ANBAL534), #1480 (routhjim), #1529 (konijiwa110) and #1810 (CC-David-CC). Our sidecar is a backward-compatible superset (kMetaVersion = 2; "v1 (single image) is still read"): we read their v1, they do not read our v2. The v1 origin is credited to them by prudence — the timeline is ambiguous and we did not inspect their fork history to settle authorship.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.