Recommendation: Changes Requested
The technical core of PR #645—completion-attributed burst coalescing, stratified fill/context prefill cost modeling, two-frame nonterminal GraphKind::Prefill pipelining, and mixed/terminal catalog fixes—is well-scoped, model-agnostic, ABI-compatible, and thoroughly tested on CPU. However, two mandatory verification gates from the charter and docs/design-review.md remain unmet (the runnable 64-seed learning.py --preset validate sweep was skipped, and no served-workload A/B baseline against main backs the performance claims or #485 fix), and two verified cost-model edge cases need fixes before merge (loss of the checkpoint O(1) stride fast path in the non-constant regime, and an uncapped post-TTL u / u_max upward extrapolation).
Merge Risk
Level: Medium
- Global unflagged scheduler/cost-model change:
ActionCosts::get(helios/src/scheduler/cost.rs:679-691) routes all single-lane prefill steps throughPrefillCostModel, andcoalescing_prefill_log_bonus(helios/src/scheduler/policy.rs:444-621) is enabled by default (coalescing_horizon_tokens: 64.0), affecting prefill durations, admission ordering, and checkpoint pricing for every prefill-capable core. - Two-frame pipelining across scheduler and all four executors: Widening
Decode | SpeculativetoDecode | Speculative | Prefill(helios/src/scheduler.rs:1132-1143,helios/src/model.rs:349-354,helios/src/execution/{transport,threaded,parallel}.rs,helios/src/execution/threaded/protocol.rs) is consistent and verified against device-side sticky error status (ignition/components/sampling.py:367-409) andcheck.py --mutations, though live TP2 serving was only checked single-arm on SM120. - Same-day semantic overlap with open PR #644: Shares 7 files (
policy.rs,policy_tests.rs,service.rs,utility.rs,docs/scheduling-runtime-design.md,scripts/scheduling_sim/utility.py,tests/test_scheduling_utility.py), includingLaneValueand delivery-fairness units (policy.rs:582-586uses inverse delivery ratestream_deliv_rate, whereas#644switches delivery fairness to duration-independent served shares_i).
Walkthrough
- Completion-attributed burst coalescing: Adds
PolicyConfig::coalescing_horizon_tokens(default64.0, validated nonnegative athelios/src/scheduler/policy.rs:222-234),LaneValue::prefill_finish(helios/src/scheduler/utility.rs:78-93), andcoalescing_prefill_log_bonus(helios/src/scheduler/policy.rs:444-621), mirrored inscripts/scheduling_sim/utility.py:12-246with burst workloads inscripts/scheduling_sim/workloads.py:50-53and tests intests/test_scheduling_utility.py:335-376andhelios/src/scheduler/policy_tests.rs:6494-6545. - Stratified fill-ratio and KV-context prefill cost model (
#485): AddsPrefillPredictor,PrefillBucket, andPrefillCostModelinhelios/src/scheduler/cost.rs:66-379(6 strata of 9-sample medians, 3-parameter relative-error-weighted NNLS, narrow-regime upward bound), wired throughActionCosts::{prefill_duration, prefill_entry, prefill_predictor, get, observe}(cost.rs:529-587, 679-724) intopolicy.rs,service.rs:167-193, andcheckpoints.rs:168-341. - Two-frame pipelining for consecutive nonterminal
GraphKind::Prefill: Addsprefill_cursor/_fromhelpers andprefill_step_requires_feedbackinhelios/src/scheduler.rs:854-944, 1109-1143, widenseligible(policy.rs:311-322),model.rs:349-354(ConsumedTokens | SnapshotConsumedTokensguard), and all four executor layers (transport.rs:967-968, 1020-1021,threaded.rs:872-876,threaded/protocol.rs:32-37,parallel.rs:262-264), and mirrors the_fromrefactor inverification/helios-lifecycle/check.py:544-605. - Mixed-graph curve and terminal-catalog fixes: Applies
powered_curve+forecast_tokensinhelios/src/scheduler/learning.rs:11-13,service.rs:250-265, andpolicy.rs:808-817(with the!prefillguard), and switches unmeasured prefill discovery toeffective_prefill_catalog(policy.rs:341-354, 729, 966, 1256). - Docs & tests: Updates
docs/scheduling-runtime-design.md:198-207, 403-423, 567-577, updateshelios/src/server/runtime/phase_tests.rs:1311-1318, and adds unit/lifecycle tests incost.rs:848-943,policy_tests.rs:1420-1483, 6494-6640, andthreaded/protocol_tests.rs:360-370.
Pre-merge Checks
- [PASS] Security / malicious screen: No credential handling, shell/network additions, unsafe code, or prompt-injection attempts in PR text or diff.
- [WARN] Charter & value fit: Strong architectural alignment (shared runtime layer, no per-model branches, no ABI/Protobuf changes, closes
#485), but fails Charter#210/docs/design-review.md:109-111(no served-workload A/B baseline overmain) and skips a mandatory runnable CPU gate (docs/design-review.md:201-206, 247-251). Also closes#485with an affine NNLS design rather than@voipmonitor's measured logarithmic-band prototype without re-running#485's long-context workload. - [WARN] Related / duplicate / conflict check: Direct extension of merged
#619,#538,#550,#459; non-duplicate, but open PR#644(same author, same day) overlaps 7 files and changesLaneValueand delivery-fairness units—merge order and formula reconciliation need to be settled. - [WARN] Tests & verification evidence: Crate suites (
eos,selene,selene-manager,helios,flare,flare-cli),pytest(644 passed), andcheck.py --mutations(all 8 TLA+ models) are reported passing and CI is green on05cccb6, and all new tests are properly isolated and exercise production entry points. However,learning.py --preset validate(64-seed sweep) was not run,8 × 8,192burst numbers have no checked-in workload, and live GPU measurements lack amaincontrol.
Blockers
-
Mandatory 64-seed timing-learning validation sweep was not run (
docs/design-review.md:201-206, 247-251;helios/src/scheduler/cost.rs,scripts/scheduling_sim/utility.py).docs/design-review.md:201-206requires changes to timing estimation or scheduling utility rules to be validated against the screening and 64-seed validation catalog inscripts/scheduling_sim/learning.py, and lines247-251explicitly specify that "Disclosure does not excuse skipping runnable CPU checks... Leaving an applicable crate test, simulator sweep, TLA+ conformance run, or Kani proof unrun blocks commit and PR acceptance; noting it as a limitation does not make the omission acceptable."- The PR ran only
--preset smokeand disclosed that the 64-seedlearning.py --preset validatesweep was not run. - Fix: Run the full 64-seed
scripts/scheduling_sim/learning.py --preset validatesweep (with--configsperlearning.py:95-100) and include the pass/summary results in the PR evidence.
-
No served-workload A/B baseline against
mainbacks the performance overhaul or#485fix (Charter#210;docs/design-review.md:109-111;scripts/scheduling_sim/workloads.py:50-53).- All burst speedup claims (
+14.6%throughput,-42.6%max TTFT) come fromscripts/scheduling_simon a synthetic catalog (workloads.py:50-53), and the claimed8 × 8,192multi-chunk burst (+12.8%,1492 → 1056 ms) has no checked-in workload inworkloads.pyto reproduce it. - The live 2× SM120 GPU checks (
46,509-token prompt TTFT andB=4/B=8bursts) are single-arm with nomaincontrol, and#485's long-context (64k–128k) launch-drift scenario is not re-measured on GPU (unlike#485's own DS4.1 TP4 A/B table). - Fix: Provide at least one equivalent
mainvs. PR#645liveflare runA/B measurement on an exported core covering burst coalescing / pipelined long-prompt prefill and long-context chunk stability (#485), and either check in the8 × 8,192simulator workload or remove that row from the claimed results. Confirm with@voipmonitorthat the affine 3-bucket NNLS fit resolves#485's 64k–128k launch drift.
- All burst speedup claims (
Should Fix
-
Checkpoint O(1) stride fast path is disabled whenever any prefill capacity has a non-constant predictor (
helios/src/scheduler/checkpoints.rs:222-232,helios/src/scheduler/cost.rs:298-302).interval_prefill_nscomputesstrideviaentry.non_terminal?.constant_ns()?(checkpoints.rs:225), andconstant_nanosisSomeonly whenbest_theta[1] == 0.0 && best_theta[2] == 0.0 && u_max >= 0.75(cost.rs:298-302).- In the exact variable-fill / KV-depth-dependent regime
#485targets (any single capacity with positive fill slopetheta_1 > 0, context slopetheta_2 > 0, oru_max < 0.75),try_foldshort-circuitsstridetoNoneand every call tointerval_prefill_nsfalls back to the chunk-by-chunk catalog loop (checkpoints.rs:270-339). WhileENTRY_LOOKUPSstays bounded byprefill_catalog_costs, on long agentic prompts with hundreds of message boundaries (such as the 150k-token / 999-boundary workload incheckpoints.rs:1273-1325) this turns each boundary evaluation from O(1) into O((end - start) / chunk_size * catalog.len()), contradicting the PR description's claim that the O(1) stride path is preserved. - Fix: Either support a closed-form arithmetic-series stride for full-chunk runs under the affine predictor
theta_0 + theta_1 * 1 + theta_2 * (start + i * cap) / 4096(or precompute prefix costs across intervals once percheckpoint_selection_cached), and add a budget test incheckpoints.rscovering a non-constantPrefillCostModelon the 150k/999-boundary prompt.
-
Uncapped post-TTL upward extrapolation
t_at_umax * (u / u_max)can severely over-price a large prefill graph after a single short tail (helios/src/scheduler/cost.rs:113-115, 914-923).- When
u_max < 0.75 && (u_max - u_min) < 0.15 && u > u_max,PrefillPredictor::predictscales linearly fromt_at_umaxbyu / u_maxwith no upper cap. Incost.rs:914-923, a single post-TTL 128-token tail at1.51 sinside capacity3584(u = 1/28) predicts>= 42.28 sfor a full chunk (5.4×the test's own7.81 sfull-chunk cost). - If a large graph (for example
4096, or the soleTerminalPrefillcapacity) sees a single 64- or 128-token tail right after the 30 s TTL reset, fixed launch/overhead cost gets multiplied by up to64×. While a single full-fill observation infill_bin = 1(cost.rs:205, 213) clears the guard immediately, the inflated full-chunk estimate suppressesValueRate::new(utility.rs:124-134) so ordinary selection can lock out the large graph in favor of smaller capacities until a rate-limited funded refresh probe fires (and if selected,expected_finish_ns/retained_nsare inflated by the same multiple). - Fix: Cap the upward extrapolation multiple (e.g., bound the slope or cap
u / u_max, or retain/fallback cleanly across TTL resets for unobserved fill strata) and assert both a lower and reasonable upper bound incost.rs:919-923.
- When
Subtract / Simplify
-
Collapse
ActionCosts::prefill_durationontoprefill_entry(helios/src/scheduler/cost.rs:529-583).prefill_duration(529-557) duplicatesprefill_entry'sKeyliteral,self.entry(key)?, andestimate.nanos == 0check verbatim. Replacing lines536-556withself.prefill_entry(kind, capacity).map(|p| p.map_or(0, |p| p.predict(work, start_position)))removes ~20 lines with identical semantics and the same singleENTRY_LOOKUPScall.
-
Delete dead
is_prefill()branches left behind inadd_candidateandcontinuation_candidate(helios/src/scheduler/policy.rs:1076-1095, 1335-1376).add_candidatenow returns early atpolicy.rs:1248-1307wheneverkind.is_prefill(), making thekind.is_prefill()branches atpolicy.rs:1342-1347and1366-1376unreachable dead code. Likewise,continuation_candidatereturns early atpolicy.rs:933-1010forfollowing.is_prefill(), making the!mixedprefill block atpolicy.rs:1080-1092dead code. Delete both dead blocks.
-
Single-source the pipelinable
GraphKindpredicate and simplifyresize_prefill/prefill_step_requires_feedback(helios/src/execution/manifest.rs:84-101,helios/src/scheduler.rs:1109-1143,helios/src/scheduler/policy.rs:1688-1694).- The
Decode | Speculative | Prefillmatch is now duplicated 8 times acrossscheduler.rs:1136,policy.rs:1290, 1711,transport.rs:968, 1021,threaded.rs:876,parallel.rs:263, andthreaded/protocol.rs:35. AddingGraphKind::pipelines(self) -> boolonGraphKindinhelios/src/execution/manifest.rs:84-101(alongsideis_prefillandsamples) keeps all layers in lockstep. - In
policy.rs:1688-1694,resize_prefillhand-rollseffective_prefill_catalog(policy.rs:341-354) with a redundant!request.prompt_logprobscheck (already insideprefill_requires_terminal_completion_fromatscheduler.rs:915); replace those 6 lines withself.effective_prefill_catalog(request, request.prefill_kind(), cut). - In
scheduler.rs:1109-1112,if plan.kind != GraphKind::Prefill { return true; }insideprefill_step_requires_feedbackis unreachable because its only caller (scheduler.rs:1137) already checksplan.kind == GraphKind::Prefill; fold lines1136-1137into onematch plan.kindand remove the dead guard.
- The
-
Unify
PrefillBucketwithReplayTimes(helios/src/scheduler/cost.rs:133-169vs389-413) and avoid double-scanningself.slotsincoalescing_prefill_log_bonus(helios/src/scheduler/policy.rs:453-482, 592-619).PrefillBucketre-implementsReplayTimes's exact 9-slot ring and(lo + hi + 1) / 2median rounding in the same file; a small generic ring helper removes the duplicate median implementation.coalescing_prefill_log_bonusscansself.slotstwice with overlapping filters and recomputes the identicalpost_prefillformula (policy.rs:475-477and605-607); collecting(slot, post_prefill)into a stack-allocated[(usize, usize); REQUEST_LANES]array in the first pass removes the second scan.
Nits
- Defaults table & README sync: Add
coalescing_horizon_tokens(64.0) to thePolicyConfigtable indocs/scheduling-runtime-design.md:651-661and the defaults paragraph inhelios/README.md:478-482(both currently stop atadaptive_verification_alpha). - Unused simulator workloads:
burst_four,burst_four_low, andburst_eight_lowinscripts/scheduling_sim/workloads.py:50-53are not referenced bytests/test_scheduling_utility.py; either exercise them or keep only the used workloads. - Reconcile
#644delivery-fairness units on rebase: When rebasing with#644, checkpolicy.rs:582-586(delivery_fairness / (stream_deliv_rate * mean_out)), whose units assume pre-#644inverse-frequency delivery pricing rather than#644's served-share pricing. - Document
retained_nssemantics for prefill:Estimate::nanos/SubmittedTiming.retained_ns(cost.rs:217, 717,scheduler.rs:1146, 2389) now stores the fitted full-fill, zero-context prediction rather than a raw rolling median; a brief comment onPrefillCostModel::observeorselected_costavoids telemetry confusion.
Dropped on verification
- Dropped upstream F3 ("re-priced prefill durations collide with
window_remaining()and cause short-tail pipelines to self-drain", citingphase_tests.rs:1311-1318): Verifiedhelios/src/server/runtime/phase_tests.rs:1291-1318directly—the test feeds an actual GPU timing of200 ns(gpu_ns = [Some(100), Some(200)]) for a 13-token tail on a graph seeded at1000 ns. Predicting195..=210 nsis accurate (fixing the old600 nsaverage over-estimate), not a3×under-estimate; short tails are normally terminal (already feedback barriers), andwindow_remaining()stopping queueing pastexpected_finish_nsis the intended backpressure contract (helios/README.md:483-484). - Dropped upstream F4's "missing CLI/config flag breaks sibling parity" claim: Verified
PolicyConfig(helios/src/scheduler/policy.rs:15-27) vs.helios/src/server/config.rs:305-330—6 of the 10 pre-existingPolicyConfigcoefficients (output_token_value,token_fairness,delivery_fairness,decode_age_price,adaptation_ms,estimate_ttl_ns) likewise have no CLI flag or server-config key. Reduced to a Nit for the missing docs table/README row. - Dropped upstream F5 ("value-side
scheduled_consumedvs.service_ratesconsumed_tokenscursor mismatch"): Intentional design stated in the PR description; terminal frame 2 requires feedback and cannot commit while frame 1 is in flight (available_plandrains atpolicy.rs:1665), socommit()never normalizes a terminal chunk against staleconsumed_tokens, and the 1-token difference during drain-decision scoring is negligible. - Dropped upstream F6 ("undeclared narrowing of the Mixed decode branch at
policy.rs:808"): Explicitly declared in the PR description ("Mixed decode rate/continuation paths bypassedpowered_curve/forecast_tokensand lacked a!prefillguard"), matchesservice.rs:250, and a Helios request cannot holdgenerated_tokens > 0before prompt completion. - Dropped upstream F9 ("two-frame prefill widens per-lane failure blast radius / breaks counter validation on frame 2"): Verified the device kernel in
ignition/components/sampling.py:354-410—Status + slotandError + slotare sticky in device memory across consecutive frames (identical to two-frameDecode/Speculativepipelining), and nonterminal prefill hassample_enabled == 0. - Dropped F2's sub-claim that the upward bound "stays in force until 9 full-fill samples displace the medians": Verified
helios/src/scheduler/cost.rs:205, 213-214, 227-242—a single full-fill sample lands infill_bin = 1(strata[3]) and immediately setsu_max = 1.0 >= 0.75. (The core uncapped post-TTL extrapolation risk survives as Should Fix #2.) - Dropped Subtraction #3's claim that
policy.rs:1335-1338is a live divergence bug and corrected its hallucinated file path:helios/src/scheduler/manifest.rs(not opened) does not exist (GraphKindlives inhelios/src/execution/manifest.rs:69-101), andpolicy.rs:1335-1338is only reached when!kind.is_prefill()becauseadd_candidatereturns early atpolicy.rs:1248-1307. Replaced with the verified dead-code subtraction (policy.rs:1080-1092, 1342-1347, 1366-1376). - Dropped Subtraction #6's suggestion that
Candidate::feedbackis completely unread before overwrite: Verified viahelios/src/scheduler.rs:554, 1135thatScheduledPlanDerefs toScheduledStep, soplan_requires_feedback(&plan)OR-splan.requires_feedback(initialized fromcandidate.feedbackatpolicy.rs:1793)—making the PR's updates atpolicy.rs:1290, 1710live rather than dead.