Explore scratchpad · NVIDIA/hyperflare-inference #681

Raw Markdown for agents: https://autobot.eidonix.com/p/54676180-bb05-4deb-8333-947acd22e647.md

#1 [high] Change: PR #681 cohort-mean coalescing horizon - what it does, size, files

PR #681 "helios/scheduler: use active cohort mean in coalescing horizon" by FujitsuPolycom, opened+updated 2026-12-02, draft, base main, head e15b836. 5 files +236/-18. Labels: area:scheduling, performance. No reviews, no CI checks on head.

Verified diff (pr_diff):

  1. helios/src/scheduler/policy.rs (policy.rs:525-684 coalescing_prefill_log_bonus):
    • Removes peer_budget scalar (let mut peer_budget = usize::MAX; + peer_budget = peer_budget.min(rem)) and adds decoder_rems = [0usize; REQUEST_LANES] parallel to decoder_slots, filled at policy.rs:550-554.
    • Guard changes from decoder_count == 0 || prefiller_count == 0 || peer_budget == usize::MAX to decoder_count == 0 || prefiller_count == 0 (policy.rs:567) - peer_budget==MAX was unreachable anyway since rem>0 required.
    • Two mean_out sites (policy.rs:627 packed speculative shapes; policy.rs:636 speculative catalog) now: decoder_rems[..decoder_count].iter().map(|&rem| expected_at(w).min(rem as f64).max(1.0)).sum::<f64>() / decoder_count as f64.
    • Horizon site (policy.rs:667-672): let ph = coalescing_horizon_tokens.min(post_prefill as f64); horizon = mean over decoders of (rem as f64).min(ph).
  2. helios/src/scheduler/policy_tests.rs +201: new helper coalescing_bonus() (diffs lane_values with horizon 0.0 vs default) and add_active_decoder(); two tests: coalescing_horizon_averages_active_decoder_budgets_across_cohort (policy_tests.rs:6880+) and coalescing_speculative_mean_output_averages_per_decoder_budgets (policy_tests.rs:6957+). The [1,100] pair -> 32.5 horizon is asserted exactly.
  3. scripts/scheduling_sim/utility.py:230-236: same change; peer_budget = min(...) removed, horizon = sum(min(float(v.output_budget), ph) for v in decoders) / k. NOTE: the simulator's mean_out (utility.py:215-219) already averaged per-decoder budgets before this PR - only horizon changed there.
  4. tests/test_scheduling_utility.py +23: test_coalescing_horizon_averages_active_decoder_budgets.
  5. docs/scheduling-runtime-design.md:222-231 spec paragraph reworded to describe per-decoder clamp-then-average for both horizon and expected output. Config table row docs/scheduling-runtime-design.md:713 unchanged (default 64).

Net production Rust LOC = +1 (as claimed): +11/-10 in policy.rs; the rest is tests.

#2 [high] Related work: #661 stack parent, changes nearby policy.rs coalescing code

#661 "helios/scheduler: explore smaller prefill chunks under active age-priced streams" by FujitsuPolycom (same author), open 2026-12-01, updated 2026-12-02 15:24, head 3d868f84, +2778/-186 across 15 files (incl. helios/src/scheduler/policy.rs +195/-129 and policy_tests.rs +1762/-2; docs/scheduling-runtime-design.md +52/-20). Labels area:scheduling, enhancement, performance, triage:validation.

Key relevance to #681: #681 is stacked on #661 and the two PR bodies' measurements are cited as a pair. #661 unlocks smaller non-terminal prefill chunks and draining; #681's cohort-averaged horizon then packs queued prefills without all decoders being blocked. #681 description: "#661 rushes... cutting SM120 mixed-c32 >250 ms stalls -74.9% vs main, from 538 to 135."

#661 last Autobot review (2026-12-02 15:24) = "Recommendation: Ready To Merge", 0 blockers/0 should-fix, "Confirm GitHub Actions CI is green on 3d868f8 before merging." Earlier rounds were Changes Requested (blocker: unrun 64-seed simulator gate; service_rates mispricing under measured TerminalPrefill).

#661 itself builds on merged #645 (which introduced coalescing_prefill_log_bonus). #661's A/B numbers: mixed-c32 >250ms stalls 538 -> 365 (-32.2%); long-context-mixed 863 -> 503; cold-heavy-mix 2,988 -> 2,732 with 4 -> 7 client-side 45 s drain cutoffs. Note #681's body cites different #661-inclusive numbers (135 stalls after the stack), so the stall counts are from different tree combinations (df9a8ebd / dbbf65df / 38130855 - not equal to #661's 3d868f84 head).

Also #661 has a known regression in cold-heavy-mix: SLO 89.0% -> 81.6%, and 4 -> 7 45s drain cutoffs; #681's body inherits/reports similar cold-heavy-mix SLO regression on solo (88.1 -> 79.1) and on #661 (81.6 -> 79.8).

#4 [high] Related work: #663 (merged) introduced age pricing and weakened coalescing test bounds

#663 "helios/scheduler: price first-output waiting age on incumbent decode rounds" by yatesdr (COLLABORATOR), merged 2026-12-01 23:28, head 5bf9085, +1154/-87, 12 files incl. helios/src/scheduler/policy.rs (+127/-14) and scripts/scheduling_sim/utility.py (+29/-1). Merged into main as 8489d504 — i.e. the commit immediately before #681's base main state used by the PR (base 1fbcc3c9, head e15b836; policy.rs history shows 8489d504 then e15b836 as the newest two commits touching policy.rs and policy_tests.rs).

Built on by #681? #681 is stacked on #661 which is the follow-on to #663's age pricing; #681 tests use interactive_engine and coalescing bonus math independent of #663.

Relevance to #681:

#5 [high] Why: the min-over-decoders collapse and where the demand comes from

Problem the PR addresses (claimed): coalescing_prefill_log_bonus (helios/src/scheduler/policy.rs:525-684) prices the K -> K+m decode-batch surplus when queued prefills join active decoders, over coalescing_horizon_tokens (default 64.0, policy.rs:42) clamped by the prefiller's post-prefill budget and the active decoders' MINIMUM remaining budget (peer_budget). Verified on main (policy.rs:667-671 at main):

let horizon = self.policy.coalescing_horizon_tokens.min(post_prefill as f64).min(peer_budget as f64);

With one active decoder at rem=1, horizon collapses to 1 = 98.4% loss of the 64-token horizon, and mean_out (policy.rs:627,636 on main) also clamps to 1.

How long/widely wanted: not from an issue. Searching items for "coalescing horizon single decoder remaining collapse" returns only #681 itself; no issue or comment asks for this. The mechanism was introduced by merged #645 (2026-11-30, "Decode-batch coalescing continuation value") — #681's description says the peer_budget min was there "previously", i.e. since #645's introduction. So this is a ~2-day-old formula being refined, not a long-standing user request. Sibling defect reports in the same area: #676 (open, Reederey87, 2026-12-02) on large prefill chunks causing >1.4 s decode p99 ITL under balanced — it is about chunk size/cap, not the coalescing horizon, and cross-references #661 only.

#6 [high] Claims and evidence: served A/B numbers; solo regressions; stack attribution

Reproduced from the PR body (all numbers are the author's claims, not re-verified here). 4x RTX PRO 6000 (SM120) and 4x GB10 (SM121), DeepSeek-V4.1-Flash TP4, --scheduler-policy balanced --max-concurrency 32 --mtp-draft-tokens 7 --mtp-adaptive-verification ... --prefix-cache-memory 0. Workloads from FujitsuPolycom/tokbench v0.4.0, seed 42, temp 0.0.

| Arm || Scenario | Out tok/s | Stalled >250 ms | TTFT p50 | SLO | | Solo mixed-c32 (2) | 1,281.7 -> 1,276.8 | 11.29 -> 11.49% | 1,425 -> 1,390 | 93.0 -> 91.1% | | Solo long-context-mixed (1) | 655.4 -> 667.3 (+1.8%) | 28.1 -> 26.3% | 1,510 -> 1,449 | 89.8 -> 92.6% | | Solo cold-heavy-mix (1) | 541.8 -> 521.8 (-3.7%) | 62.5 -> 62.2% | 1,763 -> 1,834 | 88.1 -> 79.1% | | On #661 mixed-c32 (2) | 1,254 -> 1,261 med | 6.65 -> 5.95% med | 1,479 -> 1,439 | 89.4 -> 90.5% med | | On #661 long-context-mixed (1) | 670.5 -> 667.6 | 16.4 -> 9.8% | 1,503 -> 1,473 | 89.3 -> 82.1% | | On #661 cold-heavy-mix (1) | 545.6 -> 547.8 | 56.3 -> 55.7% | 1,713 -> 1,786 | 81.6 -> 79.8% | | Stack (660+661+665) mixed-c32 (2) | 1,374.6 -> 1,394.2 | 4.82 -> 4.34% | 1,001 -> 922 | 96.5 -> 97.1% | | GB10 Stack mixed-c8 (2) | 128.4 -> 129.4 | 41.8 -> 38.0% | 1,181 -> 1,118 | 79.0 -> 81.7% | | GB10 Stack agentic-coding C=8 (1) | 137.1 -> 135.0 | 45.4 -> 34.5% | 1,024 -> 877 | 81.8 -> 85.7% |

Reading: 2 of 3 SOLO scenarios get worse on output throughput and SLO (mixed-c32 SLO -1.9 pp; cold-heavy-mix SLO -9.0 pp, output -3.7%, TTFT +4.0%). On #661 long-context-mixed SLO drops 89.3 -> 82.1% while stalls improve. The Stack rows cannot be attributed to #681 alone (three other PRs). Disclosed trade-off: "on solo cold-heavy-mix, keeping coalescing active near EOS pulls 150K–250K cold prefills ahead of decoders without chunk shrinking, raising agentic_multiturn TTFT p99 3,323 -> 5,144 ms" — i.e. the change's own mechanism (not clamping to the near-EOS decoder) delays other requests' first token by up to 1.8 s p99.

Claimed stack deltas (from #661-first ordering): SM120 mixed-c32 >250 ms stalls 538 -> 135 (-74.9% vs main), burst gap p99 254.7 -> 234.9 ms, prefix-cache hit rate 48.6% -> 52.5%; long-context-mixed stalls 503 -> 244; cold-heavy-mix 2,732 -> 2,452 with 7 client-side 45 s drain cutoffs, 0 server errors; cold-burst probe peak gap 433.7 -> 224.1 ms.

#7 [high] Claims and evidence: archive checks, 84-run parity, CI and knobs

PR body "Evidence" section (claims):

#8 [high] People: author series + area owners + zero engagement

FujitsuPolycom (Discord "Dooner"), repository association CONTRIBUTOR. Last 180 days: 15 merged, 11 closed, 4 open. Open now: #665 (prefix-cache scan resistance), #661 (prefill chunk exploration), #660 (budgeted interior anchor splits), #649 (RoCE prefill proxy opcodes). Merged in the touched area: #538 (Restrict cold pure-prefill discovery to natural-fit graph capacities), #496 (Selene ancestor read coalescing), #497 (disk offload restore latency), #586/#587 (Engram plane assembly / export spans).

Author is a prolific contributor in helios/src + docs but is not one of the charter's priority contributors (@voipmonitor, @original-el8, @lukealonso). All three of #660/#661/#665 have Autobot "Ready To Merge" as of 2026-12-02 and none is merged yet; #681 is the fourth in the same series, opened the day after, still a draft with no CI and no human review.

Who usually works in this area (default-branch commits, last 180 days): helios/src — Luke Alonso 237, Martin Vit 52, yatesdr 49; scripts/scheduling_sim — Luke Alonso 6, PCCessna 1, yatesdr 1; docs — Luke Alonso 391, Martin Vit 55, yatesdr 49. The coalescing code itself came from Luke Alonso's #645. yatesdr's #663 (merged 2026-12-01) is the most recent change to the same function's neighbours (first-output age pricing) and to utility.py.

Engagement so far on #681: none — 0 comments, 0 reviews, no reactions visible in pr_comments (returned "No comments"). No one has cross-referenced it in the other open PRs/issues I read (#661, #660, #665, #663, #655, #676 all omit it; #661 and #665 were last updated 2026-12-02 before #681 opened at 2026-12-02).

#9 [high] Project fit: charter + design-review gate mapping

Charter (read_charter) facts that bear on #681:

docs/design-review.md mandatory gates (verified text):

#10 [high] Reach: no opt-out, default-on, docs, dependency on #661

Reach analysis (verified from code/docs):

  1. No operator surface: coalescing_horizon_tokens is not exposed in helios/src/server/config.rs (only scheduler_policy preset + terminal_value/terminal_age_price/checkpoint fraction/mtp alpha) and has no CLI flag (no matches in flare-cli/src). The only off-switch is --scheduler-policy throughput (policy.rs:50-53 sets delivery_fairness 0 and decode_age_price 0, but NOT coalescing_horizon_tokens; the horizon stays 64.0 under throughput, so the coalescing bonus remains active under throughput too — the docs/README describe it as part of the default policy). #661's body says "Opt-out: --scheduler-policy throughput" for its own change, not for #681's.
  2. Default-on: PolicyConfig::default() is what both scheduler_policy: balanced and a missing key produce (config.rs:305-310), so the cohort mean applies to every prefill-capable core on every deployment.
  3. Affected requests: any prefilling request with max_new_tokens > 1 while at least one decoder is active; requests with prompt_logprobs or max_new_tokens == 1 are excluded (policy.rs:556-564).
  4. Documented behavior change: docs/scheduling-runtime-design.md:222-231 now specifies per-decoder clamp-then-average for both horizon and speculative expected output; docs/scheduling-runtime-design.md:713 config table unchanged. No doc or README mentions the near-EOS case or the new cold-prefill-priority trade-off that the PR body itself discloses (agentic_multiturn TTFT p99 3,323 -> 5,144 ms).
  5. Interaction with chunk sizing: the horizon feeds per_token = (best_surplus_per_horizon * horizon) / initial_prefill (policy.rs:677), so raising the horizon by up to 64x (1 -> 64) raises queued prefills' per-token price for the SAME prompt size — that is exactly the mechanism that lets 150K-250K cold prefills outbid decoders, which #661 was needed to compensate for by shrinking chunks. #681 depends on #661 for that compensation, and #661 is unmerged.
  6. Metrics/observability: no new metric; the effect is visible only in dispatch/ITL/TTFT behavior. #663's first_output_wait_ns and #681's coalescing term both amortize over initial_prefill (docs/scheduling-utility.md:306-309 uses "matching coalescing's fixed-denominator amortization"), so their relative weight shifts when the horizon grows.
  7. Compatibility: no Protobuf, core-format, or CUDA-graph ABI change; prepared/exported cores unaffected (the change is pure scheduler arithmetic). No dependency changes.

#11 [high] Change detail: monotone credit increase, undeclared sim divergence fix, tests

Verified by reading policy.rs at main vs PR head:

  1. Monotonicity. Old horizon = min(H, post_prefill, min_i rem_i). New horizon = mean_i min(rem_i, min(H, post_prefill)). Since min(rem_i, ph) >= min(min_i rem_i, ph) for every i, the mean is >= the old value. Same for mean_out: old = max(min(expected_at(w), min_i rem_i), 1.0); new = mean_i max(min(expected_at(w), rem_i), 1.0) >= old. Net: #681 can only RAISE queued-prefill coalescing credit, never lower it, for any state. No state loses credit. That is why the only measured regressions are ones where more prefill credit is harmful (solo cold-heavy-mix: SLO 88.1 -> 79.1%, output -3.7%, agentic_multiturn TTFT p99 3,323 -> 5,144 ms).
  2. Undeclared removal of a Rust/simulator divergence. In scripts/scheduling_sim/utility.py:215-219 (pre-existing, unchanged by this PR) mean_out was ALREADY a cohort mean over decoders, while the Rust used peer_budget = min over decoders. #681 makes Rust match the simulator's existing mean for mean_out; the PR body presents both as one formula change and does not say that the mean_out half is a pre-existing Rust/sim divergence repaired. Verified: utility.py diff touches only the horizon block (lines 232-236), mean_out at 215-219 is untouched.
  3. Dead-guard removal. peer_budget == usize::MAX in the early return could never be true because decoder_count > 0 implies a rem > 0 was stored; the PR drops it (policy.rs:567). Behaviour-neutral, undeclared but harmless.
  4. Rust-only surface change in utility.py's shape: the Python decoders list comes from View.output_budget which is min(output_tokens, max_new_tokens) - generated (simulator.py:26) whereas Rust rem also clamps by max_sequence_tokens - scheduled_consumed (policy.rs:548-549). Simulator has no max_sequence_tokens, so the clamped coordinate is Rust-only; the new averaging makes that clamp apply per-decoder rather than to the whole cohort, i.e. one KV-exhausted decoder now only drags down its own term (1/n) rather than collapsing everyone's horizon.
  5. Tests: policy_tests.rs adds a coalescing_bonus() helper that re-derives the bonus by re-running lane_values with the horizon toggled to 0.0 (policy_tests.rs:6866-6877) and an add_active_decoder() that forces phase=Decode/consumed=prompt/generated=1 (6879-6887). Both new tests assert exact closed-form bonuses (1e-9 tolerance), the [1,100] pair gives 32.5, a single decoder matches min(H, post_prefill, rem), zero decoders and max_new_tokens == 1 give exactly 0.0. Plus a speculative test with 3 sub-cases (packed eff_width 6->4, saturation, slow B=4). No test asserts monotonicity vs the old formula, and no test covers the KV-exhaustion clamp difference.
  6. Docs change (docs/scheduling-runtime-design.md:224-229) is a single reworded clause; docs/scheduling-utility.md (which describes the first-output credit that shares the amortization, lines 287-320) was NOT updated, and neither the coalescing_horizon_tokens row (line 713) nor helios/README.md:482 changed.

#12 [high] Related work: #645 origin, stack state, #663, #676, nothing supersedes

Overlapping / adjacent PRs and issues around #681, with state as of 2026-12-02:

Nothing found: no PR or issue proposes superseding or reverting the coalescing horizon; no Closes #/Fixes # reference in #681; no related test or doc names it yet.

#13 [high] Research summary

Case file for PR #681 ("helios/scheduler: use active cohort mean in coalescing horizon", draft, head e15b836, +236/−18 across 5 files, no reviews, no CI) is complete; twelve scratchpad entries cover every angle.

What I verified in the code: the PR replaces the scalar peer_budget (min over active decoders' remaining output budget) with a per-decoder decoder_rems array in coalescing_prefill_log_bonus (helios/src/scheduler/policy.rs:525-684), and averages min(rem, min(horizon, post_prefill)) for the horizon and max(min(expected_at(w), rem), 1.0) for speculative mean output. The change is provably monotone: it can only raise queued-prefill credit, never lower it, which is why the two measured regressions (solo mixed-c32 SLO 93.0→91.1%, solo cold-heavy-mix out −3.7% / SLO 88.1→79.1% / TTFT +4%) are cases where more prefill credit is harmful — the PR body itself discloses pulling 150K–250K cold prefills ahead of decoders and raising agentic_multiturn TTFT p99 3,323→5,144 ms.

Findings a reader could not get from the description: (1) the simulator's mean_out at scripts/scheduling_sim/utility.py:215-219 was already a cohort mean before this PR, so half the change is a silent Rust/sim divergence repair, not a new formula; (2) the "84 simulator runs matched 84/84" evidence cannot exercise the changed path — no workload in workloads.py:33-55 pairs a near-EOS decoder with a long prefill, so parity is expected by construction; (3) the served A/B trees (df9a8ebd, dbbf65df, 38130855) and the archive hash (40596880cc64) are not the PR head; (4) there is no operator knob or opt-out — coalescing_horizon_tokens is not in helios/src/server/config.rs:305-330 nor a CLI flag, and --scheduler-policy throughput does not clear it; (5) docs/design-review.md:195-208 requires the scripts/scheduling_sim/learning.py (not opened) catalog for cohort-algorithm changes and the PR reports no such run; (6) the change depends on #661's chunk shrinking to be safe, and #661 (plus #660 and #665, all "Ready To Merge") is still unmerged.

Related-work map: introduced by merged #645 two days earlier; stacked on #661/#660/#665; neighbours merged #663 the day before (which weakened the balanced burst-coalescing test bounds and shares the initial_prefill amortization); symptom-class issue #676 (open) argues the opposite direction (cap prefill chunks) and names only #661. Author FujitsuPolycom has three other Ready-To-Merge PRs in this series and no priority-contributor standing; nobody has commented, reviewed or cross-referenced #681.

#3 [medium] Related work: #660 stack member (checkpoint anchor splits)

#660 "helios/scheduler: budget interior conversation-anchor splits against checkpoint_extra_work_fraction" by FujitsuPolycom, open 2026-12-01 19:02, updated 2026-12-02 00:23, head 9709d496, +900/-162 across 12 files. Labels area:scheduling, bug, performance, triage:review. Autobot review 2026-12-01 23:49 = "Ready To Merge" (0 blockers), still open as of 2026-12-02.

Relevance to #681: part of the declared 4-PR stack (#660 + #661 + #665 + #681) whose "Stack" measurements #681 cites. Does NOT touch policy.rs coalescing code (files: checkpoints.rs, tests, docs/{cli,core,scheduling-runtime}-design.md, helios/README.md, phase_tests.rs, check.py). Its mixed-c32 numbers (SLO 9.1% -> 80.3%) are the base the stack builds on. #681's body says it merges cleanly with #660.

Trade-off in #660 relevant to stack interpretation: mixed-c32 per-user p50 93.9 -> 71.0, >250 ms gaps 215 -> 434; also <think>-stripping clients skip Turn-1->2 reuse on single-chunk 4.5K–13.7K prompts unless --scheduler-checkpoint-extra-work-fraction 0.15. Conflict noted in its review: overlaps open #655 in checkpoints.rs and docs.

#14 [medium] Recent activity: policy.rs/utility.py churn in the 3 days before #681

Commit history of helios/src/scheduler/policy.rs up to the PR head (search_history, newest first):

So the function #681 edits is 2 days old and has had three authors' changes in three days (#645 -> #656/#644 -> #663). policy_tests.rs history is the same set plus 7cd83f32 #569 and 5deacda9 #568. scripts/scheduling_sim/utility.py was touched only by #645, #644 and #663 before this PR (items_touching). Default-branch committers in helios/src over 180 days: Luke Alonso 237, Martin Vit 52, yatesdr 49.

#681 neither reverses nor conflicts with #663's first-output pricing semantically (different term), but both add per-prefill-token credit amortized over initial_prefill, so their relative weight moves together with the horizon; docs/scheduling-utility.md:306-309 explicitly says #663's frac = work / initial_prefill matches "coalescing's fixed-denominator amortization".

#15 [medium] Process: draft, no CI on head, no review, same-day open, merge-order claim

Process facts (orientation packet + tools):

#16 [medium] File map: exactly what each of the 5 changed files does

Files in #681 (verified against pr_diff and the head tree):

  1. helios/src/scheduler/policy.rs, +11/−10 (the only production change): decoder_rems = [0usize; REQUEST_LANES] added at :531 and filled at :552; peer_budget declaration and its peer_budget.min(rem) removed (:530-554); early-return guard drops the unreachable peer_budget == usize::MAX (:567); packed-shape mean_out at :627 and speculative-catalog mean_out at :636 become per-decoder means; horizon at :667-672 becomes ph = H.min(post_prefill) then mean over decoders of min(rem, ph).
  2. helios/src/scheduler/policy_tests.rs, +201: coalescing_bonus() helper (:6866) that re-runs lane_values with the horizon zeroed to isolate the bonus, add_active_decoder() (:6879) that forces phase=Decode/generated=1/scheduled=prompt, coalescing_horizon_averages_active_decoder_budgets_across_cohort (:6888) and coalescing_speculative_mean_output_averages_per_decoder_budgets (:6936) with three speculative sub-cases (packed eff_width 6→4, saturated B=4, slow B=4).
  3. scripts/scheduling_sim/utility.py, +2/−6: only the horizon block at :232-236; mean_out at :215-219 untouched (it was already a mean).
  4. tests/test_scheduling_utility.py, +23: test_coalescing_horizon_averages_active_decoder_budgets at :506-528 with the 32.5 mixed-cohort and single-decoder cases.
  5. docs/scheduling-runtime-design.md, +5/−2: one clause at :224-229 describing clamp-per-decoder-then-average for horizon and speculative expected output. Untouched: the config row at :713, helios/README.md:482, docs/scheduling-utility.md (whose :287-320 describes the first-output credit sharing the same amortization).

Claim consistency: the PR body says "+1 net production LOC" and "+11/-10"; that matches policy.rs. The body also calls out scripts/scheduling_sim/utility.py +2/-6 and the two test files, all present. Nothing in the body describes an unlisted change; the only undeclared effects are behavioural (monotone credit increase, mean_out sim parity, KV-clamp now per-decoder) recorded in entry 11.