Repository navigation
cache: preserve root system prompt checkpoint across turns and eviction - #65
Closed
code-martin wants to merge 1 commit into
Closed
code-martin wants to merge 1 commit into
code-martin wants to merge 1 commit into
Conversation
Capture the root turn boundary (system prompt) during the initial prompt read alongside the last turn boundary, avoiding checkpoints at every intermediate turn to keep v0.1.13 prefill fast. During prompt cache eviction, preserve checks[0] so branching chats and new conversations sharing the system prompt can reuse it immediately without re-reading.
Contributor
|
you might wanna jump in over here #57 where the caching action is |
Niko1221
added a commit
that referenced
this pull request
Sep 28, 2026
…n top of #62); setup requires it A prompt read from token 0 is also checkpointed at its first turn boundary when that is 2,048 tokens or more (--prompt-cache-root N, 0 = off). It becomes the chain's root, which #62's retention policy pins, so a new chat of the same client reads only what follows the system prompt and tools. Without it, #62's root existed only for system prompts past --prompt-cache-every (16K). Co-Authored-By: code-martin <code-martin@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154bwiad8gY7wRehCXy27pN
Owner
|
Thanks @code-martin - saving a checkpoint at the end of the system prompt was exactly the piece #62 was missing. Since both changed the same eviction loop, I folded your idea into #62 (with credit in the commit), with a minimum of 2,048 tokens so short system prompts don't pay for the extra split (~0.3 s), and a switch ( |
13600k
added a commit
to 13600k/Strata-for-daniel
that referenced
this pull request
Sep 28, 2026
Brings in engine 0.1.13-0.1.20 and upstream PRs Niko1221#42-Niko1221#44, Niko1221#54, Niko1221#59, Niko1221#62-Niko1221#65, Niko1221#67, Niko1221#69 on top of the fork's experimental multi-GPU expert caches. Host test suites pass (expert placement 5935 checks, conversation cache, setup GPU selection, GPU telemetry, IQ pack, calibration); CUDA build and GPU parity remain pending hardware validation.
MistVVK
pushed a commit
to MistVVK/XeStrata
that referenced
this pull request
Oct 3, 2026
…221#65 on top of Niko1221#62); setup requires it A prompt read from token 0 is also checkpointed at its first turn boundary when that is 2,048 tokens or more (--prompt-cache-root N, 0 = off). It becomes the chain's root, which Niko1221#62's retention policy pins, so a new chat of the same client reads only what follows the system prompt and tools. Without it, Niko1221#62's root existed only for system prompts past --prompt-cache-every (16K). Co-Authored-By: code-martin <code-martin@users.noreply.github.com>
Hugua700
pushed a commit
to Hugua700/Strata
that referenced
this pull request
Oct 6, 2026
…221#65 on top of Niko1221#62); setup requires it A prompt read from token 0 is also checkpointed at its first turn boundary when that is 2,048 tokens or more (--prompt-cache-root N, 0 = off). It becomes the chain's root, which Niko1221#62's retention policy pins, so a new chat of the same client reads only what follows the system prompt and tools. Without it, Niko1221#62's root existed only for system prompts past --prompt-cache-every (16K). Co-Authored-By: code-martin <code-martin@users.noreply.github.com>
anon761
pushed a commit
to anon761/Strata-upstream
that referenced
this pull request
Oct 6, 2026
…221#65 on top of Niko1221#62); setup requires it A prompt read from token 0 is also checkpointed at its first turn boundary when that is 2,048 tokens or more (--prompt-cache-root N, 0 = off). It becomes the chain's root, which Niko1221#62's retention policy pins, so a new chat of the same client reads only what follows the system prompt and tools. Without it, Niko1221#62's root existed only for system prompts past --prompt-cache-every (16K). Co-Authored-By: code-martin <code-martin@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154bwiad8gY7wRehCXy27pN
konijiwa110
added a commit
to konijiwa110/Strata
that referenced
this pull request
Oct 7, 2026
…pt instead of reading it again The system-prompt checkpoint (Niko1221#62, Niko1221#65) lives in the one K/V arena, so it is gone as soon as a request with another start comes in, and after every restart. --prefix-cache-dir keeps it in a file: after DONE, the root checkpoint's running state and the K/V up to it (draft layer included) are streamed into DIR once per distinct system prompt; a later prompt that starts with one restores it and reads only the rest. Files are capped by --prefix-cache-disk-mib (LRU), the most recent ones optionally kept in RAM (--prefix-cache-ram-mib); without the RAM they stream through a 64 MB buffer. A file from another engine build, model or --kv is deleted at start-up. One GPU without --batch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses root checkpoint retention for --serve prompt caching, keeping the root system prompt cached across branching chats and new conversations without compromising v0.1.13 prefill throughput:
Root & Last Turn Checkpoints Only:
Root Preservation During Eviction:
esume == checks[0].ids.size()) without prefilling the system prompt again.