Case file — PR #663 helios/scheduler: price first-output waiting age on incumbent decode rounds
Author yatesdr (COLLABORATOR, Discord "D-Rock"), branch feat/knob-free-first-output-scheduling → main, head a5c3697, base a3c80e19, opened 2026-12-01 19:40, updated 21:07 (+ one author comment at 21:20). 11 files, +511/−40. Labels area:scheduling / enhancement / performance. No reviews, no review comments, no linked issue. CI on head passed. https://github.com/NVIDIA/hyperflare-inference/pull/663
Key findings
- It changes a shipped default, with no opt-out. The credit is gated on
PolicyConfig::decode_age_price(helios/src/scheduler/policy.rs:35 =0.1inDefault, :50-52 =0.0inthroughput()).balancedis the documented default policy (docs/cli-design.md:683), so every default deployment gets the new scheduling behavior and there is no knob, flag or metric to see or disable it. The competing design #654 is opt-in with a knob defaulting to 0.0; #663 is strictly broader in reach. - It contradicts an explicit documented invariant that it does not touch. docs/scheduling-theory.md:850-853 (unchanged by this PR) states: "First-token waiting has no independent age penalty: prompt work competes by its useful progress and token-service price." #663 adds exactly such a penalty into the default policy and documents it only in docs/scheduling-utility.md:287-318 and docs/scheduling-runtime-design.md:255-284. The same line was raised as a blocker against #654 by the bot review there; #654 at least had a switch. Also left un-updated: helios/README.md selection prose (:356-380, PolicyConfig defaults :478-489), docs/cli-design.md
balanceddescription (:683-709), and docs/scheduling-oracle.md:69-74/206-207, whoseprefill_wait_price(c_first) /Fmachinery is the reference solver for precisely the term being added — #663 never evaluates against it. - The simulator "mirror" is not a mirror, and the two most novel design points are Rust-only. scripts/scheduling_sim has no checkpoint/anchor modeling at all (grep "checkpoint|snapshot" in that tree returns only unrelated hits). So anchor-cut wait-clock preservation and the readmission
last_output_nsclamp — points 3's second half and 4 of the formulation, and the whole "double stall" motivation — are covered only by Rust unit tests. The Python term also differs from Rust: it usesnow_ms - view.last_service_mswith nofirst_output_wait_ns, multiplies byview.weight(Rust has no weight factor; harmless only because supplied workloads use weight 1, docs/scheduling-oracle.md:44-45), and uses a differentinitial_prefilldenominator (scripts/scheduling_sim/utility.py:158-162, 251-259, 266-270 vs helios/src/scheduler/utility.rs:99-110, policy.rs:729-752). The "21/21 exact trace identity at age 0" and "zero regressions at 0.1" claims therefore cover the credit term, not the anchor/readmission behavior. - Two existing regression tests were weakened, which the description states only as "updated the burst-coalescing isolation tests". tests/test_scheduling_utility.py:363-395 replaced relative guarantees (
coal_ttft < base_ttft*0.85,end_ms < base*0.95,sub <= base_sub//2) with absolute ceilings (coal_ttft <= 600.0,coal_sub <= 2) and moved the relative assertions to a throughput-policy comparison; the Rust twin in policy_tests.rs:6791+ gained astaggeredparameter for the same reason. Reasonable (a simultaneous 4-request burst no longer isolates coalescing once waiting prompts are age-priced), but it is a real reduction in assertion strength in the existing suite that a reviewer should see named. - Formal coverage is a re-run of unmodified models. verification/helios-lifecycle/check.py (not opened) is not among the 11 changed files (unlike #660, which does modify it), so the 10/10 TLC / 8/8 trace / 594,065-transition numbers re-verify unchanged models. The new scheduler accounting state
first_output_wait_nshas no lifecycle fixture added. - Same change already existed as #662 (draft, opened 19:27 under
flare-autobot, closed 19:40: "Closing duplicate draft opened under the wrong account; reopening under yatesdr"). #662's "Open items before marking ready" list contained three design questions (formula, anchor preservation,set_first_output_wait/Carried::last_output_nssemantics) plus the test/benchmark work; #663 reports the test/benchmark work done but never answers the design questions. - Evidence is otherwise unusually strong for this area: a paired served A/B against
mainon DeepSeek-V4.1-Flash TP4 (SM121), a second paired A/B on Qwen3.8-Flash-Next TP2 (hybrid Mamba/GatedDeltaNet + attention) that the local snapshot of the PR body does not include, Rust/Python suites, and a disclosed p99 trade-off. But only SM121 was run; SM120 (4× RTX PRO 6000) — named in the charter matrix and actually run by both peer PRs #660 and #661 — was not.
1. The change (verified in diff)
Size is honest: 11 files, +511/−40, ≈105 net production Rust lines; no cli.rs/config change, no new graph kind, no protobuf/ABI change, no new PolicyConfig field (the description matches the diff on every one of these).
helios/src/scheduler/policy.rs:59— newRequestAccounting::first_output_wait_ns, initialized to arrival for new requests (:267, :310);credit()gainspreserve_first_output_waitand only advances the clock when false (:71-85);set_first_output_waitclamps tomax(wait_ns, arrival_ns)and requireslast_use == Fence(0)(:279).policy.rs:440-464— newfits_single_prefill_from(request, start): true iffprefill_limit() == prompt_tokensand some catalog capacity covers exactly the remaining work and resolves to a measured graph, honouring prompt_logprobs → scored catalog and terminal-only completion. This mirrors the natural-fit machinery from #645/#538 (natural_fit_prefill_capacity, policy.rs:413-438).policy.rs:729-752— the credit: only whenconsumed_tokens < prompt_tokens && max_new_tokens > 0 && decode_age_price > 0 && incumbent_decode_batch_ms > 0;age_msfrom the maxexpected_finish_nsof in-flight prefill submissions containing the request, elsefirst_output_wait_ns;first_output_value = decode_age_price * incumbent_decode_batch_ms * age_ms, then scaled byunit(:768) and deliberately kept out of theage_pricepenalty sum (onlyvalue.age_priceis summed at :769).helios/src/scheduler/utility.rs:85-110—LaneValue::first_output_value; newprefill_within(consumed, initial_prefill, first_output)addsfirst_output_value * frac,frac = 1.0when finishing elsemin(consumed/initial_prefill, 1); oldprefill()survives only as#[cfg(test)].helios/src/scheduler/service.rs:161-183—delivery_references→delivery_references_and_decode_batch, returning the per-slot references plusbest_decode.1² * best_decode.0=b_served * T_decstream-ms for the fastest Decode/Speculative per-delivery round,0.0if none finite. Reuses #644's per-slotDeliveryReference { excluded_wait_ms, served_share }loop verbatim.helios/src/scheduler.rs:2677-2702—preserve_first_output_wait: prefill lane, request not terminal/finished,prefill > 0,output == 0,!request.deferred_prefill, prompt unfinished,checkpoint_capture.role == RetentionRole::Anchor && endpoint == consumed_tokens, andfits_single_prefill_from(request, request.consumed_tokens). Cheap predicates are ordered before the catalog scan via&&short-circuit.scheduler.rs:348addsLiveRequest::initial_prefill_tokens()=prompt_tokens - admission_reused_tokens.helios/src/server/runtime.rs—Carried::last_output_nsset at park time fromlive.accounting().last_output_nswith fallback (:2453-2500) and applied on readmission via:1572-1578).set_first_output_wait(handle, last_output_ns)(- Docs +16 (docs/scheduling-runtime-design.md:263-284, where the selection formula gains a
+ sum over served waiting prompts of decode_age_price*(b_served*T_dec)*A_first*fracline) and +33 (docs/scheduling-utility.md:287-318). - Tests:
policy_tests.rs+214 (four new tests at :6958, :7001, :7040, :7125 with exact numeric assertions e.g. expected unscaled 480.0 at :7016-7021),runtime/phase_tests.rs+1 (last_output_ns: None), tests/test_scheduling_utility.py +52/−15.
Not stated in the description: the loosened coalescing tests (see Key findings), the #[cfg(test)]-only fate of LaneValue::prefill, the reuse of #538/#645's natural-fit logic inside fits_single_prefill_from, and the fact that Snapshot/Init/Restore/Vision phases never call credit() (scheduler.rs:2707-2741 continues before the credit call), so clock preservation across the boundary snapshot is incidental rather than an explicit rule.
2. The why
Two independent halves, each with different evidence:
- (A) Waiting-age asymmetry. Verifiable from the pre-PR docs/code, not just asserted: decode lanes collected
c_i*sigma_i*(A_i+T)(docs/scheduling-utility.md:250-285 at base, now docs/scheduling-runtime-design.md:255-270) while a prefill-only request got no waiting term and docs/scheduling-theory.md:850 said so explicitly. Independently attested by #654's author (measured 2.4-3.1 s TTFT behind 16 decoders on his own hardware) and, via a different mechanism, by issue #42 (Maxrio9, 2026-10-23: prompts starving behind the decode pipeline in this same selector, fixed by #43 viaavailable_planfeedback gating) — the same user-visible symptom recurring. No issue reports the exact symptom; the PR has noFixes #and no linked issue at all, against a charter that lists a filed reproducible bug/measured perf issue among merge grounds. - (B) Double stall across a forced interior anchor cut (204 tokens cut at 202 → main chunk, boundary
Snapshot, 2-token tail, each re-queued at zero waiting age). Mechanically verifiable:credit()advanced the clock on any prefill progress, and anchor cuts come fromcheckpoint_extra_work_fraction(default 0.05, policy.rs:40; docs/cli-design.md:696-709). #660 documents the same splits from the cost side ("splitting a 453-token prompt at 450 adds an 18 ms tail, +62% work"). No issue reports it; only #662/#663 claim it, and no served measurement isolates the anchor-preservation contribution from the credit contribution (the 0.05 vs 0.0 pair differ in baseline TTFT, 5,265 vs 4,656 ms, as well as in splitting).
3. Related work
- #662 (closed, draft,
flare-autobot, +374/−16, 7 files, 2026-12-01 19:27→19:40): identical change under the automation account; closed explicitly as a duplicate "opened under the wrong account". #663 is its live successor, carrying the simulator/TLA/GPU evidence #662 lacked. Its unaddressed design-question list is the best record of what reviewers were expected to press on. - #654 (open, logprobz, FIRST_TIME_CONTRIBUTOR, +4940/−126, 26 files): the competing design of the same feature — opt-in, new CLI knob
--scheduler-first-output-age-price(default 0.0), formulafirst_output_age_price * sigma * (A+T) * T/(T+F), plus ≈1.8k lines of returning-agent benchmark/analyzer tooling. Same files (policy.rs, service.rs, utility.rs, runtime.rs, both docs, scheduling_sim/utility.py, test_scheduling_utility.py). Reviewed "Changes Requested"; its bot review flags the docs/scheduling-theory.md:850 inversion as a blocker, monotonicity inversion when F > A, and non-zero credit at A = 0 — the last two #663 structurally avoids by using pureage_msand omitting the term from the penalty sum. #663 explicitly differentiates itself from #654's opt-in pricing. Whichever lands first makes the other's diff much harder. - #660 (open, FujitsuPolycom, +740/−127, changes checkpoints.rs (not opened), review "Changes Requested"): budgets interior conversation-anchor splits against
checkpoint_extra_work_fraction; #663 calls it complementary twice and #660's bot review calls #663 complementary. Its review also notes it conflicts with #655. - #661 (open, draft, FujitsuPolycom, +1274/−87, no discussion): smaller prefill chunks to protect decoder cadence — the inverse side, as #663 itself says.
- #655 (open, same author yatesdr, reviewed "Ready To Merge" 17:30, same-day): touches helios/src/scheduler.rs, docs/scheduling-runtime-design.md, cost.rs (not opened), checkpoints.rs (not opened). Overlaps #663 in the
complete_innerregion of scheduler.rs (~:2690) and the same doc — smallest rebase cost if #655 lands first, but someone must do it. - Older lineage, background only: #644 and #645 (immediate parents of the edited code, below), #619, #540 (last change to docs/scheduling-theory.md), #426, #582, #538 (natural-fit discovery ancestor), #285/#568. #152/#632 are unrelated (speculative verification width under balanced). #628's only overlap is that both add fields around
runtime.rs'sCarried.
4. Recent activity
- The selector was rewritten in the 48 h before this PR, all by Luke Alonso: e85019b9 (#645 "Overhaul Helios prefill scheduling, cost modeling, and two-frame pipelining"), 3e57bdc8 (#644 "per-step speculative calibration and excluded-only waiting/delivery fairness"), e8a3a7c7 (#656), with a3c80e19 (#657) as base — so #663 is rebased on top of all of them.
- It builds on #644 rather than reversing it: #644 introduced
DeliveryReference { excluded_wait_ms, served_share }and restricted waiting cost to excluded streams; #663 reuses that loop and adds a separate additive first-output credit kept out of theT/2 * sum c_isum (policy.rs:769 only sumsage_price). #644's invariant survives; this is the technical reason #663 differs from #654's biased design. - It also depends on #645's
deferred_prefill/prefill_work_through/ natural-fit machinery (!request.deferred_prefillat scheduler.rs:2695) and on #538's natural-fit discovery. - No commit on main implements first-output waiting age before this fallback:
search_historyfor "first-output" returns only a5c36978 itself. Idea is one day old in commit history; the problem has a longer tail (#42 in October, #654 in parallel). - Who works here (180-day commit counts on default branch): helios/src — Luke Alonso 235, Martin Vit 52, yatesdr 48; docs — 390 / 55 / 48; scripts/scheduling_sim — Luke Alonso 6, PCCessna 1.
- Overlap matrix for this PR's files: policy.rs open in #654, #661, #663 simultaneously; scheduler.rs in #655 + #663; docs/scheduling-runtime-design.md in #655, #660, #661, #654, #663; docs/scheduling-utility.md, scheduling_sim/utility.py, tests/test_scheduling_utility.py in #654 + #663.
5. People
- yatesdr (Yates Drury): COLLABORATOR, 81 merged / 11 closed / 4 open in 180 days; merged work concentrated in helios/src (35) and docs (34). He owns the checkpoint/prefill-sizing side of this selector: #354 (estimate checkpoint work without quoting snapshot storage), #357 (size ordinary prefill graphs to quoted checkpoint work), #389 (size mixed prefill rows to quoted checkpoint work), #459 (price checkpoint candidates without walking every prefill chunk) — all merged, all in exactly the
fits_single_prefill_from/anchor-cut area. Same-day sibling #655 is his too. Theflare-autobotdraft #662 shows the automation account is sometimes used for his work. - Luke Alonso: dominant author in these areas (235/390/434 commits) and the author of #644/#645/#656 that #663 builds on; has not commented on #663.
- FujitsuPolycom (Dooner): #660, #661, both describing #663 as complementary.
- logprobz: #654, the competing opt-in design, first-time contributor.
- flare-autobot: posts the intake/review comments on #654, #655, #660 — notably not on #663, which is the least-processed member of the cluster.
6. Community
Effectively none yet: zero reviews, zero review comments, no reviewers requested, no reactions. The single comment on the PR is the author's own evidence addendum (below), posted 21:20 after the 21:07 update, and is not in the local snapshot of the PR body:
- Additional served A/B,
Qwen3.8-Flash-NextTP2 on 2× DGX Spark GB10 (hybrid Mamba/GatedDeltaNet + attention), base a3c80e19 vs a5c36978, 0 errors, 0 new flags. Standalone prefill 8K/32K parity (+0.1%); batched decode C=1/4/8/16/32: −2.3% / +1.5% / +6.5% / +0.9% / +4.2%. Fixed-window mixed contention: 45 s returning agent + K=16 background decoders underbalanced— returned TTFT p50 4,324→868 ms (−79.9%, 5.0×), p95 4,789→1,576 ms (−67.1%), cold turn-0 TTFT ~2.5K 10,048→5,032 ms (−49.9%), turns 9→22 (11.99→28.30 /min), streamed background decode throughput 237.1→234.1 chunks/s (−1.3%, parity), background decode gap p99 334.5→410.5 ms and max 511.6→662.6 ms — a second disclosed p99 regression of the same shape as the DeepSeek one. Long cold prompts (3× ~14K) + K=12 background decoders: cold TTFT max 37.4→35.9 s (−4.2%), background throughput −2.0%, gap p99 1,192.8→1,190.7 ms (parity) — i.e. long cold prompts are not fixed by this change, consistent with #661 being the complement.throughputcontrol: exact parity (2,540→2,539 ms p50). - Significance: this partially answers the charter's supported-matrix concern with a second, non-DeepSeek architecture, and shows the trade-off reproduces across models; it does not change the hardware story (still SM121 GB10) and is author-supplied evidence with no independent replication.
7. Project fit (charter and docs, as facts)
Lines up: "smallest footprint in shared code … or a way to solve it without new code at all" — knob-free, one extra return value on an existing pass, no new crate/config. "Keep the runtime small and model-agnostic" — no per-model branches; DeepSeek/Qwen appear only as benchmark vehicles. "Bring real evidence … benchmarks showing an actual speedup over main on a served workload (#210)" — satisfied in form, paired A/B on two served models against a3c80e19. "Be explicit and pin everything … no magic defaults" — no new default field, but the meaning of the existing balanced default changes with no operator-visible signal.
Does not line up:
- docs/scheduling-theory.md:850-853 invariant, unchanged (see Key findings). That doc is maintained, not abandoned: last touched by 59adc480 (#540) and five commits before that, and #654's review treated the same sentence as a blocking item requiring maintainer sign-off.
- "Supported matrix & compatibility: check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs." #663 tests one hardware family (SM121, 2×/4× DGX Spark GB10) and two models; SM120 (4× RTX PRO 6000) is explicitly not run although both #660 and #661 ran it. No multi-host, no other cache scheme, no alternative parallel layout is exercised.
- docs/design-review.md:195-208 (testing hierarchy): changes to graph selection / service pricing "must be evaluated against the Python simulator and reference solvers in scripts/scheduling_sim". #663 evaluates against the simulator workloads but not against the oracle reference solver, whose
prefill_wait_price/Fmachinery is the reference for exactly this term (docs/scheduling-oracle.md:69-74,--prefill-wait-pricedefault 0 at :206-207, and that doc says "All prices are explicit experimental inputs, not production defaults"). - docs/design-review.md:232-251: "Never touch covered code without running and updating its simulator and formal checks". Simulator run yes; formal checks re-run but not updated for the new accounting state; Kani disclosed as not run, which is defensible since no completion-vector/validator code changed.
- AGENTS.md:152-160 / repo prose requiring disclosed qualifications: satisfied — the PR has a "Disclosed limitations" paragraph.
8. Claims and evidence
Verified by me (diff-level): file list and line counts; absence of new CLI/config flags, graph kinds, protobuf/ABI changes; every described code change's shape; the credit's gating conditions; that waiting prompts are excluded from the penalty sum; that first_output_wait_ns is initialized, clamped and preserved only under the anchor predicate; that fits_single_prefill_from is narrow. I could not verify any timing number (no GPU here).
Backed by artifacts the PR names: Rust --release suites (helios 1,758 / flare 253 / flare-cli 241, 5 template tests skipped without FLARE_TEST_TEMPLATE_DIR), heliopause cargo check --locked clean, pytest tests/test_scheduling*.py 829 passed, 21/21 simulator trace identity at age_price = 0.0. The throughput-inertness claim is also structurally backed (the term is gated on decode_age_price > 0, and throughput() sets it to 0.0).
Backed only by author run output: every served number, including both disclosed p99 regressions. Consistent in direction across two models and two decoder counts, which is what a reviewer can check.
Weak or missing:
- No served measurement isolating the anchor/readmission preservation from the credit term.
- No simulator coverage of the anchor or readmission paths (they are not modeled at all), and no test asserting the Python formula numerically matches Rust's — the Python test asserts only
TTFT < 400and an empty dict at price 0. - No oracle-solver comparison for the new price term.
- TLA+ numbers are from unmodified models; no fixture covers
first_output_wait_ns. b_served*T_decscaling has a Rust exact-value test (policy_tests.rs:7001-7036, expected 480.0), but no Python equivalent.- The adversarial simulator checks ("oversubscribed 32 dec / B=4 / 16 prompts holds
consec_pre = 1"; "4 dec / B=1 / 24 prompts exact parity") have no committed test — they are reported numbers. - SM120, gated template tests and kani are disclosed as not run; #660/#661 did run SM120, so this will be an obvious comparison point.
9. Reach
- Default deployments.
PolicyConfig::default()=decode_age_price 0.1(policy.rs:29-45);--scheduler-policy balancedis the documented default (docs/cli-design.md:683; flare-cli/src/cli.rs:546, :1610). Every such deployment changes scheduling behavior silently. Unaffected by construction:--scheduler-policy throughput(policy.rs:50-52), zero-decoder/prompt-only schedules (incumbent_decode_batch_ms == 0), and score-onlyprompt_logprobsrequests (max_new_tokens == 0) — all gated at policy.rs:729-733. - Configuration: nothing added, nothing removed. No operator switch to disable the new behavior short of switching to
throughput. - Observability:
last_output_nsis exported in metrics (server/metrics/scheduler.rs:62 (not opened)) andRequestDetail(runtime.rs:1238), butfirst_output_wait_nsis not published anywhere — operators cannot see the new clock or confirm it is behaving. - Compatibility: no protobuf/ABI/graph-kind/prepared-graph change, so exported cores load and serve unchanged; no new
unsafe; arithmetic stays f64 in the single-threaded (&mut self) scheduler. Cost: one extra return value from an existing single pass, plus one O(catalog) scan per completing anchor prefill lane, short-circuited behind cheap predicates. - New API surface:
RequestAccounting::first_output_wait_ns(pub field),RequestScheduler::set_first_output_wait(pub),fits_single_prefill_from(pub(super)). - Behavioral side effects to expect: worse background decode p99 at high decoder counts (+95 ms at K=16 DeepSeek; +76 ms / +151 ms max at K=16 Qwen3.8), and a changed coalescing incentive at simultaneous bursts (which is what forced the test loosening).
throughputis bite-identical by construction. - Docs: only docs/scheduling-utility.md and docs/scheduling-runtime-design.md are updated; theory, README, cli-design and oracle docs are not.
10. Process
Ready for review (unlike its draft predecessor #662), CI green on head, same-day age, zero human engagement, no linked issue. Sequenced against a dense cluster opened within ~8 hours on 2026-12-01: #655 (same author, "Ready To Merge"), #660 ("Changes Requested", complementary but conflicts with #655), #661 (draft, silent), #654 ("Changes Requested", with the theory-doc inversion named as a blocker) — plus the closed duplicate #662. Merge order, not code quality, is the dominant risk: policy.rs, both docs, scheduling_sim/utility.py and test_scheduling_utility.py are each open in two or three PRs at once, and #654 and #663 are alternative designs for the same term.
Open questions / not found
- Will a maintainer accept inverting docs/scheduling-theory.md:850 for a non-opt-in default, or does that line need amending first (the position the bot took on #654)?
- Is the silent default change acceptable under "be explicit", given no metric exposes
first_output_wait_nsand nobalanceddoc text changed? - How much of the 5.9× / 5.0× TTFT gain comes from the credit term vs the anchor-cut preservation? No measurement separates them.
- Which of #654 / #663 (or neither) is the intended design, and does #663's existence supersede #654's benchmark tooling or duplicate it?
- Should the simulator and oracle be extended to model anchors/readmission and to price this term as a reference (
prefill_wait_price/F)? - Who reviews it: no reviewer assigned, no human has engaged, and the bot has not posted its usual intake review.
- Nothing found for: any linked/filed issue for the symptom; any SM120, multi-host, alternate cache-scheme or alternate parallel-layout validation; any independent replication of the timing numbers.