[PR #265] [CLOSED] nvme kv cache v2 - the delta tier + v4 snapshots (replaces #52) #2537

Closed
opened 2026-11-04 02:01:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/265
Author: @maedoc
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: nvme-kv-cache


📝 Commits (10+)

  • 66846e9 NVMe KV cold tier for warm sessions (docs/nvme-kv-cache-design.md)
  • b2a3db8 kv-nvme: snapshot at the chat turn boundary (nvme_dump_at)
  • a9e783b docs: fold the NVMe tier design into a self-contained record; drop the review annexes
  • e449704 kv-nvme: payload-integrity footer on every snapshot
  • f0e8b27 kv-nvme: diagnose layout drift before integrity on restore
  • d87b662 WIP checkpoint: shared conversation core imported, tier retyped to it (step 2, unfinished)
  • 5c3a601 docs: write the section kv_nvme.hpp already pointed at
  • b5acb62 kv-nvme: a turn-boundary snapshot stored the WRONG IMAGE LIST, so any conversation with a picture was unreachable
  • 0cc235b kv-nvme: NvmeEntry::imgs was NEVER FILLED, so every image comparison in the tier compared against nothing
  • 3f55676 kv-nvme, generate: the shared core's diagnostic string was thrown away at every call site

📊 Changes

50 files changed (+14973 additions, -175 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 CMakeLists.txt (+76 -1)
➕ docs/nvme-delta-cache-handoff.md (+824 -0)
➕ docs/nvme-delta-restore-handoff.md (+262 -0)
➕ docs/nvme-kv-cache-design.md (+693 -0)
➕ docs/nvme-kv-cache-web-design.md (+431 -0)
➕ docs/nvme-kv-cache-web-plan.md (+382 -0)
➕ docs/nvme-kv-web-merge-handoff.md (+335 -0)
➕ docs/nvme-restore-perf-evidence.md (+114 -0)
➕ include/strata/core/conversation_cache.hpp (+162 -0)
➕ include/strata/core/conversation_memory.hpp (+24 -0)
➕ include/strata/core/conversation_snapshot.hpp (+66 -0)
📝 include/strata/core/layer.hpp (+13 -0)
📝 include/strata/core/mtp.hpp (+3 -0)
📝 include/strata/kernels/kv_stream.hpp (+9 -1)
📝 include/strata/kernels/qsa.hpp (+19 -0)
➕ include/strata/platform/kv_delta.hpp (+356 -0)
➕ include/strata/platform/kv_nvme.hpp (+436 -0)
➕ serve/kvcache.py (+475 -0)
📝 serve/server.py (+126 -27)

...and 30 more files

📄 Description

Builds on the work reviewed in #52, with the two asks it left open addressed: snapshots bound to the weights that wrote them, and --kv k8v4 in the format key.

Summary

The v3 header carried the model geometry, and geometry is not identity - two weight sets of one architecture share it exactly, so a snapshot of another model's conversation had everything it needed to match, verify its digest and apply cleanly. v4 makes the header say whose bytes these are.

  • v4 snapshot header - carries the weight-set fingerprint (§5.8) and the KV storage key, so a same-geometry foreign-weights snapshot can never promote; both refusals are the recoverable class, before the first CUDA call, so a mismatch re-prefills and never mixes state
  • --kv k8v4 in the format key - the key is now qsa_kv_key, total over all four formats, so a k8v4 store is keyed apart from every other layout instead of being filed as fp16
  • delta tier - turn-boundary incremental writes (content-addressed chunks plus a per-turn state record), so the write cost tracks the new tokens rather than the session; off unless --kv-nvme is passed
  • rebased onto 0.1.28

Two things worth flagging: this converges onto #189's shared core as soon as that lands - this branch currently carries the imported copy - and the disk tier in #190 is acknowledged; the coordination is the open item.

The one re-prefill per conversation after the upgrade is the deliberate cost of the version bump: a v3 file is refused by version, never converted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/265 **Author:** [@maedoc](https://github.com/maedoc) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `nvme-kv-cache` --- ### 📝 Commits (10+) - [`66846e9`](https://github.com/Niko1221/Strata/commit/66846e99950dc96b66728a4083283ff8b92a01a5) NVMe KV cold tier for warm sessions (docs/nvme-kv-cache-design.md) - [`b2a3db8`](https://github.com/Niko1221/Strata/commit/b2a3db851da4636a8a5d8359f1353ed8f911186c) kv-nvme: snapshot at the chat turn boundary (nvme_dump_at) - [`a9e783b`](https://github.com/Niko1221/Strata/commit/a9e783bce383faad27fbeba954eec2521bf84d1e) docs: fold the NVMe tier design into a self-contained record; drop the review annexes - [`e449704`](https://github.com/Niko1221/Strata/commit/e4497048390a19a14f5ee9075df4b9f840a8497d) kv-nvme: payload-integrity footer on every snapshot - [`f0e8b27`](https://github.com/Niko1221/Strata/commit/f0e8b27822af53047ef430bcc1dba27b9714135f) kv-nvme: diagnose layout drift before integrity on restore - [`d87b662`](https://github.com/Niko1221/Strata/commit/d87b662a40a79cf2fcb4483da45b2acf49efc86c) WIP checkpoint: shared conversation core imported, tier retyped to it (step 2, unfinished) - [`5c3a601`](https://github.com/Niko1221/Strata/commit/5c3a601086531403840fb2d2aaeba4952ea59831) docs: write the section kv_nvme.hpp already pointed at - [`b5acb62`](https://github.com/Niko1221/Strata/commit/b5acb62bfa41fc3c2d802517a120a852b89a8396) kv-nvme: a turn-boundary snapshot stored the WRONG IMAGE LIST, so any conversation with a picture was unreachable - [`0cc235b`](https://github.com/Niko1221/Strata/commit/0cc235b5af59568816410bf6b162b7c9f47de3c3) kv-nvme: NvmeEntry::imgs was NEVER FILLED, so every image comparison in the tier compared against nothing - [`3f55676`](https://github.com/Niko1221/Strata/commit/3f556760c7bbd493a836a04dcc4bfd883e5098e1) kv-nvme, generate: the shared core's diagnostic string was thrown away at every call site ### 📊 Changes **50 files changed** (+14973 additions, -175 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `CMakeLists.txt` (+76 -1) ➕ `docs/nvme-delta-cache-handoff.md` (+824 -0) ➕ `docs/nvme-delta-restore-handoff.md` (+262 -0) ➕ `docs/nvme-kv-cache-design.md` (+693 -0) ➕ `docs/nvme-kv-cache-web-design.md` (+431 -0) ➕ `docs/nvme-kv-cache-web-plan.md` (+382 -0) ➕ `docs/nvme-kv-web-merge-handoff.md` (+335 -0) ➕ `docs/nvme-restore-perf-evidence.md` (+114 -0) ➕ `include/strata/core/conversation_cache.hpp` (+162 -0) ➕ `include/strata/core/conversation_memory.hpp` (+24 -0) ➕ `include/strata/core/conversation_snapshot.hpp` (+66 -0) 📝 `include/strata/core/layer.hpp` (+13 -0) 📝 `include/strata/core/mtp.hpp` (+3 -0) 📝 `include/strata/kernels/kv_stream.hpp` (+9 -1) 📝 `include/strata/kernels/qsa.hpp` (+19 -0) ➕ `include/strata/platform/kv_delta.hpp` (+356 -0) ➕ `include/strata/platform/kv_nvme.hpp` (+436 -0) ➕ `serve/kvcache.py` (+475 -0) 📝 `serve/server.py` (+126 -27) _...and 30 more files_ </details> ### 📄 Description Builds on the work reviewed in #52, with the two asks it left open addressed: snapshots bound to the weights that wrote them, and `--kv k8v4` in the format key. ## Summary The v3 header carried the model geometry, and geometry is not identity - two weight sets of one architecture share it exactly, so a snapshot of another model's conversation had everything it needed to match, verify its digest and apply cleanly. v4 makes the header say whose bytes these are. - **v4 snapshot header** - carries the weight-set fingerprint (§5.8) and the KV storage key, so a same-geometry foreign-weights snapshot can never promote; both refusals are the recoverable class, before the first CUDA call, so a mismatch re-prefills and never mixes state - **`--kv k8v4` in the format key** - the key is now `qsa_kv_key`, total over all four formats, so a k8v4 store is keyed apart from every other layout instead of being filed as fp16 - **delta tier** - turn-boundary incremental writes (content-addressed chunks plus a per-turn state record), so the write cost tracks the new tokens rather than the session; off unless `--kv-nvme` is passed - rebased onto 0.1.28 Two things worth flagging: this converges onto #189's shared core as soon as that lands - this branch currently carries the imported copy - and the disk tier in #190 is acknowledged; the coordination is the open item. The one re-prefill per conversation after the upgrade is the deliberate cost of the version bump: a v3 file is refused by version, never converted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2537
No description provided.