Explore scratchpad · NVIDIA/hyperflare-inference #665

Raw Markdown for agents: https://autobot.eidonix.com/p/abd1440d-229f-45f0-bbf8-e254925dd5fc.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:

#19 [high] Amend: head c9197427 — size, files, and what changed since a7568c2

PR #665 head moved a7568c2 -> c9197427 (squashed, 2026-12-01 22:42, tree 597c23c5 atop base 5d53040e).

Size now (pr_files): 9 files, +698/−47.

So my previous "4 files +271/−6, ~68 prod LOC, no docs" is superseded. Still zero flags/floats/unsafe/model branches/core-format change. Still no linked issue. Still zero human reviews/comments (only flare-autobot intake + review + one author reply).

#20 [high] Amend: prior blockers verified fixed on c9197427 (sticky demotion, compaction turnover, fresh_admission, tests)

Verified on c9197427:

  1. Non-monotonic aging (prior blocker) fixed: is_protected is now just node.reused (cache.rs:353-355) and demote_expired_reused permanently clears node.reused (cache.rs:360-376), called from retire_leaf (cache.rs:615-626) and compact_ancestor (cache.rs:643-675). Horizons captured from live ready_tail_pages.max(1) / ready_checkpoints.max(1) (:616-617, :644-645); snapshot escape node_horizon * 2 (:363, :370-372). Counters only advance for ready nodes (:620-625, :672-675).
  2. ready_tail_pages is maintained everywhere: count/uncount (cache.rs:260-279), advance_completed (:887-893), compaction heir transfer (:669-671), and a #[cfg(test)] full-scan assert in stats() (:913-932). I found no drift path.
  3. Compaction aging (prior should-fix) fixed via the 2x node-turnover branch; test compaction_pressure_ages_out_stale_protected_entry_without_page_evictions (cache/tests.rs:1569) asserts evicted_pages == 0 and 6 compactions demote. Policy-level test at policy_tests.rs:6430.
  4. Ticket.fresh_admission added (scheduler.rs:629), set at creation (:1678, :1698) and OR'ed on waiter join (:1709); finish_inbound gates touch_hit on ticket.fresh_admission && !ticket.waiters.is_empty() (scheduler.rs:1884-1891). Cancelled inbound waiters are removed in retire (scheduler.rs:3076-3080). Tests: scheduler/tests.rs:3233 (fresh protects restored checkpoint over cold scan), :3258 (cancelled and preempted re-admission stay probationary).
  5. Both prior "subtract" items done: dead existing.accessed write gone (existing branch now cache.rs:481-490) and the redundant reclaimable_if_pinned_matches_evict_with_mixed_* test deleted (only 5 new cache tests remain). Blank-line nit gone (#[test] at cache/tests.rs:1314).
  6. Fixture::key() collision (prior should-fix) fixed: sorts by eviction_key and appends reused + elapsed page/node turnover per node (lifecycle_tests.rs:499-526); projection() left untouched at :316-353 so CacheOwnership.tla's tuple still matches; fork copies the new fields (:76-98).
  7. Description now cites #568, #298, #416 in Why; reports check.py --mutations (26/26 Rust, 13/13 TLA+), scheduler:: 411 incl 6/6 policy_* and 3/3 finish_inbound_*, and discloses the A/B ran on a7568c2c pre-hardening.

Remaining bugs I trust: none found in the new state machine beyond the two doc/behaviour mismatches noted separately.

#21 [high] Amend: what still stands on c9197427 (mutation coverage, Existing-path gate, offload doc contradiction)

Findings that survive on c9197427 (new, or restated after checking the new code):

A. Mutation run is now reported but no mutant covers the new guard. verification/helios-lifecycle/check.py has only two helios/src/cache.rs targets: :511 (compaction last-use fence) and :515-519 (protected_eviction_tokens → 0). Grep for is_protected|demote_expired_reused|eviction_key|touch_hit|ready_tail_pages in check.py returns nothing, and the new tests (cache/tests.rs:1315-1632, scheduler/tests.rs:3233/3258, policy_tests.rs:6430) are not in the aux_tests list (check.py:323-336). So the 39/39 KILLED count evidences the old guards, not the new protection/aging state machine — docs/design-review.md:226-228 asks for mutation coverage "when adding or changing safety guards". Partial close of my earlier blocker #2: the run happened, its coverage did not extend to the change. B. The finish_inbound fresh-admission gate is bypassed on the PublishResult::Existing path. publish_with_retention calls touch_hit unconditionally for a duplicate publication (cache.rs:481-490, hit at :485), so a host restore whose key already resides promotes that checkpoint to protected even when every waiter was a preempted re-admission or was cancelled — the case finish_inbound now guards (scheduler.rs:1884-1891) and the case the docs promise never promotes (docs/prefix-cache-offload.md:302-303 "preempted re-admissions and waiterless restores refresh demand recency only"; docs/core-design.md:1544-1546). The new test only covers the Created path (scheduler/tests.rs:3258 asserts on take_publications()[0], a new checkpoint), so the asymmetry is untested. Arguable (the prefix genuinely resides and is being reused), but the documented invariant is false as written. C. Remaining doc contradiction inside docs/prefix-cache-offload.md: the same file now says two-tier ordering at :298-303 and still says the old flat order at :374-376 ("GPU eviction ranks eligible checkpoints by logical-request demand epoch, retention role, consumed-token count, and identity"). That is a direct self-contradiction introduced by the doc sync, and it is the sentence an operator reading the offload doc's eviction section meets last. D. Reply oversells the doc sync slightly: the PR body's Why now names #568/#298/#416 (correct), but the three docs gained no PR references (grep '#[0-9]{2,4}' docs/core-design.md docs/scheduling-runtime-design.md → no matches), which matches repo style; only the reply's phrasing "synced ... (citing #568, #298, #416)" is loose. Do not treat as a defect. E. Minor: demote_expired_reused walks every node including !ready ones (cache.rs:364-375), so a checkpoint that inherited protection while unready can be demoted at the first retirement after a long prefill, with no reuse opportunity in between. No test covers unready inheritance + aging; low severity, note only. F. Doc wording nit: core-design.md:1536-1537 and :1590-1591 are the only em dashes in either edited doc; the repo-prose skill (.agents/skills/repo-prose/SKILL.md:84-85) asks for ordinary prose but does not ban dashes. Not a finding.

#22 [high] Amend: engagement, evidence and file map on c9197427

Changes to the process/community/evidence sections since the previous report:

#23 [high] Research summary

The event was a full rewrite of PR #665 (head a7568c2 → squashed c9197427, 9 files, +698/−47, 2026-12-01 22:42) that closes both autobot blockers, all four should-fixes, both subtract items and both nits, and syncs the three design docs. My previous report's "4 files, +271/−6, ~68 prod LOC, no docs, no mutation run, no finish_inbound test" is superseded: prod code is cache.rs +123/−22 and scheduler.rs +18/−6 with five new cache tests, a new policy-regime test, two new finish_inbound tests, Ticket.fresh_admission, and a sticky demote_expired_reused called from both retire_leaf and compact_ancestor.

Amendments written to the scratchpad (entries 19–22): corrected size/file map; verification that sticky demotion, ready_tail_pages maintenance, compaction turnover, the fresh_admission/waiter gate, the Fixture::key() dedup fix and the doc sync are actually implemented; updated engagement and evidence (mutation run now reported, 39/39 KILLED, but no mutant touches the new protection/aging code); and the residual findings — the Existing-publication path still promotes a checkpoint unconditionally through publish_with_retention's touch_hit, contradicting the new doc sentence that waiterless and preempted restores "refresh demand recency only"; docs/prefix-cache-offload.md now contradicts itself (:298-303 two-tier vs :374-376 flat order); and two low-severity notes on unready inheritance and stale citations in the autobot review. Everything else in the old report (history with #568/#298/#416/#567, #549 textual conflict, zero human review, A/B on a7568c2c with --prefix-cache-memory 0) stands.

#24 [high] Amend: framing — which sections of report #18 change, and stale-citation map

Framing for the amendment (report #18 = my previous report; entries 19-22 = the amendments; this note says which sections of #18 are overturned).

OVERTURNED in #18 (must be replaced by 19-22, not merely appended):

STANDS UNCHANGED: everything under "The why" (no linked issue, author-measured motivation, five eviction-policy PRs in three weeks), "Related work" (#568/#298/#416/#567/#460/#549, scheduler.rs neighbours), "People", "Reach" (both pressure paths, zero knobs/metrics, GPU-tier only), "Project fit" (minus the doc-update gap), and the A/B evidence critique (n = 2, one boot, --prefix-cache-memory 0, −86.3% Long-MT unexplained — now partly explained by the added queueing note).

STALE CITATIONS from #18 / from the autobot review, all of which pointed at a7568c2, mapped to c9197427: Checkpoint new fields :84-86 → :84-86 (unchanged); cache counters :221-222 → :219-223 (adds ready_tail_pages); is_protected :346-361 → :353-355; eviction_key :363-365 → :378-380; mark_reused :367-374 → :382-389; touch_hit :384-389 → :399-404; duplicate-publication touch_hit :471 → :485; inheritance :478-481 → :492-495; retire_leaf turnover :604-609 → :615-626; compact_ancestor :626-657 → :643-687; min_by_key :732 → :762; scheduler fresh_admission :1727-1740 → :1678, :1698, :1709, :1734-1740; finish_inbound :1884-1887 → :1884-1891; completion touch :3107-3118 → :3109-3122. Docs: core-design.md:1538-1583 → :1536-1600; scheduling-runtime-design.md → :643-654; prefix-cache-offload.md → :298-303 plus the untouched :374-376.

Also state in the amendment that the autobot review text quoted in the PR thread (21:10) was written against a7568c2, so its citations are stale at head and one of its two blockers (non-monotonic aging) no longer reproduces.

#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