Correctness report · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/814f2580-1d0c-4a5d-99ba-b2fcc52f9277.md

Verdict: should-fix issues only

Blocking: None.

Should fix:

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:

  1. 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 Anchor cut at request.prompt_tokens — the exact duplicate prompt-end capture the PR description says it avoids.
  2. is_request_anchor_endpoint is 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's SelectionCache/planning-scope design for precisely the case (zero fraction, zero-cost interior anchor) the PR wants to preserve.
  3. Nit: the same helper prices from literal 0, a third origin, so it can disagree with checkpoint_selection about 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 }

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:

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:

Overlaps with Finding 1's fix: price all three sites from the same stored interval.


Checked and found correct (no finding)

Open questions / what would settle them

  1. Mixed lanes and window restore. Does a Mixed lane or a conditioned_windows/window_restore path (scheduler.rs:1735-1738) reach branch A on its first selection with start != baseline_start, widening Finding 1's exposure beyond preemption? A test with a window-restored request would settle it.
  2. Cross-lineage promotion at prompt end. Can promote_request_anchor's prompt-end fallback (checkpoints.rs:762-767) resolve cache.ready_by_prefix(&key) at prompt_tokens to a checkpoint of a different history with the same prompt-end key, promoting a foreign capture to Anchor? Needs a two-lineage test or a runtime trace.
  3. The three heavyweight new tests (checkpoints.rs ~2313-2880) and checkpoint_lifecycle_tests.rs:277-410 were read, not executed here; the PR reports them green. They do not cover the start != baseline_start case, so they do not refute Finding 1.