Verdict: should-fix issues only
Blocking: None.
Should fix:
- helios/src/scheduler/checkpoints.rs:470 vs :489-501: the zero-budget "keep the interior anchor or fall back to prompt end" decision is priced from two different interval starts (
start=consumed_tokensin branch A,baseline_startin branch B), so the verdict can flip after prefill passes the boundary and emit the duplicate prompt-endAnchorthe PR claims to avoid. - helios/src/scheduler/checkpoints.rs:390-420:
is_request_anchor_endpointre-runsprefill_catalog_costsplus up to three full-intervalinterval_prefill_nswalks on every decode commit of every lane (viapromote_request_anchor, scheduler.rs:2411) and on every inbound admit (scheduler.rs:1794), with no memoisation for the aligned-anchor case it exists to serve.
Nits: 1 (the 0 origin in is_request_anchor_endpoint disagrees with both selection branches).
Link: https://github.com/NVIDIA/hyperflare-inference/pull/582
Full report — Correctness lens, PR #582 (helios: avoid splitting prefill on zero-budget checkpoint anchors)
Key findings
Two should-fix issues, both in the new zero-budget anchor logic in helios/src/scheduler/checkpoints.rs, plus one nit of the same family:
- The interior-anchor/prompt-end decision is priced over different intervals depending on which code path runs, so a request that keeps a zero-cost interior anchor can later be re-priced over a longer interval, decide the anchor is expensive, and push a second
Anchorcut atrequest.prompt_tokens— the exact duplicate prompt-end capture the PR description says it avoids. is_request_anchor_endpointis called on the commit hot path for every lane (and on every inbound admit) and recomputes full prompt-interval prefill pricing each time, defeating the module'sSelectionCache/planning-scope design for precisely the case (zero fraction, zero-cost interior anchor) the PR wants to preserve.- Nit: the same helper prices from literal
0, a third origin, so it can disagree withcheckpoint_selectionabout which endpoint is "the anchor" and promote/stamp the wrong checkpoint.
Everything else I checked in the changed files came out clean and is listed under "Checked, no finding". Three open questions I could not settle from code alone are at the end.
Finding 1 — Should fix: zero-fraction anchor fallback is decided from two different interval starts, so the verdict can flip and emit a duplicate prompt-end Anchor
Where: helios/src/scheduler/checkpoints.rs:467-511 (anchor selection in checkpoint_selection_uncached), with the two pricing sites at :470-488 and :489-501; related helios/src/scheduler/checkpoints.rs:390-420 (is_request_anchor_endpoint).
The new block has three different interval origins for what is meant to be one decision:
let start = request.consumed_tokens as usize; // :440
let (baseline_start, baseline_end) = *accounting.baseline_interval.get_or_insert((
request.admission_reused_tokens as usize, request.prompt_tokens)); // :441-444
...
if raw_anchor > start {
// Branch A: interval origin = `start` (current consumed_tokens)
if Self::anchor_split_is_zero_cost(request, &catalog, terminal_window,
start, request.prompt_tokens, raw_anchor, known_whole) // :474-482
{ accounting.anchor_fallback_from = None; raw_anchor }
else { accounting.anchor_fallback_from = Some(raw_anchor); request.prompt_tokens }
} else if accounting.anchor_fallback_from == Some(raw_anchor)
|| (baseline_start < raw_anchor
&& !Self::anchor_split_is_zero_cost(request, &catalog, terminal_window,
baseline_start, request.prompt_tokens, raw_anchor, ...)) // :489-501
{ accounting.anchor_fallback_from = Some(raw_anchor); request.prompt_tokens }
else { raw_anchor }
- Branch A (taken while prefill is still before the interior boundary,
raw_anchor > start) prices the split over[consumed_tokens, prompt). - Branch B (taken once prefill has advanced past the boundary,
raw_anchor <= start) prices over[baseline_start, prompt). is_request_anchor_endpoint(:411-419) prices over[0, prompt).
start == baseline_start only on the first selection after a fresh admission: CheckpointAccounting::for_epoch (checkpoints.rs:35-41) sets baseline_interval = (consumed, prompt), and admit_planned_with_checkpoint_accounting builds the accounting with consumed equal to the reused prefix (scheduler.rs:1724). That equality is not maintained when a request is parked and re-admitted with carried accounting:
parksnapshots the accounting:runtime.rs:2078let checkpoint_accounting = live.checkpoint_accounting();(scheduler.rs:271-273returns a clone ofself.checkpoints), stored onParked(runtime.rs:2092-2093).- Re-admission passes it back:
runtime.rs:1449/runtime.rs:2745/runtime.rs:2771/runtime.rs:2789/runtime.rs:2800→admit_planned_with_checkpoint_accounting(scheduler.rs:1592-1597). scheduler.rs:1722-1726keeps it (Some(accounting) => accounting) and then callscheckpoints.clear_reservations(), which nullsanchor_fallback_fromand clearscuts(checkpoints.rs:48-52) — so there is no persisted verdict to short-circuitcheckpoint_selection.baseline_intervalis preserved byget_or_insert(:441), whilestartbecomes the new, largerconsumed_tokens(scheduler.rs:1751).
Why it matters. With checkpoint_extra_work_fraction == 0.0 and an interior message boundary whose local split (near the moving frontier) prices at zero extra work, branch A keeps raw_anchor and the request commits and publishes an Anchor cut at raw_anchor (:512-519, then commit_checkpoint_plans :778-853). After prefill advances past raw_anchor (and especially after a preemption/re-admission shortens the pricing window), branch B re-prices over the longer [baseline_start, prompt), where the split costs a padded launch; it therefore sets anchor_fallback_from = Some(raw_anchor) and pushes a cut at request.prompt_tokens — a second Anchor capture at prompt end for the same request. That is exactly what the PR's stated benefit rules out: "Zero-cost aligned interior anchors remain eligible without adding a duplicate prompt-end anchor." It also spends the extra padded prefill launch and the snapshot row the zero-budget mode is meant to protect.
The three new tests (checkpoints.rs ~2313-2880) and checkpoint_lifecycle_tests.rs only exercise single-admission flows, so nothing in the suite crosses the start != baseline_start case.
Fix. Use one origin for the decision: price the split over [baseline_start, prompt) in both branches (identical to branch A on the first selection, since start == baseline_start there), or persist the decided interval/verdict on CheckpointAccounting (it already has baseline_interval; anchor_fallback_from alone is not enough because clear_reservations drops it) and re-derive from that instead of from consumed_tokens. A test that preempts a zero-fraction request after its interior Anchor cut commits, re-admits it with the carried accounting, and asserts exactly one Anchor capture would settle it.
Finding 2 — Should fix: is_request_anchor_endpoint re-walks the whole prefill interval on every commit lane and every admit
Where: helios/src/scheduler/checkpoints.rs:390-420; call sites helios/src/scheduler.rs:1794 (inbound ticket role in admit_planned_with_checkpoint_accounting) and helios/src/scheduler/checkpoints.rs:763 inside promote_request_anchor, which helios/src/scheduler.rs:2411 runs as
for lane in &step.lanes { self.promote_request_anchor(lane.request)?; }
on every commit.
is_request_anchor_endpoint bypasses checkpoint_selection_cached entirely: it calls self.prefill_catalog_costs(request) (:405), which allocates a Vec<PrefillCatalogCost> over the catalog on each call (:163-206), then up to three interval_prefill_ns walks over the full prompt (:208-338, which itself iterates window_ends, prefill_spans and the catalog per chunk). The only cheap exits are the early guards (:392-401) and request.checkpoints.anchor_fallback_from == Some(raw_anchor) (:402). anchor_fallback_from is None at admission (cleared by clear_reservations, checkpoints.rs:48-52, called from scheduler.rs:1726) and remains None permanently in the aligned-interior-anchor case where the split genuinely is zero cost — precisely the configuration this PR keeps alive.
Why it matters. Correctness is unaffected; cost is. It runs per lane per decode commit, next to the expensive-and-cached plan(), and contradicts the module's own design: SelectionCache (checkpoints.rs:11-19) and checkpoint_planning_scope (policy.rs:1208, :1453) exist to bound checkpoint selections per planning round. The existing selection-counting tests (scheduler/tests.rs:257-311, STRIDE_RUNS at checkpoints.rs:262) do not cover this new path, so a regression here would not be caught.
Fix. Answer from the already-computed selection accounting (checkpoint_selection/checkpoint_selection_cached records anchor_fallback_from and the Anchor cut endpoint), and/or memoise the zero-cost verdict per request keyed on (prompt_tokens, raw_anchor, window_ends, prefill_spans shape, span).
Finding 3 — Nit: is_request_anchor_endpoint uses a third interval origin (0), so it can disagree with selection about which endpoint is "the anchor"
Where: helios/src/scheduler/checkpoints.rs:411-419 (literal 0 as start), compared with the two branches in Finding 1.
Beyond the cost (Finding 2), pricing over [0, prompt) can differ from checkpoint_selection's [start, prompt) / [baseline_start, prompt) verdict whenever the split is zero-cost from the frontier but not from token 0 (or vice versa). Consequences:
promote_request_anchor(checkpoints.rs:753-776) will, via the new prompt-end fallback at:762-767, promote the checkpoint atprompt_tokenstoRetentionRole::Anchorand re-offer publication (:769-773) even thoughcheckpoint_selectionchoseraw_anchor— stamping a checkpoint as the request's anchor that selection never picked.scheduler.rs:1792-1808assigns the inbound ticketRetentionRole::Anchoron the same basis, so cached prefix retention rank and the selection can disagree.
Overlaps with Finding 1's fix: price all three sites from the same stored interval.
Checked and found correct (no finding)
helios/src/scheduler/checkpoints.rs:22-57—anchor_fallback_fromplumbing andclear_reservations(resets toNoneat:49, so no stale verdict survives re-admission except the interval-origin problem above).helios/src/scheduler/checkpoints.rs:108-126—checkpoint_anchor/checkpoint_endpoint_eligibleunchanged by this PR; the new code only widens/narrows which endpoint is chosen, not eligibility.helios/src/scheduler/checkpoints.rs:455-462— the newsnapshots == 0early return is live (snapshotsis a manifest integer with no "0 disables" contract:helios/src/server/config.rs:141-168,helios/src/model/catalog.rs:56-58), and it returns(accounting, false, false)afterinitial_prefill_nsis filled, socheckpoint_copy_allowed(:856-875) andallocate_terminal_capturestill see a usable accounting. It leaks noreserved_nsand leaves no stale cut.helios/src/scheduler/checkpoints.rs:364-388—anchor_split_is_zero_costreturnsfalsewhenever a price is unknown, i.e. falls back to prompt end. That is the conservative direction under a zero budget (never overspend).helios/src/scheduler/checkpoints.rs:644-660—estimated_checkpoint_cut(quote-free cached) andcheckpoint_cutshare the same selection, so the policy'sprefill_work_throughcut andplan_checkpointsstay consistent.helios/src/scheduler/checkpoints.rs:692-725—plan_checkpointsreadsanchorfrom the accounting'sAnchorcut, falling back toprompt_tokensonly whenanchor_fallback_from == Some(raw_anchor);reserve_guard/rows/planned_rowsarithmetic is consistent for the fallback case (the interior guard is simply not used).helios/src/scheduler/checkpoints.rs:778-854— commit path: theAnchorcut takesanchor_guardfirst (:799-803), re-quotes at:806-812, and refundscopy_nspluscheckpoint_skip_storagewhen storage is unavailable (:847-850); no double reservation.helios/src/scheduler/policy.rs:334-352,:499-537,:1208-1327—checkpoint_planning_scope/available_plan/checkpoint_anchor_waitingstill treat the anchor uniformly; no behaviour change needed.helios/src/scheduler.rs:688-770,:1286-1320— snapshot limits andensure_resourcesunaffected by the new early return.helios/src/server/runtime.rs:374-422,:2067-2100,:2739-2836— carriedCheckpointAccountingflows as claimed (this is the mechanism that makes Finding 1 reachable, not a bug of its own).- Docs:
docs/cli-design.md:700-713,docs/core-design.md:1435-1450,docs/scheduling-runtime-design.md:551-563all describe the new behaviour consistently (zero capacity ⇒ no cuts; zero fraction ⇒ interior anchor only at zero split cost, prompt end otherwise). No code/doc mismatch. verification/helios-lifecycle/check.py:322-343— the added mutation needle matches the source exactly once (the:489-502branch verbatim), so the "dropped multi-chunk zero-budget fallback" mutation is sound and would catch removal of branch B. Note it does not cover thestart/baseline_startdisagreement in Finding 1.
Open questions / what would settle them
Mixedlanes and window restore. Does aMixedlane or aconditioned_windows/window_restorepath (scheduler.rs:1735-1738) reach branch A on its first selection withstart != baseline_start, widening Finding 1's exposure beyond preemption? A test with a window-restored request would settle it.- Cross-lineage promotion at prompt end. Can
promote_request_anchor's prompt-end fallback (checkpoints.rs:762-767) resolvecache.ready_by_prefix(&key)atprompt_tokensto a checkpoint of a different history with the same prompt-end key, promoting a foreign capture toAnchor? Needs a two-lineage test or a runtime trace. - The three heavyweight new tests (
checkpoints.rs~2313-2880) andcheckpoint_lifecycle_tests.rs:277-410were read, not executed here; the PR reports them green. They do not cover thestart != baseline_startcase, so they do not refute Finding 1.