Explore scratchpad · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/2fca9809-ac1e-48ed-846f-7f94ba0d126b.md

#1 [high] Change: what PR #582 actually does (files and sizes)

PR #582 "helios: avoid splitting prefill on zero-budget checkpoint anchors", perf/helios-zero-budget-anchor-split -> main, head a3c648351c9c364099c57479eba858a7fd33998a, base 167f22c8. +931/-16, 7 files.

What the code does (verified from the diff):

  1. helios/src/scheduler/checkpoints.rs
    • New field CheckpointAccounting::anchor_fallback_from: Option<usize> (line ~28) recording "the raw interior anchor we decided to abandon in favour of the prompt end".
    • clear_reservations() now also sets anchor_fallback_from = None (i.e. it is NOT preserved across clear_reservations; reviewer Major #4 says it should be).
    • New RequestScheduler::anchor_split_is_zero_cost(request, catalog, terminal_window, start, end, anchor, known_whole) -> bool: prices before(start..anchor) + after(anchor..end) - whole(start..end) == 0 via interval_prefill_ns; returns false when any price is unknown.
    • New pub(super) fn is_request_anchor_endpoint(&self, request, endpoint: u64) -> bool: true if endpoint == raw anchor; else false when snapshots==0, fraction != 0.0, raw_anchor >= prompt_tokens, or endpoint != prompt_tokens; then true if anchor_fallback_from == Some(raw_anchor); else returns !anchor_split_is_zero_cost(..., start=0, end=prompt_tokens, anchor=raw_anchor, known_whole=None) — i.e. the prompt end counts as the anchor when the interior split is costly. Hardcodes start 0 and omits limits.snapshots check ordering matters (reviewer Major #3).
    • checkpoint_selection_uncached: renames anchor -> raw_anchor; after computing baseline_interval it now returns early (accounting,false,false) when self.limits.snapshots == 0 — no cuts at all at zero snapshot capacity.
    • Zero-fraction branch: if raw_anchor < prompt_tokens && fraction == 0.0, choose anchor = raw_anchor only if anchor_split_is_zero_cost; else latch anchor_fallback_from = Some(raw_anchor) and use prompt_tokens. When already past the anchor (raw_anchor <= start), it keeps prompt_tokens if anchor_fallback_from == Some(raw_anchor), or re-prices from baseline_start (using initial_prefill_ns as known_whole when baseline_end == prompt_tokens) and falls back again if costly. This is the "multi-chunk" fix. Nonzero fraction path unchanged (anchor_fallback_from = None; raw_anchor).
    • The anchor Cut is pushed only if anchor > start (existing behaviour).
    • In the step-pricing loop, the anchor variable now comes from the chosen Anchor cut endpoint, else from anchor_fallback_from-aware raw anchor (so previous behaviour preserved when no Anchor cut).
    • promote_request_anchor: previously only looked up history.key_at(request.checkpoint_anchor()); now falls back to looking up the prompt end key when is_request_anchor_endpoint(request, prompt_tokens) is true, so an Endpoint checkpoint at the prompt end can be promoted to Anchor under zero budget.
  2. helios/src/scheduler.rs (~line 1791): inbound restore role classification changed from request.checkpoint_anchor() as u64 == inbound.consumed_tokens to self.is_request_anchor_endpoint(request, inbound.consumed_tokens), so a restore at the prompt end can be tagged RetentionRole::Anchor.
  3. helios/src/scheduler/checkpoint_lifecycle_tests.rs: +136, new test zero_budget_multi_chunk_fallback_reservations_match_lifecycle_model walking the TLA+-style Observation edges for cancellation in 0..5.
  4. helios/src/scheduler/checkpoints.rs tests: +~530 of tests (complete_test_step helper; zero_snapshot_capacity_produces_no_cuts_and_never_splits_prefill; zero_fraction_falls_back_to_prompt_end_when_interior_anchor_splits_prefill; balanced_c16_short_prompts_skip_interior_anchor_tails_and_reach_full_batch; zero_fraction_multi_chunk_fallback_captures_prompt_end_restores_and_promotes_on_reuse; zero_fraction_aligned_interior_anchor_and_mixed_prefill_preserve_exact_contracts).
  5. verification/helios-lifecycle/check.py +19: new Rust source mutation "dropped multi-chunk zero-budget fallback" replacing the new else if with else if false, asserted to break a test. Reviewer Minor #6 says this is a brittle 13-line string literal match (check.py:325-343).
  6. docs: cli-design.md (~700), core-design.md (~1435), scheduling-runtime-design.md (~551) rewritten to describe zero-capacity-disables-cuts and the zero-fraction interior-anchor rule. These doc edits are NOT mentioned in the PR description (orientation packet flags docs undescribed).

#2 [high] Community: one review, CHANGES_REQUESTED, 2 blockers + 3 majors + minors

PR #582 discussion: exactly one comment, a review by voipmonitor on 2026-11-28 22:13, state CHANGES_REQUESTED ("Review & Live 4× SM120 Test Report (commit a3c64835)"). PR state is "open, ready for review" per packet but a change request stands. No CI checks on head commit (packet: "CI on the head commit: no checks").

Their verification: cargo test ... --lib scheduler:: 390 passed 0 failed; python3 verification/helios-lifecycle/check.py (8 TLA+ models + mutation checks) PASSED. Live 4x SM120, DeepSeek-V4.1-Flash TP4, --scheduler-checkpoint-extra-work-fraction 0, same origin/main base: short 2-turn chat 242 tok had prefill_steps 2 -> 1 (anchor_captures=1); multi-chunk 2-turn 12,212-12,232 tok, 5 runs, prefill_steps 3 -> 2 in all runs, but flare_checkpoint_skips_total{reason="work_budget"} still incremented 1..3 per request at fraction 0.0; 64K cold NIAH 71,429 tok at 59,453 tok/s, needle_ok true.

Findings:

  1. [Blocker] duplicate RetentionRole::Anchor capture on upward GPU EWMA timing drift (checkpoints.rs:364-388, 466-505): checkpoint_selection_uncached latches accounting.initial_prefill_ns and passes it as known_whole into anchor_split_is_zero_cost, comparing live before+after against the stale latched whole. Reproducer prompt 1024, boundaries [512], catalog [512] = 512_000ns, fraction 0; chunk1 zero-cost keeps 512, GPU jitter to 515_000ns -> EWMA 512_300; chunk2 raw_anchor > start false -> else-if re-prices 512_300+512_300-1_024_000 = 600 != 0 -> flips to 1024 and captures a second Anchor. Also notes the PR's own unit test misses it because complete_test_step passes dur_ns=1_000 vs 512_000 driving EWMA down so saturating_sub clamps to 0 — which symmetrically makes downward drift classify costly splits as zero-cost.
  2. [Blocker] duplicate Anchor capture when Mixed prefill shifts chunk alignment (checkpoints.rs:466-505). Reproducer catalog [128,512] = 150k/400k, mixed [(2,1,256)], prompt 1024, raw_anchor 768, fraction 0: at start 0 the 0..768..1024 split is costly -> fallback 1024; chunk1 runs Mixed(256); at start 256 the 256..768..1024 split is zero-cost so selects and publishes 768 as Anchor (anchor_fallback_from = None); at start 768 the else-if re-prices from baseline_start 0, sees costly, publishes a second Anchor at 1024. Suggested fix for both: price whole/before/after from the same catalog snapshot (no stale known_whole) and latch an explicit (raw_anchor, chosen_anchor) decision on CheckpointAccounting that survives clear_reservations(), instead of reconstructing the fallback backwards from baseline_start.
  3. [Major] is_request_anchor_endpoint hardcodes start=0 and tests raw_anchor before limits.snapshots == 0 (checkpoints.rs:390-420, scheduler.rs:1794). Partial prefix hit baseline_start=88, raw_anchor=600, prompt 1024, catalog [128,512]: selection prices from 88 and picks 600 zero-cost, while is_request_anchor_endpoint prices from 0 and also returns true for 1024, so promote_request_anchor / inbound restore can promote both. Fix: check limits.snapshots==0 first, price from baseline_start when baseline_start < raw_anchor.
  4. [Major] clear_reservations() wipes anchor_fallback_from (checkpoints.rs:48-52, scheduler.rs:1726); admit_planned_with_checkpoint_accounting preserves CheckpointAccounting across preemption/readmission and calls clear_reservations(), so the latched zero-budget decision is lost — should be preserved like baseline_interval and initial_prefill_ns.
  5. [Major] O(N) wasted prefill pricing and spurious checkpoint_skip_work_budget stats at fraction 0.0 (checkpoints.rs:538-650): when anchor falls back to prompt_tokens, raw_anchor and all earlier message boundaries enter candidates and run 2*N interval_prefill_ns walks every step although available == 0 can never fund optional cuts; return early after pushing the Anchor cut. This is backed by their live observation that flare_checkpoint_skips_total{reason="work_budget"} still increments at fraction 0.0.
  6. [Minor] move if self.limits.snapshots == 0 before prefill_catalog_costs and short-circuit allocate_terminal_capture; update stale follow-on sentences in docs/core-design.md:1448-1449 and docs/scheduling-runtime-design.md:567-569; add regression tests for upward EWMA drift, Mixed-prefill alignment shift, partial prefix hit < raw_anchor, preemption/readmission; replace the brittle 13-line string literal mutation in verification/helios-lifecycle/check.py:325-343.

Related items list on the PR: mentions #1, #2 (closed issues) and #5.

#3 [high] Change: code-level placement, defaults and existing coverage

Verified facts from the code at the PR head (helios/src/scheduler/checkpoints.rs unless noted):

#4 [high] Related work: #459/#550/#568/#426/#354 lineage of checkpoint_selection_uncached

Related work / history around the touched code (all on helios/src/scheduler/checkpoints.rs):

#5 [high] Change: side effects the description does not state (role tagging, promotion, unpriced O(prompt) walk)

PR #582 adds a new runtime behaviour that its own description does not flag as user-facing beyond "no cuts at zero capacity":

  1. Restore role labelling change (helios/src/scheduler.rs, diff at ~L1791): incoming restore inbound.consumed_tokens is now classified RetentionRole::Anchor via the new is_request_anchor_endpoint, not only when it equals request.checkpoint_anchor(). Effect: an inbound restore that lands at the prompt end can be tagged Anchor instead of Message/Endpoint, which raises its retention rank (RetentionRank sorts role) and therefore changes which checkpoints get evicted — interacting directly with #568's age-discounted protected-victim budget (merged the same day). The description only says "prefix Restore" is handled and "optional endpoint eviction … unchanged"; the role-tagging path is where eviction ranking actually changes.
  2. promote_request_anchor (checkpoints.rs:753-776) now falls back to promoting the prompt-end checkpoint to Anchor when is_request_anchor_endpoint(request, prompt_tokens); called for every lane on every commit (scheduler.rs:2411). This can upgrade an existing Endpoint checkpoint to Anchor, and re-offers the publication (reoffer_publication) — a second path with eviction-ranking and Selene-publication consequences.
  3. is_request_anchor_endpoint is O(prompt) work per call: it calls prefill_catalog_costs + up to three interval_prefill_ns walks over the whole prompt (0..prompt_tokens, 0..raw_anchor, raw_anchor..prompt_tokens). It is called once per lane per commit from promote_request_anchor (scheduler.rs:2411) and per inbound restore. Unlike checkpoint_selection, it is NOT inside checkpoint_planning_scope (only policy.rs:1208 and 1453 open a scope), so the result is not memoised across lanes/commits on the same tick. This is the same class of per-commit CPU cost that #459 was written to remove (runtime thread at 96-100% CPU, GPUs idle). Reviewer Major #5 flags the analogous cost inside checkpoint_selection at fraction 0 but not this one. Also note: at zero fraction with a costly interior anchor, checkpoint_selection_uncached now returns a single Anchor cut at the prompt end every step; with anchor > start false after prefill finishes the Anchor cut stops being pushed, so plan_checkpoints's anchor recomputation (checkpoints.rs:671-685) is what keeps the prompt-end fallback alive for the snapshot capture. Docs: PR rewrites the two paragraphs at docs/core-design.md:1436-1445 and docs/scheduling-runtime-design.md:553-574. Reviewer Minor #6 says the FOLLOW-ON sentences at core-design.md:1447-1453 ("Unknown prefill costs … exclude extras without excluding the anchor"; and the DEFAULT 0.05 sentence) and scheduling-runtime-design.md:566-572 still describe the old anchor-always-best-effort rule and were left stale. Verified against main: those sentences are unchanged by the PR (main core-design.md:1444-1453, main scheduling-runtime-design.md:560-571).

#6 [high] Project fit: charter evidence bar vs CPU-only evidence; fraction 0 is a known operator workaround

Project-fit and charter facts relevant to PR #582 (charter text from read_charter):

#7 [high] People: author's #538 caused the #550 pricing regression in the same function #582 builds on

Author history (FujitsuPolycom, GitHub association CONTRIBUTOR, Discord handle "Dooner" on #538/#540/#582):

#8 [high] Reach and process: only fraction-0 / zero-capacity deployments, metrics, docs, no CI, needs rebase

Reach / process facts:

#9 [high] Why: no linked issue; motivation is the fraction-0 workaround from #335 plus #69's measured split cost

The why, as far as the record shows:

#11 [high] Claims vs evidence: verified, claimed-only, and contradicted (eviction is not unchanged)

CLAIMED by #582 (author), with what backs each:

  1. "Helios emits no checkpoint cuts when snapshot capacity is zero." Verified by reading the code: early return at checkpoints.rs:460-462 before the Anchor cut is pushed; also asserted by the new test zero_snapshot_capacity_produces_no_cuts_and_never_splits_prefill. Pre-existing test boundary_tests.rs:193 (snapshot_capacity_does_not_disable_prompt_fallback_anchor) already asserted the capture count is 0 at 0 snapshots, so this claim is narrower than it reads: what is new is that no cut/split is planned at all.
  2. "At zero extra-work fraction, Helios keeps an interior anchor only when prepared-graph pricing predicts zero additional prefill work; otherwise it preserves a prompt-end replacement Anchor." Verified: the branch at checkpoints.rs:467-511 with anchor_split_is_zero_cost. Covered by 3 new unit tests and 1 new lifecycle test. NOT covered for: upward EWMA drift (reviewer Blocker #1), Mixed-prefill alignment shift (Blocker #2), partial prefix hit below the raw anchor (Major #3), preemption/readmission (Major #4). All four are code paths the PR's own tests do not exercise; the reviewer supplied reproducers for each.
  3. "Zero-budget serving avoids extra padded prefill launches" — no served measurement from the author (explicit limitation: "Live signed-core serving and isolated GPU latency measurements remain unverified for this candidate"). The only served evidence is the reviewer's: 242-token 2-turn chat prefill_steps 2->1; 12.2K-token multi-chunk 3->2 across 5 runs; 64K NIAH 71,429 tok at 59,453 tok/s. Nobody has published a TTFT or throughput delta in milliseconds/percent for this PR; the launch-count reduction is the whole of the served evidence.
  4. "preserving prefix reuse across single- and multi-chunk prompts" — verified at the unit level (the new tests assert the 1024-token prompt-end checkpoint is published as Anchor and then hit as prefix on a repeat, with Restore + Speculative and a promote from Endpoint to Anchor). No served cache-hit measurement.
  5. "Zero-cost aligned interior anchors remain eligible without adding a duplicate prompt-end anchor" — tested for a linear-cost aligned case (Part A of zero_fraction_aligned_interior_anchor_and_mixed_prefill_preserve_exact_contracts, 512 in 1024). The reviewer's two blockers are exactly duplicate-Anchor scenarios under non-linear costs, i.e. the claim holds only for the priced-from-one-snapshot, no-drift case; with a stale known_whole or a Mixed-realigned chunk it fails.
  6. "Optional endpoint eviction and nonzero-budget anchor selection remain unchanged" — the nonzero-fraction branch at checkpoints.rs:508-511 does reduce to the old raw_anchor, and anchor_fallback_from = None. BUT eviction is not strictly unchanged: the inbound-restore role classification (scheduler.rs diff) and promote_request_anchor's prompt-end fallback both can raise a checkpoint's role to Anchor, which changes RetentionRank ordering. The PR body does not mention either path.
  7. Test evidence claims: the author's filters are narrow (27 tests via scheduler::checkpoints::tests, 4 via scheduler::checkpoint_lifecycle_tests::). The reviewer's broader scheduler:: run is 390 passed, 0 failed, which is consistent. Both agree the two disclosed base failures are pre-existing (model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape, server::runtime::phase_tests::worker_observes_prefill_decode_and_prerequisite_timings); the packed-batch failure is also disclosed as pre-existing in #540 and #567, so it is a known base failure, not a hidden one.
  8. Formal/mutation evidence: check.py --mutations detected the new "dropped multi-chunk zero-budget fallback" mutation. Verified by reading check.py:91-109: the mutation is a 13-line exact-string replacement against the } else if ... { text with } else if false {, and the harness requires the string to appear exactly once (original.count(needle) != 1 raises). So it is strictly coupled to the current formatting of that block and will break on any reformat — reviewer Minor #6's point, confirmed. The PR adds no TLA+ model state for anchor_fallback_from.
  9. Not claimed but true and unmeasured: the new per-commit is_request_anchor_endpoint pricing walk (see entry 5). No test asserts its cost and no measurement covers it; #459 exists specifically because this kind of per-commit pricing cost collapsed a production server.

#12 [high] Recent activity: main moved 5-7 commits in the same file the same day; PR rewrites a stated design invariant

Recent activity in the touched areas (last ~7 days, from the orientation packet and search_history at the PR head) and how #582 sits against it:

#14 [high] Research summary

I gathered the case file for PR #582 ("helios: avoid splitting prefill on zero-budget checkpoint anchors") across all eight angles, with 13 scratchpad entries carrying file:line, PR/issue numbers and links.

What I established beyond the description: the diff is ~72% tests, and its production effect reaches further than the PR body says — the inbound-restore role classification (scheduler.rs) and promote_request_anchor's new prompt-end fallback both raise a checkpoint's RetentionRole to Anchor, which changes retention/eviction ordering, so the "optional endpoint eviction … unchanged" claim does not hold; there is also a new, unmemoised O(prompt) pricing walk per lane per commit via is_request_anchor_endpoint, the same class of per-commit CPU cost #459 was written to remove. Three doc files are edited (undescribed), and they are where the PR rewrites a stated design invariant ("anchor retention is best effort and independent of duration estimates"); the follow-on sentences the reviewer calls stale are confirmed unchanged from main.

Why/related work: no linked issue exists for this problem; the motivating configuration is the --scheduler-checkpoint-extra-work-fraction 0 workaround yatesdr documented in #335, and the cost of an extra split launch is measured in closed #69. The function changed has three PRs land on it in one day (#568, #550, #582) and the author's own #538 created the #550 pricing regression that #582's pricing now depends on.

Community/process: a single CHANGES_REQUESTED review from priority contributor voipmonitor with two duplicate-Anchor blockers (upward EWMA drift, Mixed-prefill realignment) plus three majors (partial-prefix-hit mispricing, clear_reservations wiping the latched decision, wasted per-step pricing causing spurious work_budget skips); no maintainer engagement; no CI on the head; branch 5–7 commits behind a very hot file. The only served evidence in the thread is the reviewer's (prefill_steps 2→1 and 3→2 on 4× SM120); the author's evidence is CPU + TLA+ only, and the author explicitly does not claim live GPU results.

#15 [high] Related work: open issue #534 names the exact anchor<=start branch this PR rewrites

Open issue #534 ("Checkpoint captures deadlock on an unmeasured snapshot cost: host prefix cache never receives anything", semireg, open since 2026-11-26) touches the exact branch PR #582 rewrites. In mark-yong's 2026-11-28 reply, pure main has two transient, self-healing unknown_cost cases, the first of which is "a resumed prompt hitting anchor <= start at checkpoints.rs:416". That is precisely the else if arm #582 adds at checkpoints.rs:489-507 (raw_anchor <= start after prefill has advanced past the interior boundary) — the arm the reviewer's Blocker #1 and Blocker #2 both attack, and the one guarded by the new 13-line string mutation in check.py. Connections to record:

#10 [medium] Community: one review, no maintainer engagement, no CI; same-day append collisions in checkpoints.rs

Community/reaction and process detail to keep:

#13 [medium] Details: test-heavy diff, duplicate helper, fork link, WSL2-only, unlabelled, stale doc sentences confirmed

Small details worth keeping for the report: