Explore scratchpad · NVIDIA/hyperflare-inference #665

Raw Markdown for agents: https://autobot.eidonix.com/p/b71ac133-7071-4051-bba9-35b9497b3de5.md

#1 [high] Change: what PR #665 does and its size

PR #665 (open, ready for review, opened & last updated 2026-12-01, base main, head a7568c2). Author FujitsuPolycom. Labels: area:caching, performance. No reviews, no comments, no CI checks.

Files (4, +271/-6, all in helios/src):

What it does, plainly: GPU prefix-checkpoint eviction previously ordered victims only by (RetentionRank{use_epoch, role, consumed_tokens}, id) — i.e. pure recency-ish LRU (cache.rs:90-96 retention_rank, cache.rs:732 min_by_key). Adds a 1-bit per-checkpoint "reused" protection flag plus a turnover-based aging scheme, and sorts protected entries after unprotected ones in the victim key:

Eviction filter order preserved: below, immediate, protected_token_budget filters still run first (cache.rs:712-731), then the new key. eviction_candidates(), reclaimable_if_pinned, retirement fences unchanged.

#2 [high] Related work: #298/#416 are the origin of the completion-recency rule #665 partially reverses

#298 (merged 2026-11-15, voipmonitor) is where the completion-recency rule that #665 targets came from. Its second cause/fix row: "Recency came from admission time. A request that ran for minutes finished ranked below everything admitted meanwhile, so its conversation was evicted first, just before the client continued." Fix: successful completion refreshes the published terminal and its direct parent; third commit narrowed the refresh to terminal+parent (not the ancestor chain). #416 (merged 2026-11-23, jcartu) extended that: RequestScheduler::retire queues reused keys, take_reused() → treating completion as a host store "reuse" event too.

Connection to #665: #665 does NOT undo the completion touch — RequestScheduler::retire still calls cache.touch (scheduler.rs:3107-3118) and does so through plain touch, so the completion refresh still moves a checkpoint to MRU within the unprotected tier, but it no longer promotes the node into the protected tier (only touch_hit does, cache.rs:384-389). So #665 partially reverses the protection consequence of #298/#416 while keeping recency. #298 was motivated by 200k–580k-token Kimi K3.1 agent sessions on a 16-GPU host; #665's motivating workload is DeepSeek-V4.1-Flash on 4x RTX PRO 6000 TP4. Docs text in docs/core-design.md:1540-1558 still describes the #298 completion-refresh policy as the whole story and does not mention reuse protection (unchanged by #665 — see separate entry).

#3 [high] Related work: #567 closed in favour of #568; #665 modifies #568's ordering invariant

#567 "Preserve resident prefixes on ordinary completion of message requests" (avifenesh, opened 2026-11-28, CLOSED same day unmerged) attacked the identical problem — a final decode snapshot competing with cached inputs, i.e. which checkpoint should survive GPU pressure — by disabling eviction for requests with message_boundaries. lukealonso closed it "in favor of #568, which addresses the same prefix-eviction problem using an age-discounted marginal-value victim budget inside PrefixCheckpointCache rather than disabling all eviction". His stated criterion for a solution: keep RetentionRank demand-recency ordering, let Anchor/Message and mandatory reclamation reap older checkpoints freely by LRU, allow zero-cost role-preserving compaction, and bound protected victim destruction by leaf_tokens/(1+age) <= gain_tokens.

Relevance to #665: #665 is the third successive attempt at this same eviction tradeoff in ~4 days (#567 closed → #568 merged 2026-11-28 → #665 opened 2026-12-01) and it modifies #568's ordering: #568's description states "Victim ordering remains strictly (node.retention_rank(), node.id)" and docs/core-design.md:1565 still says Anchor/Message captures "reclaim lower-rank victims strictly by demand-recency order". #665 inserts is_protected as the FIRST sort key, so a protected (reused) lower-rank victim is now kept ahead of an unprotected higher-rank one. That is a deliberate, documented-in-DRM change to the invariant #568's review certified, and #665's description does not mention #568 or that it changes #568's ordering guarantee.

#4 [high] Related work: #568 added the budgeted victim filter #665 now re-orders

#568 "Bound optional Endpoint checkpoint eviction by age-discounted marginal gain" (lukealonso, COLLABORATOR, merged 2026-11-28, +1051/-44, 12 files) is the direct predecessor patch in helios/src/cache.rs (5deacda9 per search_history on helios/src/cache.rs). It added to helios/src/cache.rs (+56/-4):

#665's single-line change at cache.rs:732 (min_by_key: (node.retention_rank(), node.id) → self.eviction_key(node) = (is_protected, retention_rank, id)) is exactly the line #568 said must stay strictly retention-rank. All of #568's budget arithmetic (protected_eviction_tokens, remaining_budget in quote_snapshots) is untouched, so budgeted victims are still counted against leaf_tokens/(1+age) but the order in which they are offered now puts unreused nodes first.

Also relevant: #568 shipped 5 end-to-end workload policy tests in helios/src/scheduler/policy_tests.rs (reverse-order 1.5K document revisits keeping >=7/8 anchors; regime shift aging out 4/4 stale documents; a 256-token reasoning reply reclaiming an older 128-token anchor). #665's diff does not touch policy_tests.rs, and its description reports only unit tests, so whether those #568 policy workloads still pass under the new first key is not shown in the description. Its evidence line claims scheduler:: 408 (4 ign) passed, which per the module list would include policy_tests if those live under scheduler::.

Citations: #568 description (victim ordering sentence), helios/src/cache.rs:684-743, docs/core-design.md:1561-1583.

#5 [high] Change: design docs (core-design.md) still describe the old ordering; not updated

Docs that describe the eviction/recency policy and are NOT updated by #665 (the PR touches only 4 files, all under helios/src):

#6 [high] Change: description-vs-diff check, and what the description leaves out

Verified against the head (a7568c2) rather than the description:

#7 [high] Process: ready for review, zero CI, zero comments; mutation run not reported

#8 [high] Claims and evidence: what is claimed, what backs it, what is missing

Claims in the description and what backs each:

  1. "Rust release (rustc 1.94.1, 0 warnings): helios cache:: 137, scheduler:: 408 (4 ign), flare --lib 238 (4 ign), flare-cli 239 (3 ign) passed." — Author-reported only; no CI on the head commit. Notably the PR adds 4 tests to cache/tests.rs and does not report a before/after count, and it reports no server:: or runtime-core,server suite (native-serving.yml runs --features runtime-core,server), no flare-selene suite (which #416/#298 reported). The new finish_inbound call is in scheduler.rs but the restore path lives in server::runtime — phase tests there are not listed as run.
  2. "TLA+ check.py --jobs 4: 10/10 models, 8/8 trace suites, 12/12 checks" — Author-reported; no --mutations despite docs/design-review.md:226-228 (see process entry), and no Kani run reported.
  3. The A/B table (scan-thrash 24x8K vs 8x214K: hit 19.76%→37.31% mean, 1.89x; evicted 168/215→132/217; saved tok/s +96.4%. Long-MT 4x127K 4-turn vs 12x8K: 28.62%→49.71% mean, 1.74x; evicted 17/24→12/24; TTFT p50 23,886.7/22,228.7 → 2,876.8/3,459.5 ms, -86.3%; saved tok/s +75.8%; Bg 727→752). Method stated: single-boot A/B vs 5d53040e on 4x RTX PRO 6000, DeepSeek-V4.1-Flash TP4, --scheduler-policy balanced --mtp-draft-tokens 7 ... --kv-cache-limit memory --memory-limit 83GiB --prefix-cache-memory 0, 2,606,848 KV tokens / 20,366 pages, 0 errors/preemptions, 2 cold-salted trials/arm. So: 2 trials per arm, single boot, n=2 — the description itself does not report variance/CI, and "cold-salted" is not defined in the text. The TTFT -86.3% figure on Long-MT is an order-of-magnitude jump that the hit-rate change (1.74x) does not by itself explain; no per-request distribution or p99 is given.
  4. "Serving sanity: HTTP 200, 37*41=1517, 204/204 finite logprobs, 0 failed requests on both boots" — smoke test only.
  5. "Limits: No effect when KV capacity fits idle sessions without eviction or active scans exceed KV capacity. Measured on SM120 TP4 (128-tok pages, --prefix-cache-memory 0); Selene restore touch_hit is verified by unit tests and TLA+, not live offload." — Honest scoping; note --prefix-cache-memory 0 means the host/DRAM tier is off in both arms, so the host-restore touch_hit in finish_inbound (scheduler.rs:1886) has NO live evidence in this PR at all, only the unit-test claim (and I found no new unit test that drives finish_inbound's touch_hit specifically — the 4 new tests in cache/tests.rs are cache-level only).
  6. "68 net prod LOC: cache.rs +64/-4, scheduler.rs +9/-1" — matches pr_files; the remaining ~193 added lines are tests (cache/tests.rs +192, lifecycle_tests.rs +6/-1). "No CLI flags, floats, unsafe, model branches, or core-format changes" — consistent with the diff (all integer counters, no new config).
  7. Charter angle on evidence: charter line "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)" — satisfied in shape (served workload, A/B vs a named main commit). Charter "Keep the runtime small and model-agnostic" — no per-model branch and zero knobs, so it lines up. Charter "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene" (goal) — the change only affects GPU-tier eviction; host/Selene retention is untouched, and the PR says so.

#10 [high] Reach: #549 (open) conflicts textually in the same struct literal; scheduler.rs neighbours

Files touched and who else is in them right now:

#12 [high] Why: no issue asks for this; motivation is author-measured, and the policy area has churned 5x in 3 weeks

#13 [high] Project fit: aligns with evidence/zero-knob rules; misses design-review mutation and doc-update expectations

Facts, both aligning and not: Aligns:

#14 [high] Research summary

Case file for PR #665 (helios: scan-resistant dual-turnover prefix cache eviction) is gathered across all nine angles, with 13 scratchpad entries carrying file:line and PR citations.

What it is. A ~68-production-LOC change in helios/src/cache.rs (+64/−4) and helios/src/scheduler.rs (+9/−1) plus ~198 lines of tests. It adds a 1-bit reused flag and two turnover counters per checkpoint, a touch_hit that marks reuse, inheritance of protection from a parent (when the parent is ≥1/3 of the new endpoint), and — the operative one-line change — replaces min_by_key((retention_rank, id)) with (is_protected, retention_rank, id) at cache.rs:732.

Most important findings for a reader.

  1. This changes an invariant a merged PR certified three days earlier: #568 states "Victim ordering remains strictly (node.retention_rank(), node.id)", and docs/core-design.md:1565 still says Anchor/Message captures "reclaim lower-rank victims strictly by demand-recency order". #665 inserts protection as the first key and updates no docs.
  2. It is the third attempt in four days at the same eviction tradeoff: #567 (closed same day in favour of #568 by lukealonso) → #568 (merged) → #665, which modifies #568.
  3. It partially reverses the effect of #298/#416: completion still calls plain touch (recency within tier) but no longer confers protection — exactly the #298 "conversation evicted just before the client continued" fix, now scoped to that.
  4. Undeclared mechanics: page-turnover threshold is the whole cache's tail_pages and ready_checkpoints (dynamic horizon); compact_ancestor never increments the turnover counters, so ancestor compaction does not age protection; mark_reused uses an unchecked unwrap.
  5. Evidence gaps: 2 trials/arm single-boot, no CI on head, no --mutations or Kani run despite docs/design-review.md:226-251 making them mandatory for a new safety guard, no server::/runtime-core,server suite reported, and the host-restore touch_hit has no live evidence at all (both arms ran --prefix-cache-memory 0).
  6. No issue or user report motivates scan resistance — searches return only #665 itself; motivation is author-measured.
  7. #549 (open) edits the same Checkpoint struct literal and the same eviction_key sort in lifecycle_tests.rs — a certain textual conflict.

Zero reviews, comments or reactions, and no autobot intake, so the PR has drawn no community engagement yet.

#17 [high] Report skeleton: which entry answers which angle, and what I could not verify

Where each angle lives in the scratchpad, so the report can be assembled without re-reading the PR:

Gaps a report writer should state plainly rather than paper over:

#9 [medium] People: author FujitsuPolycom's history and who owns cache.rs

Author is FujitsuPolycom (GitHub association CONTRIBUTOR; Discord "Dooner"). Last 180 days: 15 merged, 11 closed, 3 open. Recent work is concentrated in helios scheduling/checkpoint policy and export paths:

#11 [medium] Reach: affects both mandatory and optional-capture eviction; no operator surface, no metrics

Who/what this affects, verified from the code paths:

#15 [medium] Recent activity: cache.rs history (#568/#460/#298) and quiet file vs busy scheduler.rs

Recent activity in the area, and how #665 sits in it:

#16 [medium] Community: no comments, reviews, reactions or autobot intake; discussion is on Discord