Re review report · NVIDIA/hyperflare-inference #661

Raw Markdown for agents: https://autobot.eidonix.com/p/35b41226-3de8-4efb-9099-a533a7571eda.md

Recommendation: Changes Requested

Head c588d61 cleanly rebases onto main (1fbcc3c9), adds the PlanOrigin::Discovery and deferred_prefill/resize_prefill safety guards with strong isolated unit tests, and keeps the core Rust scheduling implementation memory-safe, single-threaded, and model-agnostic. However, the Round 1 verification blocker remains unresolved—neither the mandatory 64-seed simulator timing validation (docs/design-review.md:195-208) nor a head-commit served A/B / CI run on c588d61 is present—and RequestScheduler::service_rates (helios/src/scheduler/service.rs:297-328) still misprices feasible non-terminal Prefill rates whenever any TerminalPrefill shape is already measured.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Unresolved Round 1 verification gates: mandatory 64-seed simulator timing gate unrun and no served A/B or CI on head c588d61 (docs/design-review.md:195-208, PR body Evidence/Limits):
    • Verified behavior/impact: docs/design-review.md:201-206 mandates that "Changes to timing estimation or funded refresh require running the screening and 64-seed validation catalog in scripts/scheduling_sim/learning.py … Do not diverge Helios from the simulator's qualified policy without updating and validating the rule across that catalog." This PR adds a new timing estimator (ActionCosts::interpolated_prefill_duration, helios/src/scheduler/cost.rs:695-786) and changes unmeasured pure-prefill discovery under age_price > 0.0 (helios/src/scheduler/policy.rs:1110-1142, 1462-1494). PR Evidence reports only learning.py smoke+screen, which run seeds (0, 1) and TRAINING_SEEDS = range(16) (scripts/scheduling_sim/learning.py:488-497, scripts/scheduling_sim/learning_analysis.py:12-13)—not --preset validate (HELDOUT_SEEDS = range(10_000, 10_064)). Moreover, scripts/scheduling_sim/learning_policy.py:255-273 (initial_discovery = "native") was not updated to model interpolated unmeasured pure-prefill discovery (which uses only Graph.prefill_capacity and Graph.decode_capacity, already present in scripts/scheduling_sim/model.py:24-30, independent of TERMINAL_PREFILL or two-frame pipelining); docs/scheduling-theory.md:558-565 merely documents the divergence. Separately, per the PR body's own Limits, all SM120 flare run A/B numbers ran on fdb10bb5/82f68ea8 before the resize_prefill/PlanOrigin::Discovery guards and the 1fbcc3c9 rebase (and GB10 numbers predate #656), with no CI result readable for c588d61.
    • Fix: (1) Either model the interpolated unmeasured pure-prefill discovery rule in scripts/scheduling_sim/learning_policy.py and pass learning.py --preset validate (64 held-out seeds), or obtain explicit maintainer sign-off waiving simulator parity for this rule; and (2) re-run the key SM120 served A/B (mixed-c32 and T_50C) on c588d61 (post-guards, post-rebase) and confirm green GitHub Actions CI on the mergeable head.

Should Fix

  1. service_rates gates feasible non-terminal Prefill pricing on token_rate == 0.0, understating feasible rate once any TerminalPrefill shape is measured (helios/src/scheduler/service.rs:297-328):
    • Verified behavior/impact: Selection (helios/src/scheduler/policy.rs:511-512) computes terminal_only via prefill_requires_terminal_completion_for_age, so under active age-priced streams non-terminal Prefill chunks are feasible whenever !prefill_must_complete_terminally_from(...). By contrast, service_rates (service.rs:297-328) computes terminal_only = self.prefill_requires_terminal_completion_from(...), skips GraphKind::Prefill on the first scan, and only rescans with skip_nonterminal = false if token_rate == 0.0. As soon as any covering TerminalPrefill shape is measured (e.g., a slower padded TerminalPrefill(16384) for an 8192-token prompt), scan_prefill(true) returns a positive rate and suppresses a faster measured feasible Prefill(4096) chunk. When Prefill(4096) then executes, observe_service/projected_service (service.rs:432-433) divides its tokens by the understated terminal rate, overcharging the request's normalized GPU share and violating docs/scheduling-runtime-design.md:247-249.
    • Fix (subtractive—also removes the double catalog scan): Replace the scan_prefill closure and token_rate == 0.0 rescan at helios/src/scheduler/service.rs:297-328 with a single pass using the same feasible-set condition:
      let terminal_only = if self.has_active_age_priced_stream() {
          self.prefill_must_complete_terminally_from(request, start, cut)
      } else {
          self.prefill_requires_terminal_completion_from(request, start, cut)
      };
      
      followed by the single for &capacity in catalog loop skipping kind == GraphKind::Prefill only when terminal_only. Add a unit test measuring both a slower padded TerminalPrefill and a faster feasible Prefill under an active decoder and asserting service_rates returns the faster feasible rate.
  2. PR description's (throughput pipelines) claim omits the terminal_cleanup drain exception (helios/src/scheduler.rs:996-1005, 1187-1190, helios/src/scheduler/policy.rs:37, 50-52, helios/src/scheduler/policy_tests.rs:8291-8314):
    • Verified behavior/impact: PolicyConfig::throughput() zeroes decode_age_price but keeps terminal_age_price: 1.0, and has_active_age_priced_stream() returns true whenever a finishing request is in policy::terminal_cleanup(r)—which intentionally drains non-terminal Prefill so retirement Snapshots are not delayed behind two-frame pipelined prefills (already tested at policy_tests.rs:8291-8314 and accurately documented in helios/README.md:285-287). However, the PR body still claims unqualified (throughput pipelines) from Round 1.
    • Fix: Update the PR body to state accurately that throughput keeps two-frame Prefill pipelining across active decode/resume streams and drains only when a finishing terminal_cleanup stream is resident (terminal_age_price > 0.0).

Subtract / Simplify

  1. Extract the duplicated 33-line interpolated-exploration block and delete the speculative last_interp memo (helios/src/scheduler/policy.rs:1081, 1110-1142 and :1443, 1462-1494):
    • continuation_candidate and add_candidate contain byte-identical 33-line exploration blocks, including a 16-line last_interp cache that only hits when two distinct prefilling slots share identical (work, scheduled_consumed) for the same capacity while scanning a small self.entries table with no allocation. Extract a single explore_prefill_ns(...) -> Option<u64> helper on RequestScheduler without last_interp (~65 lines removed) so the core exploration gate cannot drift between the two call sites.
  2. Unify the duplicated PlanOrigin::Discovery predicate (helios/src/scheduler/policy.rs:1784-1792 and :2071-2081):
    • select_plan and phase_plan duplicate duration_ns == 0 || self.costs.observation(key).and_then(|(_, observed, _)| observed).is_none(), which is equivalent to duration_ns == 0 || self.costs.duration_key(key).is_none_or(|ns| ns == 0) (helios/src/scheduler/cost.rs:873-875, 904-908). Extract a single plan_origin(&self, candidate: Candidate) -> PlanOrigin helper.
  3. Deduplicate the inverted peer-selection predicate in interpolated_prefill_duration (helios/src/scheduler/cost.rs:734-744 vs :759-772):
    • The early-skip filter at :734-744 hand-inverts the same (tokens, same_kind) tie-break applied at :759-772. Hoist one comparison predicate (or drop the redundant cur_same && !same_kind early skip) so the peer-ranking rule lives in one place.
  4. Promote the triplicated test closures in helios/src/scheduler/cost.rs (:1284-1317, :1359-1392, :1478-1511):
    • make, step_for, and timing are pasted byte-identically across all three new unit tests (~92 lines). Promote them to module-local #[cfg(test)] helpers to save ~60 lines.

Nits

Dropped on verification