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
- Default-on hot-path behavior change: Activates implicitly under the shipped
balancedpolicy (decode_age_price = 0.1,helios/src/scheduler/policy.rs:35), unlocking smaller unmeasured pure-prefill chunks via GPU-interpolated one-shot discovery and draining non-terminalPrefillsteps whenever an active age-priced stream is present (narrowing #645's two-frame prefill pipelining on the same cold-discovery surface where #538 → #550 previously caused a GB10 regression). - Sound safety & concurrency invariants:
RequestSchedulerremains single-threaded with zerounsafe, no new CLI flags/ABI/graph-op changes, soundu128interpolation clamping (cost.rs:779-785), and a sounddeferred_prefillsafety guard (scheduler.rs:901-907) preventing non-terminal-catalog full-statePrefillgraphs from running over skipped continuation state. - Residual pricing & validation risk: Under
service.rs:321-328, measuring any coveringTerminalPrefillsuppresses faster feasible non-terminalPrefillrates inservice_rates, distortingServicePriceshare accounting during active-stream chunking; and all headline SM120/GB10 benchmarks predate the newresize_prefill/Discoveryguards and1fbcc3c9rebase.
Walkthrough
helios/src/scheduler/cost.rs(:695-786,:1279-1577): AddsActionCosts::interpolated_prefill_durationto estimate unmeasuredPrefill/TerminalPrefill/ScoredPrefillcapacities from a measured same-capacity sibling (Prefill↔TerminalPrefill;ScoredPrefillisolated) or linear interpolation between a smaller measured peer (or fastest measuredDecode/Speculative/Resumefloor) and a strictly larger measured peer, with safeu128arithmetic and non-monotonic clamping; adds 3 isolated unit tests.helios/src/scheduler.rs(:662, 757, 808, 843, 847-866, 901-907, 964-1022, 1187-1190): Cachesterminal_prefill_windowon catalog updates; tightensresolve_prefill_kind_fromsorequest.deferred_prefillexcludes capacities absent fromterminal_prefill_catalogeven when!needs_terminal; addsprefill_must_complete_terminally_from,has_active_age_priced_stream, andprefill_requires_terminal_completion_for_age; drains non-terminalPrefillsteps inprefill_step_requires_feedbackwhile an active age-priced stream exists.helios/src/scheduler/policy.rs(:89-96, 371-379, 414-439, 501-537, 1081-1142, 1443-1494, 1599, 1784-1792, 1813-1815, 1863-1865, 1906-1920, 2052, 2071-2081): Replaceseffective_prefill_catalogwithprefill_catalog_for_terminal; hoists per-slot prefill state intoPrefillSlotPlan; enables interpolatedValueRatescoring for unmeasured pure-prefill capacities<= nat_fitunderage_price > 0.0while classifying them asPlanOrigin::Discoveryinselect_plan()andphase_plan(); keepsresize_prefillinsideterminal_prefill_catalogunderdeferred_prefilland caps age-priced resizes atcandidate.capacity.helios/src/scheduler/service.rs(:297-328): Adds atoken_rate == 0.0fallback rescanning non-terminalPrefillcapacities whenterminal_only && has_active_age_priced_stream() && !prefill_must_complete_terminally_from(...).- Tests, simulator workload, lifecycle check & docs (
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,docs/scheduling-theory.md,helios/README.md): Adds 9 isolated Rust scheduler tests (GB10 storm, continuation/add-candidate oversized-sibling guards,resize_prefillcaps,deferred_prefillexclusion,service_ratesfallback,has_active_age_priced_streambranches,Discoveryorigin preservation), synthetic GB10 simulator workload/test, updatedcheck.py:527-535mutation target, and updated runtime/README/theory docs.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure scheduler cost-estimation and selection arithmetic, tests, and docs; no
unsafe, I/O, FFI, parsing, privilege, or untrusted-input surface added. - [WARN] Charter & value fit: Right runtime layer, model-agnostic, zero new flags/ABI, and solves a real
balancedstall problem; however, it ships default-on without meeting the mandatory 64-seed timing-estimation simulator gate (docs/design-review.md:195-208), and the PR body's(throughputpipelines)shorthand omits theterminal_cleanupdrain exception. - [PASS] Related / duplicate / conflict check: Cleanly rebased on
main1fbcc3c9(post-#663/#667), additive over #645, and orthogonal to open #655/#660 (minor rebase coordination incost.rs/docs/only). - [WARN] Tests & verification evidence: Unit/contract tests are isolated and exercise real scheduler paths, and local archive verification is detailed; however, GitHub Actions CI is not reported on
c588d61, all SM120/GB10 A/B numbers predate theresize_prefill/Discoveryguards and1fbcc3c9rebase, andlearning.py --preset validate(64 held-out seeds) is unrun.
Blockers
- 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 bodyEvidence/Limits):- Verified behavior/impact:
docs/design-review.md:201-206mandates that "Changes to timing estimation or funded refresh require running the screening and 64-seed validation catalog inscripts/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 underage_price > 0.0(helios/src/scheduler/policy.rs:1110-1142, 1462-1494). PR Evidence reports onlylearning.pysmoke+screen, which run seeds(0, 1)andTRAINING_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 onlyGraph.prefill_capacityandGraph.decode_capacity, already present inscripts/scheduling_sim/model.py:24-30, independent ofTERMINAL_PREFILLor two-frame pipelining);docs/scheduling-theory.md:558-565merely documents the divergence. Separately, per the PR body's own Limits, all SM120flare runA/B numbers ran onfdb10bb5/82f68ea8before theresize_prefill/PlanOrigin::Discoveryguards and the1fbcc3c9rebase (and GB10 numbers predate #656), with no CI result readable forc588d61. - Fix: (1) Either model the interpolated unmeasured pure-prefill discovery rule in
scripts/scheduling_sim/learning_policy.pyand passlearning.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-c32andT_50C) onc588d61(post-guards, post-rebase) and confirm green GitHub Actions CI on the mergeable head.
- Verified behavior/impact:
Should Fix
service_ratesgates feasible non-terminalPrefillpricing ontoken_rate == 0.0, understating feasible rate once anyTerminalPrefillshape is measured (helios/src/scheduler/service.rs:297-328):- Verified behavior/impact: Selection (
helios/src/scheduler/policy.rs:511-512) computesterminal_onlyviaprefill_requires_terminal_completion_for_age, so under active age-priced streams non-terminalPrefillchunks are feasible whenever!prefill_must_complete_terminally_from(...). By contrast,service_rates(service.rs:297-328) computesterminal_only = self.prefill_requires_terminal_completion_from(...), skipsGraphKind::Prefillon the first scan, and only rescans withskip_nonterminal = falseiftoken_rate == 0.0. As soon as any coveringTerminalPrefillshape is measured (e.g., a slower paddedTerminalPrefill(16384)for an 8192-token prompt),scan_prefill(true)returns a positive rate and suppresses a faster measured feasiblePrefill(4096)chunk. WhenPrefill(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 violatingdocs/scheduling-runtime-design.md:247-249. - Fix (subtractive—also removes the double catalog scan): Replace the
scan_prefillclosure andtoken_rate == 0.0rescan athelios/src/scheduler/service.rs:297-328with a single pass using the same feasible-set condition:
followed by the singlelet 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) };for &capacity in catalogloop skippingkind == GraphKind::Prefillonly whenterminal_only. Add a unit test measuring both a slower paddedTerminalPrefilland a faster feasiblePrefillunder an active decoder and assertingservice_ratesreturns the faster feasible rate.
- Verified behavior/impact: Selection (
- PR description's
(throughputpipelines)claim omits theterminal_cleanupdrain 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()zeroesdecode_age_pricebut keepsterminal_age_price: 1.0, andhas_active_age_priced_stream()returnstruewhenever a finishing request is inpolicy::terminal_cleanup(r)—which intentionally drains non-terminalPrefillso retirementSnapshots are not delayed behind two-frame pipelined prefills (already tested atpolicy_tests.rs:8291-8314and accurately documented inhelios/README.md:285-287). However, the PR body still claims unqualified(throughputpipelines)from Round 1. - Fix: Update the PR body to state accurately that
throughputkeeps two-framePrefillpipelining across active decode/resume streams and drains only when a finishingterminal_cleanupstream is resident (terminal_age_price > 0.0).
- Verified behavior/impact:
Subtract / Simplify
- Extract the duplicated 33-line interpolated-exploration block and delete the speculative
last_interpmemo (helios/src/scheduler/policy.rs:1081, 1110-1142and:1443, 1462-1494):continuation_candidateandadd_candidatecontain byte-identical 33-line exploration blocks, including a 16-linelast_interpcache that only hits when two distinct prefilling slots share identical(work, scheduled_consumed)for the same capacity while scanning a smallself.entriestable with no allocation. Extract a singleexplore_prefill_ns(...) -> Option<u64>helper onRequestSchedulerwithoutlast_interp(~65 lines removed) so the core exploration gate cannot drift between the two call sites.
- Unify the duplicated
PlanOrigin::Discoverypredicate (helios/src/scheduler/policy.rs:1784-1792and:2071-2081):select_planandphase_planduplicateduration_ns == 0 || self.costs.observation(key).and_then(|(_, observed, _)| observed).is_none(), which is equivalent toduration_ns == 0 || self.costs.duration_key(key).is_none_or(|ns| ns == 0)(helios/src/scheduler/cost.rs:873-875, 904-908). Extract a singleplan_origin(&self, candidate: Candidate) -> PlanOriginhelper.
- Deduplicate the inverted peer-selection predicate in
interpolated_prefill_duration(helios/src/scheduler/cost.rs:734-744vs:759-772):- The early-skip filter at
:734-744hand-inverts the same(tokens, same_kind)tie-break applied at:759-772. Hoist one comparison predicate (or drop the redundantcur_same && !same_kindearly skip) so the peer-ranking rule lives in one place.
- The early-skip filter at
- Promote the triplicated test closures in
helios/src/scheduler/cost.rs(:1284-1317,:1359-1392,:1478-1511):make,step_for, andtimingare pasted byte-identically across all three new unit tests (~92 lines). Promote them to module-local#[cfg(test)]helpers to save ~60 lines.
Nits
docs/scheduling-theory.md:74-76, 93-97vs:558-565: The new paragraph at:558-565explains native Helios's interpolated cold discovery, while:93-97states the steady-state measured objective ("No duration ceiling, prefill size preference, or breadth-before-depth rule precedes it"). Adding a brief parenthetical pointer at:93-97to the cold-discovery rules inscheduling-runtime-design.mdprevents readers from seeing an apparent contradiction.docs/scheduling-runtime-design.md:486-505vs:665-668::665-668restates the exploration limit already specified normatively at:486-505; trimming:665-668to a cross-reference reduces doc-drift surface.helios/src/scheduler/policy.rs:363-379:prefill_catalog(kind)can delegate directly toself.prefill_catalog_for_terminal(kind, kind == GraphKind::TerminalPrefill).
Dropped on verification
- Upstream F6 (Blocker) — "
deferred_prefillkind resolution contradictshelios/model-contract.md:182-186and forces terminal rebuild on every mid-prompt chunk": Dropped as false. Verified athelios/src/scheduler.rs:901-912, 2489-2499, 2859-2861,helios/model-contract.md:173-186, andpolicy_tests.rs:7939-8156:binary_search(&capacity).is_err()only matches capacities absent fromterminal_prefill_catalog(e.g.,128), whereas mid-prompt chunks insideterminal_prefill_catalog(256..=16384) still fall through toif needs_terminal { TerminalPrefill } else { Prefill }and run as non-terminalPrefill. Whendeferred_prefillis true, earlier chunks skipped trailing continuation layers, so running a full-statePrefill(128)graph would read incomplete continuation state without clearingdeferred_prefill; excluding128whiledeferred_prefill == trueis a necessary safety guard (models withoutTERMINAL_PREFILL, and requests with!deferred_prefill, still fall back toPREFILL). - Upstream F5 (Major) — "
PrefillSlotPlan::nat_fitaliases acrossPrefillandTerminalPrefill, breakingTERMINAL_PREFILLexploration": Dropped as false. Verified athelios/src/scheduler/policy.rs:371-379, 414-439, 518-537, 1611-1627:prefill_catalog_for_terminal(kind, plan.terminal_only)checks onlykind == GraphKind::ScoredPrefill, returning the exact same catalog forPrefillandTerminalPrefill, andnatural_fit_prefill_capacity_for_terminaldoes not takekind. A single request slot can never simultaneously matchScoredPrefillandPrefill/TerminalPrefill, andnat_fitis the smallest capacity maximizing single-step work (not catalog minimum128). - Upstream F4 (Major) — "
interpolated_prefill_durationhas wrong-batch decode floor, missing KV-context term, and causes steady-state extra chunks/stalls": Dropped as false / mischaracterized. Verified athelios/src/scheduler/cost.rs:668, 695-786, 797andpolicy.rs:1462-1494: (1).minacrossDecode | Speculative | Resumebatches selects the fastest measured single-token forward pass (larger batches are slower); (2) KV-context work scales linearly withcapacity * start_position(cost.rs:797), which is0atcapacity = 0, so interpolating from(0, decode_floor)to(c_hi, t_hi(start_position))already scales the context term proportionally; (3) retaining measured durations after TTL expiry matchesprefill_entry(cost.rs:668, PR #285/#655); and (4) interpolation is a one-shot cold-discovery prior (PlanOrigin::Discovery) replaced permanently after a single GPU execution, not a steady-state cost. - Upstream A7 / Test Blindspot — "
policy_tests.rs:7728-7810(continuation_candidate_excludes_oversized_padded_unmeasured_prefill) cannot test the prefill guard because it callsphase_plan(GraphKind::Init, ...)": Dropped as false. Verified atpolicy.rs:1075-1179, 1297-1305, 1565-1575, 2058-2060andpolicy_tests.rs:7790-7809:phase_plan(GraphKind::Init, Some(prompt))invokesadd_candidate(Init)→continuation_candidate, which loops overPrefillandTerminalPrefillcapacities (:1297-1302) and directly exercises thenat_fit.is_some_and(|nat| width <= nat)guard atpolicy.rs:1116. The twinadd_candidateguard (policy.rs:1468) is separately covered bypolicy_tests.rs:8337-8423. - Upstream F2 sub-claims — "require an age-priced lane inside the
Prefillplan" & "diverginghas_active_age_priced_streamvs scaledage_price": Dropped as invalid / low-signal. APrefillplan contains only the prefilling request (batch 1), never the waiting decoding/cleanup streams, so checking lanes insideplanwould defeat draining; and any raw-vs-scaledage_pricedivergence is strictly conservative (drains rather than risking stalls). - Upstream S8 — "delete
PrefillSlotPlanbecausecutis cached incheckpoint_selections": Dropped as low-signal.PrefillSlotPlanis a small stackCopyarray avoiding repeatedRefCellborrows andHashMaplookups across up to 23 capacities × active lanes while co-cachingterminal_onlyandnat_fit. - Upstream dossier stale rebase items ("behind
main/ needs rebase onto #663"): Dropped as stale. Headc588d61is already rebased cleanly ontomain1fbcc3c9.