[GH-ISSUE #2415] [Feature]: kv_stream page-pool eviction: measure CLOCK against selection-aware LRFU before changing anything #978

Closed
opened 2026-11-04 01:47:27 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @MrKop-git on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2415

What do you want to do?

With --kv-resident, a streamed QSA layer keeps its full K/V in pinned RAM and a page pool in VRAM. kv_stream_resolve makes every block the selection names resident, and when the pool is full a CLOCK (second-chance) sweep picks the victim. The QSA indexer already names the blocks each step reads — the hit signal is right there, and kv_stream_counters already reports misses / lookups / calls.

I would like a measured eviction-policy sweep for that pool: replay real selection traces through CLOCK and through a selection-aware LRFU keep score (each hit adds the selection's weight, every step decays: KS = λ·KS + hit, λ around 0.5), and adopt the winner as the default only where it measurably wins. The same "eviction policy is a measured question" approach as #1089 takes for the expert cache's admit.

Why

Fewer RAM→VRAM block re-reads is less PCIe traffic and shorter stalls on long contexts where KV streaming is on (64K and up, as setup chooses). The page pool is only a cache — kv_stream_parity proves the streamed readers see exactly the resident values — so a policy change cannot change any answer; it is purely a throughput question.

How I would check it

  • an offline bench along the lines of tools/replay_cache_policy.py, replaying dumped selection traces through both policies and reporting misses and bytes re-read;
  • a live A/B on a named card and model with the same prompts, reporting miss rate and wall time per request, and what was not tested;
  • an opt-in switch first (--kv-evict clock|lrfu, default clock unchanged); a default change only with the numbers in the PR.

Context

Outside evidence, for motivation only: LRFU keep scores with a decay factor are what ActKV (arXiv:2609.31395) uses for agentic KV retention, and kvmem 0.18.0 ships LRFU (lambda=0.5, top-frac=0.9) as its default history weighting. Whether that beats CLOCK on this engine's QSA selections is exactly the measurement this issue asks for.

Originally created by @MrKop-git on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2415 ## What do you want to do? With `--kv-resident`, a streamed QSA layer keeps its full K/V in pinned RAM and a page pool in VRAM. `kv_stream_resolve` makes every block the selection names resident, and when the pool is full a CLOCK (second-chance) sweep picks the victim. The QSA indexer already names the blocks each step reads — the hit signal is right there, and `kv_stream_counters` already reports misses / lookups / calls. I would like a measured eviction-policy sweep for that pool: replay real selection traces through CLOCK and through a selection-aware LRFU keep score (each hit adds the selection's weight, every step decays: `KS = λ·KS + hit`, λ around 0.5), and adopt the winner as the default only where it measurably wins. The same "eviction policy is a measured question" approach as #1089 takes for the expert cache's `admit`. ## Why Fewer RAM→VRAM block re-reads is less PCIe traffic and shorter stalls on long contexts where KV streaming is on (64K and up, as setup chooses). The page pool is only a cache — `kv_stream_parity` proves the streamed readers see exactly the resident values — so a policy change cannot change any answer; it is purely a throughput question. ## How I would check it - an offline bench along the lines of `tools/replay_cache_policy.py`, replaying dumped selection traces through both policies and reporting misses and bytes re-read; - a live A/B on a named card and model with the same prompts, reporting miss rate and wall time per request, and what was not tested; - an opt-in switch first (`--kv-evict clock|lrfu`, default `clock` unchanged); a default change only with the numbers in the PR. ## Context Outside evidence, for motivation only: LRFU keep scores with a decay factor are what ActKV (arXiv:2609.31395) uses for agentic KV retention, and kvmem 0.18.0 ships LRFU (lambda=0.5, top-frac=0.9) as its default history weighting. Whether that beats CLOCK on this engine's QSA selections is exactly the measurement this issue asks for.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271026575 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#978
No description provided.