Recommendation: Changes Requested
The core Rust scheduling changes (interpolated_prefill_duration, chunkable non-terminal Prefill under active age-priced streams, deferred_prefill non-terminal-catalog exclusion, and the age-priced Prefill feedback barrier) are clean, memory-safe, and model-agnostic, with sound TimingOrigin::Discovery handling in commit() and no concurrency or overflow defects found. However, this is a default-on balanced-policy performance change that currently fails two merge gates: (1) it diverges Helios from scripts/scheduling_sim/learning_policy.py's qualified initial_discovery = "native" policy without running the mandatory 64-seed scripts/scheduling_sim/learning.py gate (docs/design-review.md:195-208) and without a head-commit (29f2b5b) served A/B or CI run, and (2) the PR description's throughput pipelining claim contradicts scheduler.rs:989-998, 1180-1183 / policy_tests.rs:7784-7826, while the new service_rates fallback test (policy_tests.rs:7738-7741) has a false-pass blindspot that never exercises prefill_must_complete_terminally_from == true.
Merge Risk
Level: Medium
- Default-on hot-path behavior change: Activates implicitly under the shipped
balancedpreset (decode_age_price = 0.1,terminal_age_price = 1.0,helios/src/scheduler/policy.rs:35-37), narrowing #645's two-framePrefillpipelining to drain after every non-terminalPrefillchunk whenever a decoding, resuming, or terminal-cleanup stream is resident, and relaxing #538's natural-fit-only discovery rule (the same discovery surface where #538 → #550 previously caused a GB10 regression). - Clean concurrency, safety, and artifact compatibility:
RequestScheduleris single-threaded (&mut self), zerounsafe, zero new flags/ABI/graph ops, and signed cores serve unchanged;terminal_prefill_windowcaching (scheduler.rs:657, 842-853) andinterpolated_prefill_durationarithmetic (cost.rs:779-785,u128with non-monotonic clamp and.max(1)) are sound. - Branch lag & rebase: Based on
5d53040e(behind currentmain), with minor textual overlap incost.rs,scheduler.rs, anddocs/scheduling-runtime-design.mdagainst open PRs #655, #660, and #663 (note: #655 only changesSnapshotcost retention viameasured_duration, notActionCosts::entriesor prefill freshness semantics).
Walkthrough
helios/src/scheduler/cost.rs(:695-786,:1280-1577): AddsActionCosts::interpolated_prefill_duration, returning a positive estimate for unmeasuredPrefill/TerminalPrefill/ScoredPrefillcapacities from a measured same-capacity sibling (Prefill↔TerminalPrefill, withScoredPrefillisolated) or linear interpolation between a measured smaller peer (or fastest measuredDecode/Speculative/Resumefloor) and a strictly larger measured peer evaluated atstart_position, clamping non-monotonic timings; adds 3 isolated unit tests.helios/src/scheduler.rs(:657, 803, 838, 842-861, 896-902, 957-1015, 1180-1183): Cachesterminal_prefill_windowon catalog updates; widensresolve_prefill_kind_fromsorequest.deferred_prefillexcludes every capacity absent fromterminal_prefill_catalog; addsprefill_must_complete_terminally_from,has_active_age_priced_stream, andprefill_requires_terminal_completion_for_age; drains non-terminalPrefillsteps inprefill_step_requires_feedbackwhenever an active age-priced stream exists.helios/src/scheduler/policy.rs(:79-86, 350-456, 970-1031, 1330-1381, 1694-1799): Replaceseffective_prefill_catalogwithprefill_catalog_for_terminal; hoists per-slot(cut, terminal_only, nat_fit)intoPrefillSlotPlan; prices unmeasured pure-prefill candidates<= nat_fitusinginterpolated_prefill_durationunderage_price > 0.0(whichcommit()atscheduler.rs:2397-2400still records asTimingOrigin::Discovery); updatesresize_prefillto use the terminal catalog underdeferred_prefilland cap capacity atcandidate.capacityunderage_price > 0.0 && !terminal_only.helios/src/scheduler/service.rs(:201-231): Adds atoken_rate == 0.0fallback inservice_ratesto scan non-terminalPrefillcapacities when an age-priced stream is active and!prefill_must_complete_terminally_from(...).helios/src/scheduler/policy_tests.rs,scripts/scheduling_sim/workloads.py,tests/test_scheduling_utility.py,verification/helios-lifecycle/check.py,docs/scheduling-runtime-design.md,helios/README.md: Adds 7 isolated scheduler tests, a synthetic GB10 utility workload/test, updatedcheck.pymutation source string (:529-535), and runtime-design/README documentation.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure scheduler arithmetic, tests, and docs; no
unsafe, I/O, FFI, parsing, privilege, or untrusted-input surface introduced. - [WARN] Charter & value fit: Right runtime layer, model-agnostic, and zero new flags/ABI changes, but ships implicit default-on
balancedbehavior whose mandatory simulator gate (docs/design-review.md:195-208) is unrun and whosethroughputclaim in the PR description disagrees with the code. - [WARN] Related / duplicate / conflict check: Genuinely additive over #645 (deliberately narrowing its
Prefillpipelining under active age-priced streams) and complementary to #663, but base5d53040eis behindmainand needs coordination/rebase alongside open #655, #660 (same author, oppositemixed-c32stall direction), and #663. - [WARN] Tests & verification evidence: Unit tests are isolated and exercise real entry points, except a false-pass blindspot at
policy_tests.rs:7738-7741; no CI checks are attached on29f2b5b, SM120 A/B ran onfdb10bb5prior toresize_prefill'sdeferred_prefillguard, GB10 numbers predate #656 (571a4471), andscripts/scheduling_sim/learning.pyis unrun.
Blockers
- Unrun mandatory timing-learning gate (
docs/design-review.md:195-208) and pre-head A/B evidence (fdb10bb5vs29f2b5b):- Verified behavior/impact:
docs/design-review.md:201-206requires changes to timing estimation or exploration to be validated against the screening and 64-seed catalog inscripts/scheduling_sim/learning.pyand explicitly states "Do not diverge Helios from the simulator's qualified policy without updating and validating the rule across that catalog." Contrary to the assumption that the simulator cannot represent unmeasured timings,scripts/scheduling_sim/learning_policy.py:45, 235-273(initial_discovery = "native", documented atdocs/scheduling-theory.md:551-558) explicitly models Helios's unknown-first discovery; the newtests/test_scheduling_utility.py:422-442only exercises fixed-costUtilityScheduler, not unknown-cost interpolation. In addition, all SM120 A/B numbers were measured onfdb10bb5(beforeresize_prefill'sdeferred_prefillguard atpolicy.rs:1789-1792), the GB10 numbers are pre-#656 (571a4471), and no CI run is attached on head29f2b5b. - Concrete fix: Rebase onto current
main, run the CI verification suite (cargo test --locked --release,pytest,check.py,kani), re-run the SM120 served A/B on the exact head commit, and either model interpolated unmeasured-prefill exploration inscripts/scheduling_sim/learning_policy.pyand runscripts/scheduling_sim/learning.py(updatingdocs/scheduling-theory.md:551-558) or obtain explicit maintainer sign-off waiving the simulator gate for this rule.
- Verified behavior/impact:
Should Fix
- Reconcile
throughputpipelining behavior and PR description (helios/src/scheduler/policy.rs:35-37, 50-52,helios/src/scheduler.rs:989-998, 1180-1183,helios/src/scheduler/policy_tests.rs:7784-7826):- Verified behavior/impact:
PolicyConfig::throughput()zeroesdecode_age_pricebut keepsterminal_age_price: 1.0, andhas_active_age_priced_stream()returnstruefor any residentpolicy::terminal_cleanup(r)stream whenterminal_age_price > 0.0. Consequently,prefill_step_requires_feedback()drains non-terminalPrefillchunks even under--scheduler-policy throughputwhenever a terminal-cleanup (Snapshot) stream is resident. Bothdocs/scheduling-runtime-design.md:620-622and the PR's own testpolicy_tests.rs:7784-7826explicitly assert this, directly contradicting the PR description's claim "solo prefill andthroughput(0.0) keep two-frame pipelining" (and the reported28/24/19launch-parity check does not cover a resident terminal-cleanup stream). - Concrete fix: Retaining
terminal_age_price: 1.0inthroughput()is sensible for prompt KV-page reclamation, so update the PR description to state the terminal-cleanup exception (matchingdocs/scheduling-runtime-design.md:620-622) and verifythroughputlaunch parity with a resident terminal-cleanup stream — or, ifthroughputis meant to preserve pipelining unconditionally, adjust the barrier predicate and updatedocs/scheduling-runtime-design.md:620-622andpolicy_tests.rs:7784-7826accordingly.
- Verified behavior/impact:
- Fix false-pass test blindspot for
prefill_must_complete_terminally_from(helios/src/scheduler/policy_tests.rs:7738-7741,helios/src/scheduler.rs:955-987,helios/src/scheduler/service.rs:225-231):- Verified behavior/impact:
policy_tests.rs:7738-7741assertsservice_rates(short_prompt).0 == Nonefor a 256-token prompt (deferred_prefill = false,caps = [128..16384],term_caps = [256..16384],window = 128) with the comment "A short 256-token prompt must complete terminally (window = 128), so fallback does not apply." In fact,prefill_must_complete_terminally_from(scheduler.rs:957-987) checkscapacity = 128, getsresolve_prefill_kind_from == GraphKind::Prefill(scheduler.rs:896-901because128is absent fromterminal_prefill_cataloganddeferred_prefill == false), and returnsfalse. Theservice.rs:228fallback therefore does run onshort_prompt, and the assertion passes solely becausePrefill(128)was left unmeasured in the fixture (policy_tests.rs:7716) — meaning!self.prefill_must_complete_terminally_from(...)atservice.rs:228is completely unexercised by the test. - Concrete fix: Measure
Prefill(128)(or test adeferred_prefill = true256-token prompt / a catalog whereterm_capsstarts at128) soprefill_must_complete_terminally_fromactually evaluates totrueand provesservice.rs:228suppresses the fallback when no legalPrefillchunk exists; also clarify thescheduler.rs:955-956docstring to reflect that terminal-capablePrefillshapes absent fromterminal_prefill_catalogremain legal when!deferred_prefill.
- Verified behavior/impact:
Subtract / Simplify
- Deduplicate the 30-line unmeasured-prefill interpolation block (
helios/src/scheduler/policy.rs:999-1031and:1349-1381):continuation_candidateandadd_candidatecontain byte-identicalmatch predictor { Some(p) => ..., None => { nat_fit ... last_interp ... } }blocks differing only in variable names (following/width/requestvskind/capacity/r). Extract a single helper (e.g.,prefill_candidate_ns(...) -> Option<u64>) to delete ~25 duplicated lines and prevent drift between the two sites. - Keep
PrefillSlotPlanoff non-prefilladd_candidatearms (helios/src/scheduler/policy.rs:79-86, 420-456, 1323, 1524-1538):PrefillSlotPlanis only read inside prefill branches, yet it is threaded as a trailing&mut [PrefillSlotPlan; REQUEST_LANES]through every non-prefill arm ofcandidates()(Vision,Speculative,Init,Restore,Snapshot,Resume,Decode) and re-cachescutalready memoized byPlanningScope(checkpoints.rs:11-19). To preserve theplan()CPU win without plumbing it through non-prefill paths, consider a dedicatedadd_prefill_candidatehelper or passingOption<&mut ...>only where prefill slots are scored. - Delegate
prefill_catalog_for_terminaltoprefill_catalog(helios/src/scheduler/policy.rs:342-358):prefill_catalog_for_terminalrepeats the same three catalog branches asprefill_catalog; delegating viaself.prefill_catalog(if kind == GraphKind::ScoredPrefill { kind } else if terminal_only { GraphKind::TerminalPrefill } else { GraphKind::Prefill })removes the duplicate switch. - Consolidate peer comparison in
interpolated_prefill_duration(helios/src/scheduler/cost.rs:734-744, 759-772): Keeping the cheap pre-filter beforepred.predictmakes sense, but the(capacity, same_kind)ordering is written out four times (hi/lo× skip/accept); a tiny directional helper keeps the earlycontinuewhile cutting ~15 lines of repetitive branching.
Nits
verification/helios-lifecycle/check.py:528-605: The mutation's failure message at:605still mentions only "before capturing a boundary checkpoint"; noting non-terminal-catalog exclusion underdeferred_prefillwould make any future survivor easier to diagnose.helios/src/scheduler/cost.rs:1284-1511: The three new interpolation tests each re-declare identical ~30-linemake/step_for/timingclosures (also duplicated at:1092-1130); hoisting module-level#[cfg(test)]helpers would remove ~90 lines of test boilerplate.
Dropped on verification
- Upstream C&C Finding 2 ("feedback barrier is scheduler-global, not plan-scoped; solo
RequestPhase::Resumedrains its own prefill"): False. A request inRequestPhase::Resumehas already completed prefill (policy.rs:300-305,scheduler.rs:2865-2871) and can never execute aGraphKind::Prefillplan. Furthermore, aGraphKind::Prefillplan contains only prefill lane(s), so checking whether an age-priced stream exists outsideplan.lanesis identical tohas_active_age_priced_stream()— draining betweenPrefillchunks specifically because another resident slot is decoding/resuming/cleaning up is the intended mechanism of the barrier. - Upstream C&C Finding 3 ("undeclared widening of
resolve_prefill_kind_from, deadneeds_terminal, empty-catalog disagreement"): False.needs_terminalis used atscheduler.rs:903for all capacities interminal_prefill_catalog; returningGraphKind::TerminalPrefillfor capacities absent fromterminal_prefill_catalogwhendeferred_prefill == truecleanly excludes non-terminal-catalog capacities (declared in the PR's What, documented atdocs/scheduling-runtime-design.md:482-483, and tested atpolicy_tests.rs:7432-7650); andrequest.deferred_prefillcan never betruewhenterminal_prefill_catalogis empty (scheduler.rs:855-857, 1857, 2482, 2491). - Upstream C&C Finding 5 ("
interpolated_prefill_durationignoresstart_position, should scale floor bywork / capacityand restrictdecode_floortobatch == 1"): False / harmful fix.start_positionis evaluated viapred.predict(key.tokens, start_position)(cost.rs:755, with borrowed context slope at:750-754); interpolating full-capacity duration incapacityconservatively matches static CUDA-graph execution and avoids discounting padded shapes; anddecode_floortakesmin(estimate.nanos)(cost.rs:724), whereas restricting strictly tokey.batch == 1would break interpolation (None) on multi-decoder servers that have only observedbatch > 1decode graphs. - Upstream C&C Finding 6 (part: "
docs/scheduling-theory.md:74-120contradicts the new default-on behavior"): False.docs/scheduling-theory.md:78-132explicitly documents the fixed-value baseline without decode-age pricing, whiledocs/scheduling-utility.md:282-284already states that under decode-age pricing "a prefill shrinks its chunk size when decoders wait." (The real doc sync point isdocs/scheduling-theory.md:551-558forinitial_discovery = "native", folded into Blocker 1.) - Upstream S&S S1 (part: "
PrefillSlotPlanis under-keyed onkindand mispricesScoredPrefillagainstterminal_prefill_catalog"): False. Checkedpolicy.rs:304, 921, 1511: a request withprompt_logprobs == trueonly entersScoredPrefill(neverPrefill/TerminalPrefill), and a request withprompt_logprobs == falseonly entersPrefill/TerminalPrefill, for both of whichprefill_catalog_for_terminal(kind, terminal_only)returns the exact same slice. - Upstream S&S S3 ("replace
service.rs:224-231double scan with a singlescan_prefill(terminal_only && !allow_nonterminal)with identical semantics"): False. The rewrite is not semantically identical: whenTerminalPrefillis already measured at a lower rate than a smaller measuredPrefill, thetoken_rate == 0.0fallback preserves the terminal rate whereas S3's rewrite would replace it with the higher non-terminal rate and alterServicePricenormalization wheneverhas_active_age_priced_stream()toggles. - Upstream Dossier / Value Prop claim ("substantive semantic rebase against #655 rewriting
ActionCosts"): Overstated. Verified #655: it replacesfresh_durationwithmeasured_durationforSnapshotonly and does not alterActionCosts::entries,Estimate, or prefill freshness semantics; any rebase with #655 is minor/textual. - Upstream Dossier / C&C claim ("the simulator has no representation of an unmeasured cost"): False.
scripts/scheduling_sim/learning_policy.py:45, 235-273(initial_discovery = "native") explicitly models unmeasured graph costs and unknown-first discovery. - Upstream C&C claim ("feedback barrier landed after
fdb10bb5"): Unverified / misread. The PR's Limits state only thatresize_prefill'sdeferred_prefillguard and doc/test hardening landed afterfdb10bb5.