[PR #718] [CLOSED] serve: park conversations on disk, keyed by a client id; requests without one stay in RAM #2786

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/718
Author: @evaanp
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: pr/disk-parking


📝 Commits (10+)

  • 8b9bb4e docs: add community benchmark submission guide
  • b4f70e7 docs: add RTX 5090 community benchmark results
  • e30cd9b Bench: RTX 3090 / dual RTX 3090 on EPYC 7453
  • 6f21f22 CS-T: the partial pin of the RAM tier opt-in (STRATA_PARTIAL_PIN=1)
  • c4175bd Merge branch 'f-q4-on242' into r131-final
  • f6c18ff docs: Unsloth UD-Q4_K_XL manual import (docs/UNSLOTH_Q4.md); DETAILS: the mapped mode without experts.bin, --resident-budget-gib, the tier counters
  • 652437b Merge branch 'f-q4-on242' into r131-final
  • 9259cad Engine 0.1.31: Unsloth UD-Q4_K_XL runs on a 64 GB PC (experimental: split GGUF, Q4_K/Q5_K/Q5_1/Q8_0 experts, RAM budget + SSD tier with routing prefetch), the low-RAM mode reads GGUF experts in place, Windows GGUF load 2x (#230), server status race (#266) and tokenizer (#268) fixes, truncated tool calls (#211/#231), AMD intrinsics (#262); setup requires it
  • 3fb00c1 HIP (S6): RDNA4 matrix-core prompt attention for int8 KV, opt-in (STRATA_HIP_WMMA=1, gfx12 only)
  • 648ab7f HIP (S6): router_top10 without its serial parts on AMD, bitwise the same (default on HIP; STRATA_HIP_ROUTER_OLD=1: old)

📊 Changes

1 file changed (+28 additions, -15 deletions)

View changed files

📝 tools/conversation_cache_parity.py (+28 -15)

📄 Description

Builds on #716 (parking with --layer-split); the first 12 commits are that PR.

What

Parking in RAM (#57) needs host RAM that a PC running this model has little of: the experts take it. A long agent
conversation is 1-2.5 GiB of snapshot, so with a few sub-agents and side calls the budget is gone, and every switch
back reads the whole prompt again. --conversation-disk-dir DIR parks on disk instead.

  • Keyed by the client. The header X-Strata-Conversation: <id> (or the body field strata_conversation) names
    the conversation; the engine gets it as conv=. The id only picks the files: the prompt must still continue what
    was parked, otherwise the request reads from the deepest checkpoint it shares.
  • Delta parks. A park writes the K/V pages from the first one the session rewrote, the running state and the
    checkpoints; pages the files already hold are kept. --conversation-disk-gib N (default 32) bounds the directory;
    the oldest conversation goes first.
  • Requests without an id stay in RAM. The RAM cache keeps serving them beside the disk: a side call parks and
    restores there, and never pushes a keyed conversation out. A session holding a keyed conversation is never parked
    in RAM too, and a keyed request is looked up only on disk.
  • When a conversation does not continue its live end, the engine logs where:
    does not continue its live end: diverges at N of M (prompt P); live=...|... prompt=...|..., with the token ids
    around it. That is how a client that re-renders its own history (a template, a tool-call parser, a tokenization
    the model did not sample) can be found; without the line the request just read from a checkpoint or from 0.
  • tools/conversation_cache_parity.py: --scenario disk (A with an id, B, A again, a request without an id, a
    rewind to a checkpoint) and --scenario mixed (A with an id, B and C without, interleaved), each against a run
    with no cache at all.

Measured

RTX 5060 Ti 16 GB + RTX 2000 Ada 16 GB (layer_split 30), Ryzen 7 9700X, 64 GB RAM, Samsung NVMe.

On our own branch (v0.1.38 merged with this code plus unrelated patches of ours; the parking code is the same as
here), IQ3_S, --conversation-cache-mib 1024:

  • --scenario disk: PASS (A/B/A, delta parks, a rewind to a checkpoint; tokens and main-model state byte-exact).
    ~2K-token conversation: the first park writes 254.5 MiB in ~0.36 s, a later one 113-226 MiB while keeping 141-255
    MiB already on disk; coming back reads its running state in 0.2-0.4 s and restores 28.5 MiB in 50-75 ms.
  • --scenario mixed: PASS. Only A (with an id) parked on disk; B, B+, C and B++ (without one) parked in RAM, and B+ and
    B++ came back from RAM, each turn byte-exact against its conversation played through without a cache.

Earlier, IQ2_XS with the 0.1.34-based version of this code:

  • 24K-token conversation: first park 0.7 GiB in 1.06 s, later parks 0.1-0.2 GiB; restore 355 MiB of K/V in ~0.27 s
    plus 0.4-1.1 s of running state. --scenario disk: tokens and main-model state byte-exact.
  • Behind an agent app with sub-agents (a day of use): a ~53K-token main conversation came back in ~1.4 s where reading
    it again took ~90 s; two sub-agents alternating per call switched in ~1.5 s each.

Developed with an AI coding assistant; all numbers measured on the machine above (Linux, CUDA 13).


🔄 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/718 **Author:** [@evaanp](https://github.com/evaanp) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/disk-parking` --- ### 📝 Commits (10+) - [`8b9bb4e`](https://github.com/Niko1221/Strata/commit/8b9bb4e3ee173e6f4b67c31be427f3d37b2492a2) docs: add community benchmark submission guide - [`b4f70e7`](https://github.com/Niko1221/Strata/commit/b4f70e7c9fbacb5125f606264b25f1db39417414) docs: add RTX 5090 community benchmark results - [`e30cd9b`](https://github.com/Niko1221/Strata/commit/e30cd9bc3071f6492eb56a6455efa4e515138f06) Bench: RTX 3090 / dual RTX 3090 on EPYC 7453 - [`6f21f22`](https://github.com/Niko1221/Strata/commit/6f21f2243aeea39a4e127d932a0a840a0c22aefb) CS-T: the partial pin of the RAM tier opt-in (STRATA_PARTIAL_PIN=1) - [`c4175bd`](https://github.com/Niko1221/Strata/commit/c4175bdb20b94626dcd3ee4dcfb24c5b1cec7503) Merge branch 'f-q4-on242' into r131-final - [`f6c18ff`](https://github.com/Niko1221/Strata/commit/f6c18ff90caf7b7d9a25ac4cc4abcb76c50e4155) docs: Unsloth UD-Q4_K_XL manual import (docs/UNSLOTH_Q4.md); DETAILS: the mapped mode without experts.bin, --resident-budget-gib, the tier counters - [`652437b`](https://github.com/Niko1221/Strata/commit/652437b792975577a3b9975b3040fb783d6e6a06) Merge branch 'f-q4-on242' into r131-final - [`9259cad`](https://github.com/Niko1221/Strata/commit/9259cad4cfa3543cd3b8decab5962672b968c649) Engine 0.1.31: Unsloth UD-Q4_K_XL runs on a 64 GB PC (experimental: split GGUF, Q4_K/Q5_K/Q5_1/Q8_0 experts, RAM budget + SSD tier with routing prefetch), the low-RAM mode reads GGUF experts in place, Windows GGUF load 2x (#230), server status race (#266) and tokenizer (#268) fixes, truncated tool calls (#211/#231), AMD intrinsics (#262); setup requires it - [`3fb00c1`](https://github.com/Niko1221/Strata/commit/3fb00c10953893b443354dede6431cad7b0e1198) HIP (S6): RDNA4 matrix-core prompt attention for int8 KV, opt-in (STRATA_HIP_WMMA=1, gfx12 only) - [`648ab7f`](https://github.com/Niko1221/Strata/commit/648ab7fae358c8885b659c30ce4a1e1682cbd2c2) HIP (S6): router_top10 without its serial parts on AMD, bitwise the same (default on HIP; STRATA_HIP_ROUTER_OLD=1: old) ### 📊 Changes **1 file changed** (+28 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `tools/conversation_cache_parity.py` (+28 -15) </details> ### 📄 Description Builds on #716 (parking with --layer-split); the first 12 commits are that PR. ## What Parking in RAM (#57) needs host RAM that a PC running this model has little of: the experts take it. A long agent conversation is 1-2.5 GiB of snapshot, so with a few sub-agents and side calls the budget is gone, and every switch back reads the whole prompt again. `--conversation-disk-dir DIR` parks on disk instead. - **Keyed by the client.** The header `X-Strata-Conversation: <id>` (or the body field `strata_conversation`) names the conversation; the engine gets it as `conv=`. The id only picks the files: the prompt must still continue what was parked, otherwise the request reads from the deepest checkpoint it shares. - **Delta parks.** A park writes the K/V pages from the first one the session rewrote, the running state and the checkpoints; pages the files already hold are kept. `--conversation-disk-gib N` (default 32) bounds the directory; the oldest conversation goes first. - **Requests without an id stay in RAM.** The RAM cache keeps serving them beside the disk: a side call parks and restores there, and never pushes a keyed conversation out. A session holding a keyed conversation is never parked in RAM too, and a keyed request is looked up only on disk. - **When a conversation does not continue its live end**, the engine logs where: `does not continue its live end: diverges at N of M (prompt P); live=...|... prompt=...|...`, with the token ids around it. That is how a client that re-renders its own history (a template, a tool-call parser, a tokenization the model did not sample) can be found; without the line the request just read from a checkpoint or from 0. - `tools/conversation_cache_parity.py`: `--scenario disk` (A with an id, B, A again, a request without an id, a rewind to a checkpoint) and `--scenario mixed` (A with an id, B and C without, interleaved), each against a run with no cache at all. ## Measured RTX 5060 Ti 16 GB + RTX 2000 Ada 16 GB (`layer_split 30`), Ryzen 7 9700X, 64 GB RAM, Samsung NVMe. On our own branch (v0.1.38 merged with this code plus unrelated patches of ours; the parking code is the same as here), IQ3_S, `--conversation-cache-mib 1024`: - `--scenario disk`: PASS (A/B/A, delta parks, a rewind to a checkpoint; tokens and main-model state byte-exact). ~2K-token conversation: the first park writes 254.5 MiB in ~0.36 s, a later one 113-226 MiB while keeping 141-255 MiB already on disk; coming back reads its running state in 0.2-0.4 s and restores 28.5 MiB in 50-75 ms. - `--scenario mixed`: PASS. Only A (with an id) parked on disk; B, B+, C and B++ (without one) parked in RAM, and B+ and B++ came back from RAM, each turn byte-exact against its conversation played through without a cache. Earlier, IQ2_XS with the 0.1.34-based version of this code: - 24K-token conversation: first park 0.7 GiB in 1.06 s, later parks 0.1-0.2 GiB; restore 355 MiB of K/V in ~0.27 s plus 0.4-1.1 s of running state. `--scenario disk`: tokens and main-model state byte-exact. - Behind an agent app with sub-agents (a day of use): a ~53K-token main conversation came back in ~1.4 s where reading it again took ~90 s; two sub-agents alternating per call switched in ~1.5 s each. Developed with an AI coding assistant; all numbers measured on the machine above (Linux, CUDA 13). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03: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#2786
No description provided.