Final review report · NVIDIA/hyperflare-inference #644

Raw Markdown for agents: https://autobot.eidonix.com/p/5125928c-2678-46c6-b03a-ca5512bfa574.md

Recommendation: Changes Requested

The core mathematical design in PR #644 is sound: the survival-weighted per-step conditional calibration in rounds.rs, the exact excluded-only Bellman continuation $\sigma_i = (K - b_f) T_f / b_f$ (including heterogeneous multi-family wall-time shares), and served-share delivery fairness all check out algebraically and align cleanly across Rust and the Python simulator with zero ABI changes. However, deep inspection surfaced one real mathematical bug introduced in next_progress (helios/src/scheduler/policy.rs:501), where ValueRate::new(ns, work, 0.0) leaves the new +age_price * T / 2 term uncanceled for delivery-bearing multistage requests, alongside six superseded passages in docs/scheduling-runtime-design.md and two in helios/README.md that now directly contradict docs/scheduling-utility.md and the code. Fixing policy.rs:501, reconciling the stale docs, and removing the dead completion_ms parameter from LaneValue::finish will make this ready to merge (with #645 rebased/re-derived afterward).

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Uncanceled +age_price * T / 2 duration bias in next_progress for delivery-bearing multistage requests (helios/src/scheduler/policy.rs:501).

    • LaneValue::decode (helios/src/scheduler/utility.rs:95-119) now adds + self.age_price * service_ms * (self.age_ms + service_ms / 2.0) to cancel the - decode_age_price * duration_ms / 2.0 subtraction in ValueRate::new.
    • However, next_progress (helios/src/scheduler/policy.rs:501) still constructs ValueRate::new(ns, work, 0.0) when scoring Resume, Decode, Speculative, and Mixed shapes at lines 547, 556, and 587. For any delivery-bearing request with value.age_price > 0 (e.g., a request in Restore or non-terminal Snapshot with consumed_tokens == prompt_tokens, evaluated via prerequisite_value and continuation_candidate's fill()), dividing by T leaves an uncanceled + value.age_price * T / 2 bonus that rewards slower graphs over faster ones producing the same tokens.
    • Fix: Change helios/src/scheduler/policy.rs:501 from ValueRate::new(ns, work, 0.0) to ValueRate::new(ns, work, value.age_price) (for prefill requests value.age_price is 0.0, so prefill scoring is unaffected, while delivery-bearing requests cancel the + c * T / 2 term cleanly). Add a unit test in policy_tests.rs verifying that next_progress prefers a faster decode/resume shape over a strictly slower equal-token shape when value.age_price > 0.
  2. Reconcile superseded scheduler equations in docs/scheduling-runtime-design.md and helios/README.md.

    • docs/scheduling-runtime-design.md still documents the pre-PR model in six places that now contradict docs/scheduling-utility.md and the implementation:
      • docs/scheduling-runtime-design.md:200-210: still describes "one delivery regardless of its token count", "delivery rate z", and "output delivery: g/z".
      • docs/scheduling-runtime-design.md:233-247: still gives the old sigma_i = K*T/min(batch_capacity,k) and the old score formula "- T/2 * sum over active decoders of c_i" without excluded-only cancellation.
      • docs/scheduling-runtime-design.md:338-339 and :378-383: still state that terminal rows in a two-stage sequence stop accumulating age at time T and save waiting over [T, H] (now zero waiting over the full horizon H, matching docs/scheduling-utility.md:296-305).
      • docs/scheduling-runtime-design.md:527-538: still says visible publication records "one served delivery" and initializes a missing delivery history "to one delivery over its measured frame duration" (now delivered = duration_ms, normalizer 1.0, initial share 1.0 at helios/src/scheduler/service.rs:47-52, 424).
      • docs/scheduling-runtime-design.md:645: still calls delivery_fairness the "Delivery-rate log-utility coefficient, value/ms" instead of served delivery-share.
    • helios/README.md is untouched and still states the superseded model in two places:
      • helios/README.md:446-450: still describes a "per-depth verification calibration ratio (... clamped to [0, 2])" instead of per-step conditional factors multiplied cumulatively, clamped to [0, 4], with unobserved deeper inheritance.
      • helios/README.md:470-476: still says a delivery is credited "once per completion regardless of token count" and initialized "from its reference delivery interval" instead of served wall-time share initialized from batch-feasible served share.
    • Fix: Update helios/README.md:446-450, 470-476 and update docs/scheduling-runtime-design.md (preferring concise statements + pointers to docs/scheduling-utility.md over duplicating full derivations so the two docs cannot drift again).
  3. Add or clarify multi-concurrency (B=4 / K>4) validation and reference #152 in the PR description.

    • Open issue #152 reports this exact balanced width-1 collapse at B=4 and its triage asked for matched inter-token/delivery-gap evidence alongside throughput; meanwhile #632 showed that raising calibration ceilings can regress C=4..32 moderate-acceptance workloads on real hardware.
    • Fix: Link #152 (and #632/#645) in the PR description, clarify that the DFly2 gb10-tp4-202611301002 comparison is against forced P=6 (not main), and if a 4× DGX Spark host is available before merge, run a quick B=4 main-vs-PR balanced check (throughput + inter-token/delivery gaps) to confirm no multi-concurrency over-allocation regression from CALIBRATION_FACTOR_MAX = 4.0.

Subtract / Simplify

  1. Delete dead completion_ms parameter from LaneValue::finish and unused first_ms local (helios/src/scheduler/utility.rs:121-130, helios/src/scheduler/policy.rs:606, 723, 741, 872).

    • After switching terminal retirement to excluded-only waiting over the full horizon, completion_ms is used solely in debug_assert!(horizon_ms == 0.0 || completion_ms <= horizon_ms) at utility.rs:122 and is completely dead in release builds. let first_ms = duration_ns as f64 / 1e6; at policy.rs:723 exists only to pass it.
    • Fix: Change the signature to pub fn finish(&self, horizon_ms: f64) -> f64, delete first_ms at policy.rs:723, and simplify all callers (policy.rs:606, 741, 872, policy_tests.rs:3554, utility.rs:365).
  2. Deduplicate the descending calibration inheritance walk (helios/src/scheduler/rounds.rs:290-305 vs :364-375).

    • Forecast::prior_calibration_factor and #[cfg(test)] Forecasts::calibration_factor duplicate the same descending (0..depth).rev() search, differing only in whether self.calibration is checked alongside global.
    • Fix: Extract a single helper fn inherited_calibration_factor(local: Option<&[RequestCalibration]>, global: &[DepthCalibration], depth: usize) -> f64 called with Some(&self.calibration) in production and None in the #[cfg(test)] accessor, preventing drift between test assertions and production pricing.
  3. Deduplicate the cumulative calibration-factor product loop (helios/src/scheduler/rounds.rs:451-455 vs :627-637).

    • Both speculative_curve (pricing) and observe_packed_forecasts (learning/surplus) independently accumulate cumulative_factor *= forecast.calibration_factor(depth, &self.forecasts.calibration).
    • Fix: Extract a zero-allocation iterator helper on Forecast (e.g., fn cumulative_calibration_factors<'a>(&'a self, global: &'a [DepthCalibration], limit: usize) -> impl Iterator<Item = f64> + 'a) used by both sites so pricing and learning cannot diverge without adding a Vec allocation to speculative_curve.

Nits

Dropped on verification