PR #661: helios/scheduler: explore smaller prefill chunks under active age-priced streams

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/91b803af-1180-49b0-a046-ba447648be72

Opened by a workflow run, Dec 1, 2026 2:18 PM EST.

Classify draft

Selected: performance, enhancement, area:scheduling

Threshold: 65%

Priority

Type

Area

Model

explore

Author: FujitsuPolycom (CONTRIBUTOR; repeat Helios scheduler contributor, 15 merged PRs in 180 days; Discord "Dooner") Motivation: Under the default balanced scheduler policy, a cold long prompt shares the GPU with running decoders and can stall them for hundreds of milliseconds to seconds, because the scheduler only knows the cost of the largest measured prefill shape and runs a whole tail as one terminal chunk. #661 lets small unmeasured prefill chunks be priced by interpolating measured timings and drains the two-frame transport between chunks so decoders can re-compete after each one. Scale: +1,785 / −95 lines in 10 files Proposal:

Full report · Notes

Classify intake

Selected: triage:design-review, performance, enhancement, area:scheduling

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:design-review

Value Proposition

Value Proposition — PR #661 (helios/scheduler: smaller prefill chunks under age-priced streams)

Charter alignment — right layer, wrong posture. Every change sits inside the Helios scheduler (cost.rs, policy.rs, scheduler.rs, service.rs): no model branches, no unsafe, no new CLI/PolicyConfig field, no ABI or graph-op change — squarely within "keep the runtime small and model-agnostic." It measures on charter target hardware (SM120 4× RTX PRO 6000, 4× GB10) with a served flare run A/B, satisfying "bring real evidence" in kind. Two frictions: the behaviour ships implicitly inside the default balanced preset (against "Be explicit… no magic defaults"), and it deliberately narrows #645 — prefill pipelining merged one day earlier by lukealonso, owner of helios/src, who has not engaged.

Novelty & status — genuinely additive. No merged commit on main fixes this; #663 (yatesdr) is the complementary inverse side and #660 a sibling by the same author, neither a canonical substitute. But it is one of three PRs from three authors on the same problem in ~3 days, and docs/scheduling-theory.md:74-76, 93-97, 119-120 — untouched — still asserts the opposite of the new behaviour.

Value vs cost — real audience, unproven artifact. Beneficiaries are anyone on stock balanced with cold multi-K prompts contending with decoders (lineage #485/#538). But the headline numbers describe code that would not merge: the A/B ran on fdb10bb5, not head 29f2b5bc, and the PR's own Limits admit it predates the resize_prefill deferred_prefill guard that changes which chunk sizes are legal. The claim "solo prefill and throughput (0.0) keep two-frame pipelining" is false whenever a terminal-cleanup stream is resident (policy.rs:50-52 leaves terminal_age_price: 1.0; scheduler.rs:1180-1183; test policy_tests.rs:7784-7826), so the 28/24/19 launch evidence does not cover that case. The mandatory simulator/learning.py gate (docs/design-review.md:195-208) is unrun, and the simulator has no representation of an unmeasured cost — so the interpolation rule has no qualification path. Precedent for the hazard is concrete: #538 → #550, 0.02 s → 15.3 s TTFT on GB10. Cost: ~+391/−79 prod LOC in four hot scheduler files, ~3:1 test:prod, plus a substantive rebase against #655, which rewrites the ActionCosts the interpolation reads.

Verdict: Worth it with changes

Direction is charter-legitimate and the author owns this thread; the blockers are evidence and documentation, not concept. Preconditions: (1) re-run the SM120 and GB10 A/B on head after rebasing past #655; (2) fix or restate the throughput claim and re-measure the terminal-cleanup case; (3) reconcile docs/scheduling-theory.md; (4) run learning.py/64-seed validation or get explicit maintainer sign-off that it is inapplicable; (5) disclose the resolve_prefill_kind_from widening (scheduler.rs:896-902); (6) coordinate explicitly with #660 and #663. If the head re-measurement does not reproduce the claimed deltas, this becomes Not worth it.

Full report Decide Value: yes (99%): This change is worth reviewing: it provides value to the project in line with its charter.

Subtraction and simplicity

Subtraction/Simplicity lens on PR #661 (head 29f2b5b). Verdict: the diff is lean where it counts — no flags, unsafe, env reads, new GraphKind, model branches, CLI/PolicyConfig fields or wire changes; interpolated_prefill_duration is a single self-contained pure function; docs, README and the check.py (not opened) mutation anchor move with it. The five findings are all deletions inside the new plumbing, not the scheduling policy.

  1. S1 (high) — PrefillSlotPlan / prefill_slot_state / prefill_slot_nat_fit (policy.rs:79-86, :420-456) is an ad-hoc cache that duplicates checkpoint_selection_cached and next_progress's get_or_insert_with (:756, :768-775), costs five signature changes (:937, :1323, :1486, :1520-1536, :1933), and is keyed on slot alone, ignoring the kind it is handed — so candidates()' shared array serves ScoredPrefill a terminal-catalog nat fit. Delete, don't repair: the inline form it replaced recomputed per (kind, slot) over a ≤12-entry catalog.
  2. S2 (high) — the last_interp block is copy-pasted verbatim, 17 lines twice (policy.rs:1006-1022, :1356-1372, differing only request→r, width→capacity), plus the duplicated ns == 0 → nat_fit → continue decision (:999-1031 vs :1349-1381). One unmeasured_prefill_ns helper; dropping the memo entirely saves 8 more lines.
  3. S3 (medium-high) — service_rates walks the whole prefill catalog twice for one boolean (service.rs:224-231); scan_prefill(false) subsumes scan_prefill(true), and token_rate is 0.0 there with nothing else setting it, so the == 0.0 gate exists only to avoid re-paying the first pass. −9 lines, one fewer catalog walk per admission.
  4. S4 (medium) — prefill_catalog_for_terminal (policy.rs:350-358) re-implements prefill_catalog's kind→catalog switch (:342-348) to accept a pre-resolved terminal_only bool; collapsing it also removes the reason for the natural_fit_prefill_capacity→…_for_terminal rename that churns six call sites.
  5. S5 (medium) — interpolated_prefill_duration states its peer-ordering rule four times: the is_some_and pre-filter (cost.rs:734-744) is exactly the negation of the is_none_or accept test (:762-772). One comparator and one pass, −15 lines.

Minor (not flagged): the three new cost.rs tests re-declare ~25-line closures on top of two pre-existing copies (~100 hoistable lines); policy_tests.rs:6975-7010 restates workloads.py:58-91.

Deliberately kept: terminal_prefill_window (scheduler.rs:657, :842-860) — the hoist requested in #538's review; has_active_age_priced_stream (:989-998); prefill_must_complete_terminally_from (:957-987) — follow-up, not a blocker. No structural AGENTS.md violation.

Open: whether S1's eager per-slot form covers TerminalPrefill's promotion of Prefill in phase_plan; whether last_interp is justified by any measurement (none in the PR); S5's pre-filter may exist to skip predictor work, in which case the reduce-over-pairs form is the safe rewrite.

Full report · Notes

Correctness and contracts

Reviewed PR #661 (head 29f2b5bc) for correctness, contracts and system-level consequences. Six findings, all verified in the changed files.

  1. Major — throughput does not keep pipelining, contradicting the PR text. policy.rs:50-52 zeroes only decode_age_price; terminal_age_price stays 1.0 (:37), has_active_age_priced_stream checks it (scheduler.rs:989-998), and the barrier returns true unconditionally (:1180-1183). The PR's own test asserts the drain (policy_tests.rs:7784-7826). The 28/24/19 launch evidence does not cover it.
  2. Major — the barrier is scheduler-global, not plan-scoped: prefill_step_requires_feedback (scheduler.rs:1180-1183) returns true for every Prefill plan before the per-lane check (:1191-1200), and scans all slots (:990), including the planned request's own Resume-phase slot. Reverses #645's two-frame pipelining on the default balanced path, unmeasured at head.
  3. Major — undeclared contract change: resolve_prefill_kind_from (scheduler.rs:896-902) forces TerminalPrefill for every capacity outside terminal_prefill_catalog under deferred_prefill, leaving needs_terminal dead, and disagreeing with the empty-catalog early return at :924.
  4. Minor — check.py:529-535 mutation source now removes the guard for all capacities but the message at :605 still describes the older && needs_terminal mechanism.
  5. Minor — the interpolation's floor endpoint ignores work/start_position (cost.rs:774-784) and decode_floor is unfiltered across batches (:715-726), systematically mis-pricing cut-limited deep-context chunks — the shapes the PR wants to explore.
  6. Minor — docs/scheduling-theory.md:93-97,119-120 untouched and contradicting; default-on with no opt-in (policy.rs:35-37), against the charter's "be explicit".

All headline numbers were measured on fdb10bb5, predating both the resize_prefill guard (policy.rs:1789-1797) and the barrier — the two changes most likely to move them; no measurement at head exists.

Verified sound: terminal_prefill_window caching (scheduler.rs:842-853), PrefillSlotPlan hoisting (policy.rs:79-86, :1006-1021), interpolation overflow/clamp arithmetic (cost.rs:779-785), service_rates gating (service.rs:224-231), and no unsafe/new GraphKind/wire/ABI/flag change.

Open: which numbers survive at head; whether any signed core has TERMINAL_PREFILL ⊂ PREFILL under deferred_prefill; #660/#655 interactions; the unrun learning.py (not opened) layer-2 gate.

Full report · Notes

Final review

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

Walkthrough

Pre-merge Checks

Blockers

  1. Unrun mandatory timing-learning gate (docs/design-review.md:195-208) and pre-head A/B evidence (fdb10bb5 vs 29f2b5b):
    • Verified behavior/impact: docs/design-review.md:201-206 requires changes to timing estimation or exploration to be validated against the screening and 64-seed catalog in scripts/scheduling_sim/learning.py and 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 at docs/scheduling-theory.md:551-558) explicitly models Helios's unknown-first discovery; the new tests/test_scheduling_utility.py:422-442 only exercises fixed-cost UtilityScheduler, not unknown-cost interpolation. In addition, all SM120 A/B numbers were measured on fdb10bb5 (before resize_prefill's deferred_prefill guard at policy.rs:1789-1792), the GB10 numbers are pre-#656 (571a4471), and no CI run is attached on head 29f2b5b.
    • 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 in scripts/scheduling_sim/learning_policy.py and run scripts/scheduling_sim/learning.py (updating docs/scheduling-theory.md:551-558) or obtain explicit maintainer sign-off waiving the simulator gate for this rule.

Should Fix

  1. Reconcile throughput pipelining 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() zeroes decode_age_price but keeps terminal_age_price: 1.0, and has_active_age_priced_stream() returns true for any resident policy::terminal_cleanup(r) stream when terminal_age_price > 0.0. Consequently, prefill_step_requires_feedback() drains non-terminal Prefill chunks even under --scheduler-policy throughput whenever a terminal-cleanup (Snapshot) stream is resident. Both docs/scheduling-runtime-design.md:620-622 and the PR's own test policy_tests.rs:7784-7826 explicitly assert this, directly contradicting the PR description's claim "solo prefill and throughput (0.0) keep two-frame pipelining" (and the reported 28/24/19 launch-parity check does not cover a resident terminal-cleanup stream).
    • Concrete fix: Retaining terminal_age_price: 1.0 in throughput() is sensible for prompt KV-page reclamation, so update the PR description to state the terminal-cleanup exception (matching docs/scheduling-runtime-design.md:620-622) and verify throughput launch parity with a resident terminal-cleanup stream — or, if throughput is meant to preserve pipelining unconditionally, adjust the barrier predicate and update docs/scheduling-runtime-design.md:620-622 and policy_tests.rs:7784-7826 accordingly.
  2. 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-7741 asserts service_rates(short_prompt).0 == None for 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) checks capacity = 128, gets resolve_prefill_kind_from == GraphKind::Prefill (scheduler.rs:896-901 because 128 is absent from terminal_prefill_catalog and deferred_prefill == false), and returns false. The service.rs:228 fallback therefore does run on short_prompt, and the assertion passes solely because Prefill(128) was left unmeasured in the fixture (policy_tests.rs:7716) — meaning !self.prefill_must_complete_terminally_from(...) at service.rs:228 is completely unexercised by the test.
    • Concrete fix: Measure Prefill(128) (or test a deferred_prefill = true 256-token prompt / a catalog where term_caps starts at 128) so prefill_must_complete_terminally_from actually evaluates to true and proves service.rs:228 suppresses the fallback when no legal Prefill chunk exists; also clarify the scheduler.rs:955-956 docstring to reflect that terminal-capable Prefill shapes absent from terminal_prefill_catalog remain legal when !deferred_prefill.

Subtract / Simplify

  1. Deduplicate the 30-line unmeasured-prefill interpolation block (helios/src/scheduler/policy.rs:999-1031 and :1349-1381): continuation_candidate and add_candidate contain byte-identical match predictor { Some(p) => ..., None => { nat_fit ... last_interp ... } } blocks differing only in variable names (following/width/request vs kind/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.
  2. Keep PrefillSlotPlan off non-prefill add_candidate arms (helios/src/scheduler/policy.rs:79-86, 420-456, 1323, 1524-1538): PrefillSlotPlan is only read inside prefill branches, yet it is threaded as a trailing &mut [PrefillSlotPlan; REQUEST_LANES] through every non-prefill arm of candidates() (Vision, Speculative, Init, Restore, Snapshot, Resume, Decode) and re-caches cut already memoized by PlanningScope (checkpoints.rs:11-19). To preserve the plan() CPU win without plumbing it through non-prefill paths, consider a dedicated add_prefill_candidate helper or passing Option<&mut ...> only where prefill slots are scored.
  3. Delegate prefill_catalog_for_terminal to prefill_catalog (helios/src/scheduler/policy.rs:342-358): prefill_catalog_for_terminal repeats the same three catalog branches as prefill_catalog; delegating via self.prefill_catalog(if kind == GraphKind::ScoredPrefill { kind } else if terminal_only { GraphKind::TerminalPrefill } else { GraphKind::Prefill }) removes the duplicate switch.
  4. Consolidate peer comparison in interpolated_prefill_duration (helios/src/scheduler/cost.rs:734-744, 759-772): Keeping the cheap pre-filter before pred.predict makes sense, but the (capacity, same_kind) ordering is written out four times (hi/lo × skip/accept); a tiny directional helper keeps the early continue while cutting ~15 lines of repetitive branching.

Nits

Dropped on verification

Full report

Classify triage

Selected: (none)

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found

explore

Author: FujitsuPolycom (CONTRIBUTOR; repeat Helios scheduler contributor; Discord "Dooner") Motivation: Under the default balanced policy Helios cannot run prefill and decode in one graph on this model, so cold long prompts occupy the GPU in chunks and decoders sit idle, producing visible output stalls. The PR lets the scheduler try smaller, unmeasured prefill chunk sizes and hand the GPU back to waiting decoders between them. Scale: +1949 / −106 lines in 11 files (production +397/−78 in 4 files; the rest is tests and docs) Proposal:

Full report · Notes

Classify intake

Selected: performance, area:scheduling

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

No label changes

Subtraction and simplicity

Subtraction/simplicity review of #661 (head c588d610 on 1fbcc3c9). Verdict: the +397/−78 production diff is otherwise lean — no new flags, knobs, env vars, unsafe, per-model branches, or ABI change — but five real simplifications exist, two of them copy-paste.

  1. 33-line interpolated-exploration block pasted verbatim twice — policy.rs:1110-1142 and :1462-1494, identical modulo kind/capacity/r; extract one explore_prefill_ns(...) -> Option<u64> and both sites collapse to one line (~66 → ~16 lines).
  2. The last_interp memo that rides along with it (policy.rs:1081, :1443 and the match/match plumbing) is speculative micro-optimisation over an O(#graphs) integer scan; it disappears with the extraction.
  3. "unmeasured ⇒ PlanOrigin::Discovery" duplicated at policy.rs:1784-1789 and :2071-2077; one helper using the existing costs.duration_key(..).is_none_or(|ns| ns == 0) (cost.rs:873) replaces the observation(..).and_then(..) tuple dance (cost.rs:904-908 proves equivalence).
  4. interpolated_prefill_duration hand-inverts its own tie-break — a skip filter at cost.rs:734-744 and the real selection at :762-772 encode the same predicate twice; derive one better(..) predicate.
  5. service.rs:298-328 scans the prefill catalog twice (scan_prefill(terminal_only) then scan_prefill(false)); one pass tracking both maxima removes the skip_nonterminal parameter and halves the extra per-call scan.
  6. Medium/low: ~92 lines of byte-identical test fixtures triplicated in cost.rs (:1284, :1359, :1478) where make_prefill helpers already exist; prefill_catalog/prefill_catalog_for_terminal (policy.rs:363-379) are the same three-way selector twice; PrefillSlotPlan (:89-96) memoises a cut that checkpoint_selections (checkpoints.rs:410-428) already caches; the runtime-design doc states the exploration rule twice (:486-498 vs :665-668).

Open: none of these are correctness bugs; terminal_prefill_window and the two guard helpers are genuine simplifications, not additions to the subtraction surface.

Full report · Notes

Correctness and contracts

Reviewed PR #661 (head c588d61 on main 1fbcc3c9) for correctness, contracts and system-level consequences. The scheduler mechanics are largely sound (single-threaded, no new locks/unsafe, no underflow, discovery plans still drain), but four issues block merge:

  1. Undeclared model-contract reversal (Blocker) — scheduler.rs:901-906 now returns TerminalPrefill for every capacity absent from terminal_prefill_catalog whenever request.deferred_prefill, dropping needs_terminal; helios/model-contract.md:182-186 still promises PREFILL fallback. verification/helios-lifecycle/check.py:527-535 now enshrines the new rule.
  2. Two-frame prefill pipeline disabled by any terminal-cleanup stream (Major) — scheduler.rs:1187-1190 drains unconditionally when has_active_age_priced_stream(), which includes terminal_cleanup requests at terminal_age_price=1.0, so throughput() (policy.rs:50-52) no longer pipelines. The PR body still claims "(throughput pipelines)"; its own test policy_tests.rs:8291-8333 documents the exception.
  3. Service-rate scope discontinuity (Major) — service.rs:321-328 only rescans non-terminal prefills when token_rate == 0.0, yet non-terminal chunks are now legal, so ServicePrice jumps when the fallback flips, contradicting docs/scheduling-runtime-design.md:240-251.
  4. Optimistic interpolated estimate (Major) — cost.rs:720-777 uses the min decode cost over any batch as the capacity-0 rung with no KV-context term; against the PR's own GB10 table estimates are 15–31% low (47.9 vs 65 ms at 256), biasing ValueRate and the capacity <= nat_fit gate toward the smallest chunks and explaining the body's own "+1.8% makespan".

Also Major: nat_fit is cached per slot without a kind key (policy.rs:89-96, :518-537) while one plan array is shared across the Prefill and TerminalPrefill passes (:1599-1634), so the terminal exploration gate uses the ordinary prefill catalog's natural fit. Evidence remains head-stale (body Limits), and the mandatory 64-seed simulator gate is unrun on a simulator that cannot model the changed mechanisms.

Open: whether the deferred_prefill widening is intentional (no contract version change declared) and whether any served A/B exists for c588d610.

Full report · Notes

Re-review

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

Walkthrough

Pre-merge Checks

Blockers

  1. 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 body Evidence/Limits):
    • Verified behavior/impact: docs/design-review.md:201-206 mandates that "Changes to timing estimation or funded refresh require running the screening and 64-seed validation catalog in scripts/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 under age_price > 0.0 (helios/src/scheduler/policy.rs:1110-1142, 1462-1494). PR Evidence reports only learning.py smoke+screen, which run seeds (0, 1) and TRAINING_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 only Graph.prefill_capacity and Graph.decode_capacity, already present in scripts/scheduling_sim/model.py:24-30, independent of TERMINAL_PREFILL or two-frame pipelining); docs/scheduling-theory.md:558-565 merely documents the divergence. Separately, per the PR body's own Limits, all SM120 flare run A/B numbers ran on fdb10bb5/82f68ea8 before the resize_prefill/PlanOrigin::Discovery guards and the 1fbcc3c9 rebase (and GB10 numbers predate #656), with no CI result readable for c588d61.
    • Fix: (1) Either model the interpolated unmeasured pure-prefill discovery rule in scripts/scheduling_sim/learning_policy.py and pass learning.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-c32 and T_50C) on c588d61 (post-guards, post-rebase) and confirm green GitHub Actions CI on the mergeable head.

Should Fix

  1. service_rates gates feasible non-terminal Prefill pricing on token_rate == 0.0, understating feasible rate once any TerminalPrefill shape is measured (helios/src/scheduler/service.rs:297-328):
    • Verified behavior/impact: Selection (helios/src/scheduler/policy.rs:511-512) computes terminal_only via prefill_requires_terminal_completion_for_age, so under active age-priced streams non-terminal Prefill chunks are feasible whenever !prefill_must_complete_terminally_from(...). By contrast, service_rates (service.rs:297-328) computes terminal_only = self.prefill_requires_terminal_completion_from(...), skips GraphKind::Prefill on the first scan, and only rescans with skip_nonterminal = false if token_rate == 0.0. As soon as any covering TerminalPrefill shape is measured (e.g., a slower padded TerminalPrefill(16384) for an 8192-token prompt), scan_prefill(true) returns a positive rate and suppresses a faster measured feasible Prefill(4096) chunk. When Prefill(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 violating docs/scheduling-runtime-design.md:247-249.
    • Fix (subtractive—also removes the double catalog scan): Replace the scan_prefill closure and token_rate == 0.0 rescan at helios/src/scheduler/service.rs:297-328 with a single pass using the same feasible-set condition:
      let 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)
      };
      
      followed by the single for &capacity in catalog loop skipping kind == GraphKind::Prefill only when terminal_only. Add a unit test measuring both a slower padded TerminalPrefill and a faster feasible Prefill under an active decoder and asserting service_rates returns the faster feasible rate.
  2. PR description's (throughput pipelines) claim omits the terminal_cleanup drain 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() zeroes decode_age_price but keeps terminal_age_price: 1.0, and has_active_age_priced_stream() returns true whenever a finishing request is in policy::terminal_cleanup(r)—which intentionally drains non-terminal Prefill so retirement Snapshots are not delayed behind two-frame pipelined prefills (already tested at policy_tests.rs:8291-8314 and accurately documented in helios/README.md:285-287). However, the PR body still claims unqualified (throughput pipelines) from Round 1.
    • Fix: Update the PR body to state accurately that throughput keeps two-frame Prefill pipelining across active decode/resume streams and drains only when a finishing terminal_cleanup stream is resident (terminal_age_price > 0.0).

Subtract / Simplify

  1. Extract the duplicated 33-line interpolated-exploration block and delete the speculative last_interp memo (helios/src/scheduler/policy.rs:1081, 1110-1142 and :1443, 1462-1494):
    • continuation_candidate and add_candidate contain byte-identical 33-line exploration blocks, including a 16-line last_interp cache that only hits when two distinct prefilling slots share identical (work, scheduled_consumed) for the same capacity while scanning a small self.entries table with no allocation. Extract a single explore_prefill_ns(...) -> Option<u64> helper on RequestScheduler without last_interp (~65 lines removed) so the core exploration gate cannot drift between the two call sites.
  2. Unify the duplicated PlanOrigin::Discovery predicate (helios/src/scheduler/policy.rs:1784-1792 and :2071-2081):
    • select_plan and phase_plan duplicate duration_ns == 0 || self.costs.observation(key).and_then(|(_, observed, _)| observed).is_none(), which is equivalent to duration_ns == 0 || self.costs.duration_key(key).is_none_or(|ns| ns == 0) (helios/src/scheduler/cost.rs:873-875, 904-908). Extract a single plan_origin(&self, candidate: Candidate) -> PlanOrigin helper.
  3. Deduplicate the inverted peer-selection predicate in interpolated_prefill_duration (helios/src/scheduler/cost.rs:734-744 vs :759-772):
    • The early-skip filter at :734-744 hand-inverts the same (tokens, same_kind) tie-break applied at :759-772. Hoist one comparison predicate (or drop the redundant cur_same && !same_kind early skip) so the peer-ranking rule lives in one place.
  4. Promote the triplicated test closures in helios/src/scheduler/cost.rs (:1284-1317, :1359-1392, :1478-1511):
    • make, step_for, and timing are pasted byte-identically across all three new unit tests (~92 lines). Promote them to module-local #[cfg(test)] helpers to save ~60 lines.

Nits

Dropped on verification

Full report

Classify triage

Selected: triage:validation

Threshold: 65%

Triage

Apply labels

Applied: +triage:validation, -triage:design-review decide malicious: all_clear (100%): No malicious content found

explore

Author: FujitsuPolycom (CONTRIBUTOR; repeat Helios scheduler contributor; Discord "Dooner") Motivation: On the shipped balanced policy, Helios has no mixed prefill/decode graph, so a cold long prompt gets run as one big prefill step that blocks every decoding user for up to a second. This PR lets the scheduler try small prefill chunks it has never measured, paced so decoders re-compete between chunks. Scale: +2,778 / −186 lines in 15 files Proposal:

Full report · Notes

Subtraction and simplicity

Subtraction/Simplicity/Conventions review of PR #661 @ 3d868f84: no reject-level convention violation, and the diff is leaner than typical — it deletes a duplicated ~60-line prefill branch into add_prefill_candidate, caches terminal_prefill_window, and adds no CLI flag, no PolicyConfig field, no unsafe.

Five cuts, four sharing one cause (the age-priced path was added alongside the terminal logic rather than through it):

  1. policy.rs:517-543 — the last_interp memo is dead weight: declared per capacity (:1092, :1429) so it can only hit across slots with identical (work, scheduled_consumed); costs a hand-spelled tuple type three times, a &mut parameter threaded through two callers, and the sole reason for the #[allow(clippy::too_many_arguments)]. Replace with a direct if let Some(ns) = self.costs.interpolated_prefill_duration(...) { return Some(ns); }; drop the parameter from prefill_candidate_ns, add_prefill_candidate, continuation_candidate.
  2. Three near-identical catalog walks — scheduler.rs:964-994, policy.rs:409-434, policy.rs:451-459 — same work/kind/skip-Prefill shape, one differing acceptance test. Collapse to one helper taking terminal_only + an impl Fn predicate; shrinks each caller to 3-4 lines.
  3. The age-price terminal dispatch is spelled twice (scheduler.rs:1007-1022 keys on age_price > 0.0 with prefill_cursor; service.rs:297-301 re-implements it on has_active_age_priced_stream() with consumed_tokens) — widen the helper to (request, start, cut, age_price) and call it from both. Relatedly has_active_age_priced_stream() scans all slots yet is called per request inside the rates fold (policy.rs:750-757), plus :503 and scheduler.rs:1188; compute once per pass, as the PR already did for terminal_prefill_window.
  4. Delete prefill_catalog_for_terminal (policy.rs:371-374, uses GraphKind as a bool, 3 call sites) and add ActionCosts::is_measured beside is_fresh to replace the tuple re-destructuring in is_unmeasured_candidate (policy.rs:545-548).
  5. docs/scheduling-theory.md:562-573 restates the rule already in docs/scheduling-runtime-design.md:494-513 with a cross-link; replace with two sentences. policy.rs:462-478 is a 25-line rationale-as-history doc comment.

Open: no planner-timing evidence for any memo/scan claim; whether the nat_fit cross-kind memo (policy.rs:526-530 vs shared prefill_plans at :1537) is a real defect is a Correctness call; no real signed core with TERMINAL_PREFILL ⊂ PREFILL is identified.

Full report · Notes

Correctness and contracts

Two substantive findings, both in touched Rust production code and both uncovered by tests.

  1. Major — helios/src/scheduler.rs:901-907 drops needs_terminal from the deferred-prefill branch, so any capacity absent from terminal_prefill_catalog resolves to TerminalPrefill while deferred_prefill is set. On a subset catalog that capacity has no terminal shape, so policy.rs:1435/:1427 produce no candidate at all, and service.rs:307-319 loses that capacity's measured token rate (ServicePrice fairness normalizer shifts silently). It contradicts helios/model-contract.md:182-186, diverges from the Python reference (ignition/direct/scheduler.py:300-312), is policy-independent so --scheduler-policy throughput does not opt out, and verification/helios-lifecycle/check.py:527-535 now enshrines the widened line under a message describing the old rule.

  2. Major risk — helios/src/scheduler/policy.rs:531-542 evaluates interpolation before the natural-fit Some(0) marker with guard capacity <= nat, so the nat-fit capacity loses the duration_ns == 0 precedence of ValueRate::compare (utility.rs:167-172) exactly when age pricing is active. If the estimate cannot outbid a decoder the shape is never dispatched, never measured, and (per the new drain at scheduler.rs:1187-1190) cannot pipeline either — #538's discovery invariant no longer holds under balanced. No test covers nat-fit precedence with age_price > 0.0.

Minor: docs/scheduling-theory.md:74-76 and :121-122 still state the opposite; docs/scheduling-utility.md lacks the two new credit rules; the body's opt-out line overstates; SLO regressions (89.0→81.6 %, 94.8→89.3 %, n=1) unexplained.

Sound: interpolation u128 math and clamp, last_interp memo, is_unmeasured_candidate, resize_prefill cap, cached terminal_prefill_window, wait-clock and interior-cut-credit guards, no new unsafe/ABI/flag, platform parity.

Open: is the widening deliberate and does any real signed core have a strict-subset terminal catalog? Should the Python mirror and check.py follow? Where is the 64-seed --configs file? No independent A/B reproduction; cargo-kani not run; GB10 not re-measured.

Full report · Notes

Re-review

Recommendation: Ready To Merge

Head 3d868f8 resolves every Round 2 blocker and should-fix item cleanly: interpolated unmeasured pure-prefill discovery is now modeled and validated across the mandatory 64-seed scripts/scheduling_sim/learning.py --preset validate catalog, RequestScheduler::service_rates derives terminal_only in a single pass aligned with candidate selection, the throughput drain wording is corrected, and fresh SM120 TP4 flare run A/B and archive test/TLA+/mutation runs are reported on the submitted tree. Direct verification of the core scheduler changes—including the two new balanced single-graph wait/credit fixes—confirms sound single-threaded state transitions, memory safety, and contract compliance with no new regressions. Confirm GitHub Actions CI is green on 3d868f8 before merging.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

None.

Subtract / Simplify

  1. Drop the caller-owned last_interp memo (helios/src/scheduler/policy.rs:517-543, 1092, 1118, 1429, 1437): last_interp: Option<(usize, u64, Option<u64>)> is declared inside each (kind, capacity) loop, so it only hits when two distinct active prefill slots happen to share the exact same (work, scheduled_consumed) for the same unmeasured capacity. Removing it eliminates the repeated opaque 3-tuple, &mut threading, and #[allow(clippy::too_many_arguments)] on prefill_candidate_ns (dropping it from 8 to 7 non-self arguments).
  2. Unify age-priced terminal completion dispatch and hoist has_active_age_priced_stream() (helios/src/scheduler.rs:1007-1022, helios/src/scheduler/service.rs:297-301, helios/src/scheduler/policy.rs:750-757): service_rates re-spells prefill_requires_terminal_completion_for_age with start = consumed_tokens and scans all active slots via has_active_age_priced_stream() once per request inside lane_values's slot array construction (O(slots^2)). Parameterizing the helper over (request, start, cut, active_age_priced) and computing has_active_age_priced_stream() once in lane_values removes both the duplicated predicate and the repeated slot scans.

Nits

  1. Sync docs/scheduling-utility.md:306-320: The "First-output waiting age against active decoders" section still describes frac = work / initial_prefill and anchor-split wait preservation without mentioning the two new balanced single-graph rules (preserves_first_output_wait across capture-free non-terminal chunks and reconciled-cut first_output_value credit), which are currently documented only in docs/scheduling-runtime-design.md:281-289.
  2. Clarify the PR body's Opt-out: --scheduler-policy throughput shorthand: As already noted in What, throughput still drains non-terminal Prefill when a terminal_cleanup stream is resident (terminal_age_price > 0.0), and the deferred_prefill non-terminal-catalog exclusion (scheduler.rs:901-907) is policy-independent.

Dropped on verification

Full report

Classify triage

Selected: triage:validation

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: yes (84%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.

Pre Test Report

Hardware Test Plan — PR #661 helios/scheduler: explore smaller prefill chunks under active age-priced streams

Head under test: 3d868f84c5118b40a9ee6112f1d551ecef3d32c4 (15 files, +2778/−186). Base for the reported A/B: main = 1fbcc3c9. Latest Autobot re-review of this head: Ready To Merge, Blockers: None (earlier Changes-Requested reviews target superseded heads 29f2b5b / c588d61).

The plan below is deliberately small: one model, one machine, ~1 h of GPU time for the decisive gate, plus one optional 30-minute arm. It is built around one fact the PR body does not state plainly — this change is a no-op unless a decoding (or terminal-cleanup) request is resident while a prompt with an unmeasured smaller prefill shape is being scheduled. Most of the wasted-GPU-time risk here is running a trial where the code path cannot execute, or measuring a warm process where the discovery it is meant to test has already happened.


1. What must be true for #661 to do anything (the "canary" conditions)

Verified in the changed code; every trial below is designed so all six hold:

# Condition Source
1 --scheduler-policy balanced (the default): decode_age_price = 0.1, terminal_age_price = 1.0 helios/src/scheduler/policy.rs:29-45
2 An age-priced stream is resident: a slot in RequestPhase::Decode/Resume while decode_age_price > 0, or any terminal_cleanup (Snapshot) slot while terminal_age_price > 0 scheduler.rs:996-1005
3 The prefill candidate is unmeasured and capacity <= nat_fit policy.rs:531-541
4 Interpolation has a positive estimate: a measured sibling, or a measured larger peer, or a measured Decode/Speculative/Resume floor cost.rs:695-776 (floor at :715-726)
5 Catalog has several capacities: prefill_capacities(chunk) — for chunk = 4096 → 128, 256, 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096 scheduler.rs:83-92
6 For the deferred_prefill / terminal-window paths: a non-empty TERMINAL_PREFILL catalog. Without one, resolve_prefill_kind_from always returns Prefill and the deferred_prefill widening is unreachable scheduler.rs:827-845, :901-907

Consequences for scheduling the test:

Two traps that would silently void a run (both are real gaps in scripts/benchmark_scheduler.py):


2. Machine and model selection

Use cn5, not cn7.

Need cn5 cn7
GPU class the PR measured on (4× RTX PRO 6000, SM120) ✅ 4× RTX PRO 6000 Blackwell ❌
Multi-GPU TP for one core ✅ up to TP4 (48 CPUs / 125 GiB) ❌ 1 GPU
Model present nvidia/GLM-5.3-Flash-NVFP4, local-inference-lab/GLM-5.3-Flash-NVFP4 nvidia/GLM-5.3-Flash-FP4-Local (GLM also present)
Fits 16 GiB scratch? Verify with flare inspect before committing n/a

3. Preconditions to check before taking any measurement (≈10–15 min, mostly CPU)

Run these and keep the outputs in the report; each one can invalidate a whole arm if skipped.

  1. Core has a TERMINAL_PREFILL catalog — flare inspect CORE --graphs (docs/cli-design.md:1622, table at flare-cli/src/inspect.rs:1350-1372 lists kind, batch, tokens, Time per graph).
    • If empty: conditions 6 is false. Drop the terminal-specific arms, and note that only the interoperated-discovery and drain arms were exercised.
    • If present: record the exact terminal capacities and the derived tail window (largest PREFILL capacity absent from the terminal catalog, scheduler.rs:847-857) — the arm in §4C depends on it.
  2. prefill_chunk_size is not already minimal. If prefill_chunk_size is 128 or 256 the catalog has ~2–3 entries and there is nothing to explore. Set --prefill-chunk-size 4096 (the PR's configuration) so the 128…4096 catalog exists.
  3. Baseline binary is main at 1fbcc3c9, not the PR base. 5d53040e (the declared base) is behind main; the reported A/B compared against 1fbcc3c9. Use 1fbcc3c9 for the A/B or the deltas are not comparable to the claim.
  4. CI on 3d868f84 is green (cargo test --locked --release 7 crates, pytest 839, check.py (not opened) --mutations) — an engine failure mid-run otherwise costs the whole GPU slot. cargo-kani was not run by the author.
  5. Free-GPU/no-contention: cn5 gives 48 CPUs for 4 GPUs; confirm no other job on the GPUs and pin clocks via the documented path if the host supports it (--lock-gpu-clocks).

4. The test arms (ordered; stop as soon as the decisive question is answered)

Common server flags (the PR's, with --scheduler-policy varied per arm):

flare run CORE --gpus 0,1,2,3 --scheduler-policy balanced --max-concurrency 32 \
  --mtp-draft-tokens 7 --mtp-adaptive-verification --mtp-max-verification-token-budget 128 \
  --mtp-adaptive-verification-alpha 1.0 --embedding-table-cache-size 84GiB \
  --kv-cache-limit memory --prefix-cache-memory 0 --prefill-chunk-size 4096

(--kv-cache-limit, --prefix-cache-memory, --max-concurrency verified at flare-cli/src/cli.rs:1148, 1179, 1231; --embedding-table-cache-size 84GiB is tight against 125 GiB RAM — if it fails to load, take the default rather than spending GPU time tuning the flag, and note the deviation.)

Arm A — Decisive: cold long prefills against steady decoders (the only arm the merge decision needs)

Purpose: prove the change actually executes on hardware and moves the metric the PR claims (decode stalls), not merely that throughput is preserved.

Metrics — and the post-processing you must write, because the harness does not do it:

Pass/fail reading (write this down before running, so the result is not post-hoc):

Arm B — The PR's own reported regression must be explained, not buried

The PR's table shows SLO dropping in all three mixes (91.1 → 89.4 %, 94.8 → 89.3 %, 89.0 → 81.6 %) and 4 → 7 client-side 45 s drain cutoffs under KV saturation on cold-heavy-mix, plus a worse cold-burst peak gap (277.4 → 433.7 ms). Arm A's SLO/throughput columns already cover this — do not spend a separate GPU slot re-deriving it; just report the SLO delta and drain-cutoff count explicitly alongside the stall win, and say whether Arm A reproduced the regression or not. This is the one place where a "no regression" result would be genuinely new information for the review.

Arm C — Optional (only if the TERMINAL_PREFILL catalog exists): throughput deliberately does not keep pipelining

Purpose: close the review's open item #2 in a way no test currently does. PolicyConfig::throughput() zeroes decode_age_price but leaves terminal_age_price = 1.0 (policy.rs:50-52), and has_active_age_priced_stream() returns true for a resident terminal_cleanup slot (scheduler.rs:996-1005), so prefill_step_requires_feedback() drains even under --scheduler-policy throughput (scheduler.rs:1187-1190) — contradicting the older PR-body wording and matching the corrected wording and docs/scheduling-runtime-design.md:620-622.

Do not spend GPU time on


5. What this plan can and cannot establish

Can: whether the new exploration executes at all on real SM120 hardware; whether it reduces decode stalls and/or SLO on a GLM-5.3 NVFP4 TP4 mixed load; whether balanced's new drain barrier and the throughput terminal-cleanup exception behave as documented; whether the interpolation's one-shot discovery converges (from reason="discovery" tapering across trials).

Cannot:

Minimum decisive budget: preparation on CPU-only early (once), then Arm A only: 4 interleaved arms × 3 trials × 60 s ≈ 15 min GPU + 4 server restarts. Add Arm C (~10 min) only if the TERMINAL_PREFILL catalog exists and someone wants the throughput wording closed.


6. Review findings that bear on the test plan

These are from the case file and my own reading of the changed code; none was introduced by the plan.

  1. Reported evidence is author-reported and outside the repo. Workloads live in FujitsuPolycom/tokbench v0.4.0; there is no in-repo harness for the mixed-c32 / cold-heavy-mix shapes, and the learning.py (not opened) --configs file is not committed. The hardware run in §4A is therefore also the first in-repo, reproducible datapoint for this change.
  2. The PR's own numbers contain an unexplained regression (SLO down in all three mixes; 4 → 7 45 s drain cutoffs). Arm A measures it in passing; it should be surfaced in the merge decision, not averaged away.
  3. Two undeclared behavior surfaces that hardware testing cannot adjudicate and that should stay as review items: the service_rates repricing (service.rs:297-301) changes ServicePrice normalization for default balanced users, and the deferred_prefill kind widening (scheduler.rs:901-907) is policy-independent. Both are documented in docs/scheduling-runtime-design.md but were not in the original PR description.
  4. A false-pass unit test remains in the shape described earlier in this PR's history (prefill_must_complete_terminally_from never evaluated as true in the short-prompt case). Not testable on hardware; worth a one-line note to the author so the next revision's test actually exercises service.rs's guard.
  5. Observability gap worth filing separately: PREFILL/TERMINAL_PREFILL/SCORED_PREFILL collapse into kind="prefill" in /metrics, and the per-graph trace is dashboard-only. Any future scheduler performance PR will hit the same wall — this is a cheap follow-up that would have made this plan half as long.
  6. Simulator divergence is documented, not silent (docs/scheduling-theory.md:558-565 (not opened)) and initial_discovery = "interpolated" is modeled in scripts/scheduling_sim/learning_policy.py (not opened) — my reading agrees with the final re-review that the Round-1 simulator blocker is resolved; docs/scheduling-theory.md:74-76 (not opened)/:93-97 still read as pre-#661 statements about the no-decode case and are defensible.

Bottom line: on the available hardware, #661 is testable cheaply and decisively on cn5 with GLM-5.3-Flash-NVFP4 TP4, provided the run is cold (no prefill warmup), restarted between arms, carries a resident decoder or finishing stream, uses a multi-capacity --prefill-chunk-size 4096 catalog, and is gated on flare_scheduler_executions_total{reason="discovery"} increasing. Without that canary the numbers cannot be attributed to this PR at all. cn7 should be skipped with the stated reason.

Full report · Notes

Discord Test Request

Discord post (ready to paste)

## Recommendation: Test
High confidence that this needs testing — low confidence in the claimed win until it is

## Hardware Required
- cn5 (not cn7): 4x RTX PRO 6000 Blackwell, 4 GPUs at TP4, 48 CPUs
- `nvidia/GLM-5.3-Flash-NVFP4` — the PR's DeepSeek-V4.1-Flash isn't on cn5, so this is a transfer check, not a reproduction
- `--prefill-chunk-size 4096` (gives the 128…4096 capacity catalog) + a cold server per arm — no prefill warmup, restart between arms

## Justification
- Nothing in-repo shows this code path ever runs: we must gate on `flare_scheduler_executions_total{reason="discovery"}` going up. If it stays 0 the change never fired and no latency number means anything.
- The PR's own table shows SLO dropping in all 3 mixes (91.1→89.4, 94.8→89.3, 89.0→81.6%) and 4→7 45s drain cutoffs. We need to know if that reproduces before merge, not average it away.

## Estimated Time to Complete
~15 min of GPU time (4 interleaved arms x 3 trials x 60s + restarts), ~45–60 min wall clock with one-time model prep on CPU. Optional +10 min for the `throughput` arm.

What I verified against the repo (so the post is not just relaying the packet)

Judgement calls baked into the post

Notes worth carrying into the test report (not in the post)

Caveat on process: I ran out of turns before writing scratchpad entries, so the citations above live only in this report; the goal (a template-exact post backed by verified claims) is met, but nothing was persisted to the scratchpad.

Full report