Final review report · NVIDIA/hyperflare-inference #645

Raw Markdown for agents: https://autobot.eidonix.com/p/37c5c28e-ae5d-4377-b1d7-6271e836742f.md

Recommendation: Changes Requested

The technical core of PR #645—completion-attributed burst coalescing, stratified fill/context prefill cost modeling, two-frame nonterminal GraphKind::Prefill pipelining, and mixed/terminal catalog fixes—is well-scoped, model-agnostic, ABI-compatible, and thoroughly tested on CPU. However, two mandatory verification gates from the charter and docs/design-review.md remain unmet (the runnable 64-seed learning.py --preset validate sweep was skipped, and no served-workload A/B baseline against main backs the performance claims or #485 fix), and two verified cost-model edge cases need fixes before merge (loss of the checkpoint O(1) stride fast path in the non-constant regime, and an uncapped post-TTL u / u_max upward extrapolation).

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Mandatory 64-seed timing-learning validation sweep was not run (docs/design-review.md:201-206, 247-251; helios/src/scheduler/cost.rs, scripts/scheduling_sim/utility.py).

    • docs/design-review.md:201-206 requires changes to timing estimation or scheduling utility rules to be validated against the screening and 64-seed validation catalog in scripts/scheduling_sim/learning.py, and lines 247-251 explicitly specify that "Disclosure does not excuse skipping runnable CPU checks... Leaving an applicable crate test, simulator sweep, TLA+ conformance run, or Kani proof unrun blocks commit and PR acceptance; noting it as a limitation does not make the omission acceptable."
    • The PR ran only --preset smoke and disclosed that the 64-seed learning.py --preset validate sweep was not run.
    • Fix: Run the full 64-seed scripts/scheduling_sim/learning.py --preset validate sweep (with --configs per learning.py:95-100) and include the pass/summary results in the PR evidence.
  2. No served-workload A/B baseline against main backs the performance overhaul or #485 fix (Charter #210; docs/design-review.md:109-111; scripts/scheduling_sim/workloads.py:50-53).

    • All burst speedup claims (+14.6% throughput, -42.6% max TTFT) come from scripts/scheduling_sim on a synthetic catalog (workloads.py:50-53), and the claimed 8 × 8,192 multi-chunk burst (+12.8%, 1492 → 1056 ms) has no checked-in workload in workloads.py to reproduce it.
    • The live 2× SM120 GPU checks (46,509-token prompt TTFT and B=4/B=8 bursts) are single-arm with no main control, and #485's long-context (64k–128k) launch-drift scenario is not re-measured on GPU (unlike #485's own DS4.1 TP4 A/B table).
    • Fix: Provide at least one equivalent main vs. PR #645 live flare run A/B measurement on an exported core covering burst coalescing / pipelined long-prompt prefill and long-context chunk stability (#485), and either check in the 8 × 8,192 simulator workload or remove that row from the claimed results. Confirm with @voipmonitor that the affine 3-bucket NNLS fit resolves #485's 64k–128k launch drift.

Should Fix

  1. Checkpoint O(1) stride fast path is disabled whenever any prefill capacity has a non-constant predictor (helios/src/scheduler/checkpoints.rs:222-232, helios/src/scheduler/cost.rs:298-302).

    • interval_prefill_ns computes stride via entry.non_terminal?.constant_ns()? (checkpoints.rs:225), and constant_nanos is Some only when best_theta[1] == 0.0 && best_theta[2] == 0.0 && u_max >= 0.75 (cost.rs:298-302).
    • In the exact variable-fill / KV-depth-dependent regime #485 targets (any single capacity with positive fill slope theta_1 > 0, context slope theta_2 > 0, or u_max < 0.75), try_fold short-circuits stride to None and every call to interval_prefill_ns falls back to the chunk-by-chunk catalog loop (checkpoints.rs:270-339). While ENTRY_LOOKUPS stays bounded by prefill_catalog_costs, on long agentic prompts with hundreds of message boundaries (such as the 150k-token / 999-boundary workload in checkpoints.rs:1273-1325) this turns each boundary evaluation from O(1) into O((end - start) / chunk_size * catalog.len()), contradicting the PR description's claim that the O(1) stride path is preserved.
    • Fix: Either support a closed-form arithmetic-series stride for full-chunk runs under the affine predictor theta_0 + theta_1 * 1 + theta_2 * (start + i * cap) / 4096 (or precompute prefix costs across intervals once per checkpoint_selection_cached), and add a budget test in checkpoints.rs covering a non-constant PrefillCostModel on the 150k/999-boundary prompt.
  2. Uncapped post-TTL upward extrapolation t_at_umax * (u / u_max) can severely over-price a large prefill graph after a single short tail (helios/src/scheduler/cost.rs:113-115, 914-923).

    • When u_max < 0.75 && (u_max - u_min) < 0.15 && u > u_max, PrefillPredictor::predict scales linearly from t_at_umax by u / u_max with no upper cap. In cost.rs:914-923, a single post-TTL 128-token tail at 1.51 s inside capacity 3584 (u = 1/28) predicts >= 42.28 s for a full chunk (5.4× the test's own 7.81 s full-chunk cost).
    • If a large graph (for example 4096, or the sole TerminalPrefill capacity) sees a single 64- or 128-token tail right after the 30 s TTL reset, fixed launch/overhead cost gets multiplied by up to 64×. While a single full-fill observation in fill_bin = 1 (cost.rs:205, 213) clears the guard immediately, the inflated full-chunk estimate suppresses ValueRate::new (utility.rs:124-134) so ordinary selection can lock out the large graph in favor of smaller capacities until a rate-limited funded refresh probe fires (and if selected, expected_finish_ns / retained_ns are inflated by the same multiple).
    • Fix: Cap the upward extrapolation multiple (e.g., bound the slope or cap u / u_max, or retain/fallback cleanly across TTL resets for unobserved fill strata) and assert both a lower and reasonable upper bound in cost.rs:919-923.

Subtract / Simplify

  1. Collapse ActionCosts::prefill_duration onto prefill_entry (helios/src/scheduler/cost.rs:529-583).

    • prefill_duration (529-557) duplicates prefill_entry's Key literal, self.entry(key)?, and estimate.nanos == 0 check verbatim. Replacing lines 536-556 with self.prefill_entry(kind, capacity).map(|p| p.map_or(0, |p| p.predict(work, start_position))) removes ~20 lines with identical semantics and the same single ENTRY_LOOKUPS call.
  2. Delete dead is_prefill() branches left behind in add_candidate and continuation_candidate (helios/src/scheduler/policy.rs:1076-1095, 1335-1376).

    • add_candidate now returns early at policy.rs:1248-1307 whenever kind.is_prefill(), making the kind.is_prefill() branches at policy.rs:1342-1347 and 1366-1376 unreachable dead code. Likewise, continuation_candidate returns early at policy.rs:933-1010 for following.is_prefill(), making the !mixed prefill block at policy.rs:1080-1092 dead code. Delete both dead blocks.
  3. Single-source the pipelinable GraphKind predicate and simplify resize_prefill / prefill_step_requires_feedback (helios/src/execution/manifest.rs:84-101, helios/src/scheduler.rs:1109-1143, helios/src/scheduler/policy.rs:1688-1694).

    • The Decode | Speculative | Prefill match is now duplicated 8 times across scheduler.rs:1136, policy.rs:1290, 1711, transport.rs:968, 1021, threaded.rs:876, parallel.rs:263, and threaded/protocol.rs:35. Adding GraphKind::pipelines(self) -> bool on GraphKind in helios/src/execution/manifest.rs:84-101 (alongside is_prefill and samples) keeps all layers in lockstep.
    • In policy.rs:1688-1694, resize_prefill hand-rolls effective_prefill_catalog (policy.rs:341-354) with a redundant !request.prompt_logprobs check (already inside prefill_requires_terminal_completion_from at scheduler.rs:915); replace those 6 lines with self.effective_prefill_catalog(request, request.prefill_kind(), cut).
    • In scheduler.rs:1109-1112, if plan.kind != GraphKind::Prefill { return true; } inside prefill_step_requires_feedback is unreachable because its only caller (scheduler.rs:1137) already checks plan.kind == GraphKind::Prefill; fold lines 1136-1137 into one match plan.kind and remove the dead guard.
  4. Unify PrefillBucket with ReplayTimes (helios/src/scheduler/cost.rs:133-169 vs 389-413) and avoid double-scanning self.slots in coalescing_prefill_log_bonus (helios/src/scheduler/policy.rs:453-482, 592-619).

    • PrefillBucket re-implements ReplayTimes's exact 9-slot ring and (lo + hi + 1) / 2 median rounding in the same file; a small generic ring helper removes the duplicate median implementation.
    • coalescing_prefill_log_bonus scans self.slots twice with overlapping filters and recomputes the identical post_prefill formula (policy.rs:475-477 and 605-607); collecting (slot, post_prefill) into a stack-allocated [(usize, usize); REQUEST_LANES] array in the first pass removes the second scan.

Nits

Dropped on verification