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
- Global default-policy blast radius: While per-step calibration is gated on
gpu_confidence()(helios/src/scheduler/rounds.rs:472-474), the excluded-only waiting-age and served-share delivery-fairness changes apply unconditionally to--scheduler-policy balancedacross all cores and model families (andLaneValue::finishapplies under--scheduler-policy throughputas well, whereterminal_age_price = 1.0). - Hardware validation gap in multi-concurrency regimes: Live GPU measurements cover solo concurrency (
B=1, including an isolated same-corebalancedbefore/after ongb10-tp4-202611301141), whileB=4uncontended,K>4oversubscribed, and inter-token cadence/delivery-gap behavior (open issue #152) are verified in CPU unit/simulator tests only. RaisingCALIBRATION_FACTOR_MAXto4.0per step warrants attention on moderate-acceptance concurrent workloads given theC=1..32regressions observed when loosening calibration ceilings in #632 (now closed in favor of this PR). - No concurrency, ABI, or hot-path allocation hazards: All changes are pure
f64arithmetic on the single-threadedRequestSchedulerplanning/completion path with no Protobuf, core-format, CUDA-graph, lock, or hot-path allocation changes. Note that open sibling PR #645 overlaps 7 files and still prices delivery as a rate (delivery_fairness / (z_ss * E)), so #645 will need to be rebased and re-derived once #644 lands.
Walkthrough
helios/src/scheduler/rounds.rs:13, 22-56, 85-116, 290-324, 334-376, 446-469, 627-710: Replaces cumulative-ratioDepthCalibration/RequestCalibrationwith survival-weighted per-step conditional calibration (CALIBRATION_FACTOR_MAX = 4.0, flat0.5per-step prior, round weightclamp(sum_w / count, 0, 1)), inherits the deepest observed shallower factor for unobserved deeper steps (request-local preferred over global), and multiplies cumulative per-step factors across0..=depthduring pricing and surplus observation.helios/src/scheduler/utility.rs:76-131, 339-383: AddsLaneValue::decode_within(expected, preceding_ms, horizon_ms)(withdecodewrappingpreceding_ms = 0.0) so served decoders cancel-age_price * T / 2inValueRate::newwhile modeling prerequisite wait over[0, preceding_ms], updatesLaneValue::finishto cancel waiting over the full horizon, and expands the Bellman continuation identity test to include an excluded lane.helios/src/scheduler/service.rs:27-33, 43-55, 59-160, 304-318, 340-372, 411-428: Replaces scalardelivery_reference_intervalswithDeliveryReference { excluded_wait_ms, served_share }((K - b) * T / bandb / K), switches delivery accounting from burst count (1.0against1 / T_min) to served wall-time share (delivered = duration_ms, normalizer1.0, first-burst init1.0), and updatesprojected_serviceandobserve_serviceaccordingly.helios/src/scheduler/policy.rs:427, 448, 467-473, 793-796, 906-966: ThreadsDeliveryReferenceintolane_valuesand passespreceding_nsthroughlane_value_within/lane_value_for_tokens_withinfor two-stage lookahead incontinuation_candidate.scripts/scheduling_sim/utility.py:133-236& tests (helios/src/scheduler/policy_tests.rs,tests/test_scheduling_utility.py,tests/test_scheduling_learning_policy.py): Mirrors excluded-only waiting and served-share delivery accounting in the Python simulator and adds isolated CPU/simulator tests for per-step calibration inheritance, unexcluded peak-throughput depth selection (B=1/B=4), oversubscribed fairness (K=8, b=4), and the excluded-only Poisson equation.docs/scheduling-utility.md&docs/scheduling-runtime-design.md:113-152: Documents served-share delivery fairness, excluded-only waiting/continuation, and per-step conditional calibration.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure
f64scheduler pricing and calibration arithmetic; no I/O, unsafe code, external input parsing, or credential/network changes. - [WARN] Charter & value fit: Model-agnostic change in the right layer with zero new flags/ABI impact, required four-part PR structure, and
Discord: lukealonso; addresses open issue #152 (unlinked in PR body). However,docs/scheduling-runtime-design.mdandhelios/README.mdare left contradicting the new model, and the DFly2 benchmark compares against forcedP=6rather thanmain(while multi-concurrencyB=4/K>4remains GPU-unmeasured). - [PASS] Related / duplicate / conflict check: Competing PR #632 was explicitly closed by
original-el8in favor of #644. Sibling PR #645 (same author) overlaps 7 files and still uses the pre-#644 delivery-rate formula; merge #644 first and rebase/re-derive #645. - [PASS] Tests & verification evidence: Isolated production-path Rust (
400scheduler::tests + crate suites under--locked --release), Python simulator (786tests), and all 8 TLA+ formal lifecycle conformance models passed; Kani-covered validators are unmodified; liveB=1same-corebalancedA/B ongb10-tp4-202611301141shows+2.3%mean /+8.1%greedy_code.
Blockers
None.
Should Fix
-
Uncanceled
+age_price * T / 2duration bias innext_progressfor 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.0subtraction inValueRate::new.- However,
next_progress(helios/src/scheduler/policy.rs:501) still constructsValueRate::new(ns, work, 0.0)when scoringResume,Decode,Speculative, andMixedshapes at lines547,556, and587. For any delivery-bearing request withvalue.age_price > 0(e.g., a request inRestoreor non-terminalSnapshotwithconsumed_tokens == prompt_tokens, evaluated viaprerequisite_valueandcontinuation_candidate'sfill()), dividing byTleaves an uncanceled+ value.age_price * T / 2bonus that rewards slower graphs over faster ones producing the same tokens. - Fix: Change
helios/src/scheduler/policy.rs:501fromValueRate::new(ns, work, 0.0)toValueRate::new(ns, work, value.age_price)(for prefill requestsvalue.age_priceis0.0, so prefill scoring is unaffected, while delivery-bearing requests cancel the+ c * T / 2term cleanly). Add a unit test inpolicy_tests.rsverifying thatnext_progressprefers a faster decode/resume shape over a strictly slower equal-token shape whenvalue.age_price > 0.
-
Reconcile superseded scheduler equations in
docs/scheduling-runtime-design.mdandhelios/README.md.docs/scheduling-runtime-design.mdstill documents the pre-PR model in six places that now contradictdocs/scheduling-utility.mdand 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 oldsigma_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-339and:378-383: still state that terminal rows in a two-stage sequence stop accumulating age at timeTand save waiting over[T, H](now zero waiting over the full horizonH, matchingdocs/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"(nowdelivered = duration_ms, normalizer1.0, initial share1.0athelios/src/scheduler/service.rs:47-52, 424).docs/scheduling-runtime-design.md:645: still callsdelivery_fairnessthe"Delivery-rate log-utility coefficient, value/ms"instead of served delivery-share.
helios/README.mdis 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-476and updatedocs/scheduling-runtime-design.md(preferring concise statements + pointers todocs/scheduling-utility.mdover duplicating full derivations so the two docs cannot drift again).
-
Add or clarify multi-concurrency (
B=4/K>4) validation and reference #152 in the PR description.- Open issue #152 reports this exact
balancedwidth-1 collapse atB=4and its triage asked for matched inter-token/delivery-gap evidence alongside throughput; meanwhile #632 showed that raising calibration ceilings can regressC=4..32moderate-acceptance workloads on real hardware. - Fix: Link #152 (and #632/#645) in the PR description, clarify that the DFly2
gb10-tp4-202611301002comparison is against forcedP=6(notmain), and if a 4× DGX Spark host is available before merge, run a quickB=4main-vs-PRbalancedcheck (throughput + inter-token/delivery gaps) to confirm no multi-concurrency over-allocation regression fromCALIBRATION_FACTOR_MAX = 4.0.
- Open issue #152 reports this exact
Subtract / Simplify
-
Delete dead
completion_msparameter fromLaneValue::finishand unusedfirst_mslocal (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_msis used solely indebug_assert!(horizon_ms == 0.0 || completion_ms <= horizon_ms)atutility.rs:122and is completely dead in release builds.let first_ms = duration_ns as f64 / 1e6;atpolicy.rs:723exists only to pass it. - Fix: Change the signature to
pub fn finish(&self, horizon_ms: f64) -> f64, deletefirst_msatpolicy.rs:723, and simplify all callers (policy.rs:606, 741, 872,policy_tests.rs:3554,utility.rs:365).
- After switching terminal retirement to excluded-only waiting over the full horizon,
-
Deduplicate the descending calibration inheritance walk (
helios/src/scheduler/rounds.rs:290-305vs:364-375).Forecast::prior_calibration_factorand#[cfg(test)] Forecasts::calibration_factorduplicate the same descending(0..depth).rev()search, differing only in whetherself.calibrationis checked alongsideglobal.- Fix: Extract a single helper
fn inherited_calibration_factor(local: Option<&[RequestCalibration]>, global: &[DepthCalibration], depth: usize) -> f64called withSome(&self.calibration)in production andNonein the#[cfg(test)]accessor, preventing drift between test assertions and production pricing.
-
Deduplicate the cumulative calibration-factor product loop (
helios/src/scheduler/rounds.rs:451-455vs:627-637).- Both
speculative_curve(pricing) andobserve_packed_forecasts(learning/surplus) independently accumulatecumulative_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 aVecallocation tospeculative_curve.
- Both
Nits
helios/src/scheduler/rounds.rs:13: Add a brief 1-line comment onCALIBRATION_FACTOR_MAX = 4.0noting the rationale (bounding per-step conditional upscaling when raw proxy confidence is ~0.25 vs realized ~1.0, now that cumulative multiplication across0..=depthhandles multi-step compounding).helios/src/scheduler/policy.rs:956-963:GraphKind::Decode | GraphKind::SpeculativeandGraphKind::Resumenow share identicaldecode_within(..., preceding_ns as f64 / 1e6, horizon_ns as f64 / 1e6)calls and can be merged into one match arm if touched.
Dropped on verification
- Upstream claim that #632 is an open competing PR with undecided supersession: Dropped as stale. Verified via
read_item(632)thatoriginal-el8already closed #632 on2026-11-30 18:02explicitly in favor of #644. - Correctness Lens F4 ("
LaneValue::finishcharges the full horizon and reprices terminal retirement toward later snapshots, silently affectingthroughput"): Dropped as a sign-inversion misread. Adding+ age_price * horizon_ms * (age_ms + horizon_ms / 2.0)cancels the common-c * H / 2waiting penalty inValueRate::new(increasing retirement value, not charging it), is required by excluded-only waiting, and is explicitly documented—including itsthroughput-policy applicability—indocs/scheduling-utility.md:294-305. Only the deadcompletion_msargument was kept (under Subtract / Simplify). - Correctness Lens F5 ("
delivery_referencesfallback(count - 1.0)/rintroduces bias in the unmeasured startup window"): Dropped as factually false. Verified inservice.rs:176-188, 282-285that unmeasured graphs producedelivery_rate = None, so lines64-69never execute at unmeasured startup; when any graph in a ready family is measured, lines150-158overwritereferences[slot]. Lines64-69remain active only for multistage-blocked streams (family(r) == None), matchingdocs/scheduling-utility.md:245-246. - Correctness Lens F7 ("
cost == best[slot].0tie-break inservice.rs:107is inert"): Dropped as low-signal. Exact IEEE 754 ties occur in linear/power-of-two cost models and tests (matchingutility.py:137), while real GPU shapes scale sub-linearly so larger batches have strictly smallerT / served. Adding an epsilon would introduce an arbitrary magic constant. - Correctness Lens F8 ("
delivery_fairness/decode_age_pricesilently change physical dimension and need opt-in"): Dropped as inaccurate on dimensions. Bothdelivery_fairness(value/ms) anddecode_age_price(value/ms²) retain identical physical units and identical equilibrium magnitude (g_i * K / batT = T_f); adding a legacy-bias flag would violate the charter's anti-flag principle. - Correctness Lens F9 (flat
0.5prior andround_w = clamp(sum_w / count, 0, 1)are underived/asymmetric): Dropped.0.5is the exact per-step conditional equivalent of the prior0.5^(d+1)geometric cumulative prior (realized == predicted == 0.5, neutral factor1.0), and dividingsum_wbycount(notsum_w, which would trivially yield1.0) is the mathematically correct mean survival weight per round. Only a brief rationale comment forCALIBRATION_FACTOR_MAX = 4.0was kept as a Nit. - Correctness Lens F11 ("no before/after on one core exists"): Dropped the blanket claim as an upstream misread of the PR body, which does report an isolated same-core
balancedbefore/after ongb10-tp4-202611301141(72.46 -> 74.15mean,70.30 -> 75.98greedy_code); retained only the narrower note on DFly2's forced-P=6comparator and unmeasuredB=4/K>4cadence. - Correctness Lens F13 ("
#[cfg(test)] observe_calibrationmeans the cross-workload bleed test no longer tests production code"): Dropped as misleading. Verified inpolicy_tests.rs:5420, 5436, 5453-5519thatobserve_calibrationis a 1-line wrapper around productionobserve_calibration_weighted(..., 1.0)used only to seed preconditions; the bleed test itself drivescomplete_packed_round_with_survivalend-to-end withw < 1. - Subtraction Lens F4 & F5 (drop
service.rs:64-69fallback / merge catalog scans; addServicePrice::observe_deliverywrapper) & Minor (utility.pydataclass): Dropped. Droppingservice.rs:64-69would break the documentedb = 1reference for multistage-blocked streams;service_rates(per-request) anddelivery_references(cross-request cohort) have distinct scopes; addingobserve_deliveryexpands API surface rather than subtracting; and(cost, -served)inutility.py:137is concise, idiomatic Python.