Final review report · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/2cffed73-6ec8-499e-a703-e98a55e548a9.md

Recommendation: Changes Requested

The problem is real and in the right layer (helios/src/scheduler/checkpoints.rs), and live 4× SM120 testing by @voipmonitor confirmed the expected prefill-launch reduction at --scheduler-checkpoint-extra-work-fraction 0, but this head (a3c64835) has two verified correctness blockers that emit duplicate RetentionRole::Anchor captures on ordinary multi-chunk workloads, plus divergent anchor pricing on partial prefix hits, lost latch state across readmission, spurious work_budget skip accounting at fraction == 0.0, and stale documentation.


Blockers

1. Stale known_whole vs. live catalog causes duplicate Anchor captures on normal upward GPU timing drift

Location: helios/src/scheduler/checkpoints.rs:364-388, 451-459, 471-501; helios/src/scheduler/cost.rs:74-96, 302-325

checkpoint_selection_uncached latches accounting.initial_prefill_ns once (:451-459) and passes it as known_whole into anchor_split_is_zero_cost, which compares freshly priced before + after from the live catalog against that stale known_whole (:373-387):

let Some(whole) = known_whole
    .or_else(|| Self::interval_prefill_ns(request, catalog, terminal_window, start, end))
else { return false; };
let Some(before) = Self::interval_prefill_ns(request, catalog, terminal_window, start, anchor) else { return false; };
let Some(after)  = Self::interval_prefill_ns(request, catalog, terminal_window, anchor, end) else { return false; };
before.saturating_add(after).saturating_sub(whole) == 0

ActionCosts::observe updates per-graph durations via a 9-sample rolling median (ReplayTimes in helios/src/scheduler/cost.rs:74-96, 321). Trace prompt_tokens = 1024, raw_anchor = 512, prefill_catalog = [512] (initial sample 512_000 ns), fraction = 0.0:

  1. Chunk 1 (start = 0): initial_prefill_ns latches 1_024_000. Branch A (:470-488) computes 512_000 + 512_000 - 1_024_000 == 0, selects 512 (anchor_fallback_from = None), runs 0..512, and publishes 512 as RetentionRole::Anchor.
  2. Normal upward GPU jitter on Chunk 1 (e.g. 515_000 ns, or a post-TTL window reset in cost.rs:82-84) shifts the rolling median upward (e.g. 513_500 ns).
  3. Chunk 2 (start = 512): raw_anchor > start is now false, so execution enters Branch B (:489-505). It calls anchor_split_is_zero_cost(..., baseline_start = 0, end = 1024, raw_anchor = 512, known_whole = Some(1_024_000)), getting 513_500 + 513_500 - 1_024_000 = 3_000 != 0 (!false == true), flips to anchor = 1024, and captures a second RetentionRole::Anchor at 1024.

Symmetrically, downward median drift makes before + after < known_whole, so saturating_sub clamps to 0 and misclassifies genuinely costly splits as zero-cost. The PR's aligned test (checkpoints.rs:2729-2748) missed this because linear_costs initializes Prefill(512) to 512_000 ns while line 2746 passes dur_ns = 1_000, dragging the median down to 256_500 ns and clamping saturating_sub to 0.

Fix: Remove known_whole from anchor_split_is_zero_cost and always price whole, before, and after from the same catalog snapshot — and latch the resulting anchor decision on CheckpointAccounting (see Blocker 2 and Subtract / Simplify). Add a regression test using realistic upward-jitter durations (> initial_cost) asserting checkpoint_anchor_captures == 1.

2. Shifting interval origins (start vs. baseline_start) cause duplicate Anchor captures on Mixed prefill with zero timing drift

Location: helios/src/scheduler/checkpoints.rs:467-511

Branch A (:470-488, while raw_anchor > start) prices the split over [consumed_tokens, prompt_tokens), whereas Branch B (:489-505, once consumed_tokens >= raw_anchor) re-prices over [baseline_start, prompt_tokens):

Note also that merely switching to an unlatched helper over baseline_start is insufficient: even from one snapshot and fixed baseline_start, a cross-capacity rolling-median shift between chunks (e.g., Prefill(1024) dropping slightly relative to 2 * Prefill(512) after another request runs) can still flip a zero-cost decision into a fallback on Chunk 2.

Fix: Price the zero-budget anchor decision once over (baseline_start, prompt_tokens) from one catalog snapshot and latch the explicit decision on CheckpointAccounting (keyed by (raw_anchor, prompt_tokens)). Add a Mixed-alignment regression test asserting checkpoint_anchor_captures == 1.


Should Fix

1. is_request_anchor_endpoint prices from 0 instead of baseline_start, checks raw_anchor before snapshots == 0, and runs uncached pricing on commit/admit

Location: helios/src/scheduler/checkpoints.rs:390-420, 753-776; helios/src/scheduler.rs:1792-1808, 2411

Fix: Check self.limits.snapshots == 0 first, read the latched anchor decision on CheckpointAccounting, and when computing it on first use price from baseline_start when baseline_start < raw_anchor (falling back to 0 only when baseline_start >= raw_anchor, e.g., full-prompt reuse/inbound restore). Add a regression test for a partial prefix hit < raw_anchor.

2. clear_reservations() wipes the latched anchor decision across preemption/readmission and inbound retries

Location: helios/src/scheduler/checkpoints.rs:48-52; helios/src/scheduler.rs:1722-1726; helios/src/server/runtime.rs:1424-1449, 2572-2608, 2800-2827

admit_planned_with_checkpoint_accounting preserves CheckpointAccounting (including baseline_interval and initial_prefill_ns) across preemption/requeue and inbound fetch retries, then unconditionally calls checkpoints.clear_reservations() (scheduler.rs:1726). Clearing anchor_fallback_from at checkpoints.rs:49 discards the prior anchor verdict on readmission — and also guarantees anchor_fallback_from == None immediately before scheduler.rs:1794 calls is_request_anchor_endpoint.

Fix: Preserve the latched anchor decision across clear_reservations(), keyed by (raw_anchor, prompt_tokens) so normal preemption/readmission keeps the decision while growable-output prompt extension (helios/src/server/runtime.rs:2070-2093, which appends generated tokens to incoming.prompt.tokens) cleanly recomputes it. Add a preemption/readmission regression test.

3. At fraction == 0.0, selection still runs O(N) candidate pricing and increments checkpoint_skip_work_budget

Location: helios/src/scheduler/checkpoints.rs:520-641, 783; helios/src/scheduler/cost.rs:100-102, 264-268

When checkpoint_extra_work_fraction == 0.0, available is 0 (:528), while self.costs.fresh_duration(GraphKind::Snapshot, 1) (:523) only returns Some(nanos) for nanos != 0 (cost.rs:101, 266). Every candidate therefore has charge = split_ns + copy_ns >= 1 > 0 (:596-605), so no optional candidate can ever be accepted. Yet when anchor falls back to prompt_tokens, raw_anchor and every earlier message boundary enter candidates (:529-536), running 2 * N interval_prefill_ns walks per step and setting budget = true, which increments checkpoint_skip_work_budget / flare_checkpoint_skips_total{reason="work_budget"} on every request (:783; observed live by @voipmonitor at 1–3 skips/request).

Fix: Return (accounting, false, false) immediately after pushing the Anchor cut (:519) when self.policy.checkpoint_extra_work_fraction == 0.0.

4. Documentation contradictions in helios/README.md and stale unknown-cost sentences in the edited design docs

Location: helios/README.md:372-379; docs/core-design.md:1452-1453; docs/scheduling-runtime-design.md:570-572

Fix: Update helios/README.md:372-379 and those two follow-on sentences, and note explicitly that unavailable prefill pricing also triggers prompt-end fallback when scheduler_checkpoint_extra_work_fraction is zero.


Subtract / Simplify

1. Replace anchor_fallback_from and its 4 separate reconstructions with one latched anchor decision

Location: helios/src/scheduler/checkpoints.rs:28, 49, 364-420, 467-511, 671-685, 753-776

The PR currently reconstructs "was the anchor replaced by prompt_tokens?" in four places (checkpoint_selection_uncached, is_request_anchor_endpoint, plan_checkpoints, and promote_request_anchor) using three different pricing origins (start, baseline_start, 0) plus known_whole. Replacing anchor_fallback_from: Option<usize> with one explicit latched decision on CheckpointAccounting (e.g., resolved_anchor: Option<(usize, usize, usize)> for (raw_anchor, prompt_tokens, chosen_anchor)) and one shared helper eliminates known_whole and the multi-branch fallback logic, shrinking the production diff while fixing Blockers 1–2 and Should Fix 1–2 together.


Nits

  1. Zero-snapshot short-circuits (helios/src/scheduler/checkpoints.rs:445-462, 917-963): Move if self.limits.snapshots == 0 before prefill_catalog_costs / interval_prefill_ns in checkpoint_selection_uncached, and short-circuit allocate_terminal_capture when self.limits.snapshots == 0 so zero-snapshot mode avoids catalog allocation and spurious checkpoint_skip_* increments.
  2. Brittle mutation literal (verification/helios-lifecycle/check.py:325-343): The 14-line exact Rust snippet will break on any formatting or refactor (all other mutations in check.py are 1–4 lines). Shrink it to a 1–2 line needle targeting the consolidated anchor helper after refactoring.
  3. PR description clarity (AGENTS.md:88-102, 122-128): Mark "Zero-budget serving avoids extra padded prefill launches..." as an expected effect (or attach before/after served measurements including prefix-reuse impact on the revised commit, since moving the anchor from the last message boundary to prompt end changes reuse on branch/retry turns), briefly mention the design-doc updates under "What changed", and explain promote_request_anchor's role (Endpoint → Anchor promotion) inline.

Verified passes


Dropped on verification