Repository navigation
helios/scheduler: explore smaller prefill chunks under active age-priced streams - #661
Conversation
fdb10bb to
29f2b5b
Compare
|
A case file has been opened for 661. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe core Rust scheduling changes are clean, memory-safe, and model-agnostic, but this default-on
Walkthrough
Merge Risk: Medium · up to
|
…ced streams Why To keep decode cadence responsive without mixed prefill-decode graphs, Helios interleaves smaller prepared prefill chunks with normal decode steps under the default balanced policy (PolicyConfig::decode_age_price = 0.1 value/ms^2, specified in docs/scheduling-theory.md and docs/scheduling-runtime-design.md). On prepared cores whose TERMINAL_PREFILL catalog covers capacities above the smallest chunk (for example, 256..=16384 alongside PREFILL 128..=16384), long cold prompts contending with active decoding streams still cause multi-second decode stalls for three reasons: 1. Cold-discovery lockout: prompts up to max_terminal measure TerminalPrefill(c) while leaving smaller non-terminal Prefill(c) unmeasured; add_candidate and continuation_candidate skip unmeasured capacities other than natural_fit, and funded refresh only revisits measured keys. 2. Monolithic-tail lockout: prefill_requires_terminal_completion_from excludes non-terminal Prefill whenever remaining tokens fit within max_terminal, forcing any remaining tail up to max_terminal into one TerminalPrefill step. 3. Two-frame prefill pipelining: prefill_step_requires_feedback lets consecutive non-terminal Prefill steps fill both transport frames ahead of active age-priced decoders and updated output ages. Pricing unmeasured smaller prefill capacities from already-measured GPU durations, allowing non-terminal Prefill chunks below max_terminal while active age-priced streams exist, and requiring feedback between non-terminal chunks lets ValueRate choose latency-bounded chunks by default under balanced without new CLI flags, hardcoded capacities, duration ceilings, or per-model branches. What Net non-test production change: +319 LOC (+397/-78) across 4 Rust scheduler files (11 files total, +1,949/-106; zero new CLI/config flags, zero unsafe, zero hardcoded capacities, zero model-name branches, zero Protobuf or ABI changes): - Interpolated GPU-measured prefill estimates and discovery origin (helios/src/scheduler/cost.rs, policy.rs): added ActionCosts::interpolated_prefill_duration, deriving positive durations strictly from measured GPU timings (same-capacity sibling first, else linear interpolation between nearest smaller peer or fastest Decode/Speculative/Resume floor and nearest strictly larger peer, with order-independent same-kind precedence and ScoredPrefill isolation). When age_price > 0.0, unmeasured pure-prefill capacities <= nat_fit compete by ValueRate in add_candidate and continuation_candidate (excluding oversized padded shapes > nat_fit). In select_plan() and phase_plan(), unmeasured interpolated winners return PlanOrigin::Discovery directly (preventing displacement by stale refresh probes and preventing unmeasured interpolated durations from entering PlanOrigin::AcceptanceStart), drain on first run as TimingOrigin::Discovery, and record real GPU timings. Solo prefill (age_price == 0.0), service_rates, and checkpoint planning are unchanged. - Chunkable non-terminal Prefill, resize capping, and hot-path caching (helios/src/scheduler.rs, policy.rs, service.rs): tightened resolve_prefill_kind_from so deferred_prefill never selects non-terminal- catalog shapes when needs_terminal is false; updated resize_prefill to select from terminal_prefill_catalog whenever request.deferred_prefill is active and cap age-priced non-terminal prefill growth at candidate.capacity; added prefill_must_complete_terminally_from and prefill_requires_terminal_completion_for_age; cached terminal_prefill_window and hoisted per-slot prefill planning state across capacities/continuations; kept the token_rate == 0.0 non-terminal Prefill fallback in service_rates. - Active-stream feedback barrier (helios/src/scheduler.rs): prefill_step_requires_feedback drains between non-terminal Prefill steps when an active Decode/Resume (decode_age_price > 0.0) or terminal-cleanup (terminal_age_price > 0.0) stream exists, preserving two-frame pipelining for solo prefill and --scheduler-policy throughput (decode_age_price = 0.0). - Added a GB10 simulator workload (scripts/scheduling_sim/workloads.py), unit and mutation-coverage regression tests, updated the deferred-prefill source mutation pattern in verification/helios-lifecycle/check.py, and reconciled present-state documentation (docs/scheduling-runtime-design.md, docs/scheduling-theory.md, helios/README.md). Existing signed cores load and serve unchanged. Result Live zero-re-export flare run A/B measurements with stock --scheduler-policy balanced (0.1) and --scheduler-policy throughput (0.0) (zero new CLI flags, DeepSeek-V4.1-Flash signed cores, zero errors, zero non-finite logprobs): - 4x RTX PRO 6000 (SM120 TP4, signed core gb202-tp4-202612010626, flare run --gpus 0,1,2,3 --max-concurrency 32 --mtp-draft-tokens 7 --mtp-adaptive-verification --mtp-max-verification-token-budget 128 --mtp-adaptive-verification-alpha 1.0 --scheduler-policy balanced --embedding-table-storage disk --embedding-table-cache-size 84GiB --embedding-table-workers 1 --embedding-table-resident-scales --kv-cache-limit memory --prefix-cache-memory 0): - Standalone pre-NVIDIA#663 (5d53040 vs fdb10bb): on 4 active decoders + staggered 14K+32K+64K prefills (T_50C, n=2), peak decode gap drops 331.9 -> 260.3 ms (-21.6%), mean max gap drops 279.7 -> 246.1 ms (-12.0%), and mean TPOT drops 6.10 -> 5.55 ms (-9.0%) for +1.8% makespan (3.164 -> 3.221 s). On tokbench mixed-c32 (FujitsuPolycom/tokbench d6b74524, C=32, seed 42, temperature 0.0, warmup 15s + measure 60s + drain 30s, n=1), >250 ms stalls drop 215 -> 78 (-63.7%), gap p99 drops 237.2 -> 188.6 ms (-20.5%), and per-user p50 rises 93.9 -> 99.2 tok/s (+5.7%) for -2.0% output (1,072.8 -> 1,050.8 tok/s). Solo 27.5K TTFT stays within +0.7% (540.7 -> 544.2 ms, n=1); solo C=1 short (464 tok, n=2) Trial 0 matches base (58.91 vs 58.58 ms; Trial 1 189.2 ms jitter). - Post-NVIDIA#663 stacked SM120 A/B (a3c80e1 base vs NVIDIA#663 vs NVIDIA#660+NVIDIA#661+NVIDIA#663, mixed-c32, n=1): standalone NVIDIA#663 raises mixed-c32 gap p99 from 227.3 to 286.0 ms and >250 ms stalls from 206 to 431; stacking NVIDIA#661 eliminates that regression, cutting gap p99 by -29.0% (286.0 -> 203.1 ms, -10.6% below pre-NVIDIA#663 base) and >250 ms stalls by -78.9% vs NVIDIA#663 (431 -> 91, -55.8% below pre-NVIDIA#663 base) while sustaining 97.8% SLO and 1,354.9 tok/s output. - 4x DGX Spark GB10 (SM121 TP4, signed core gb10-tp4-202612010243, pre-NVIDIA#656 571a447, n=3 trials, 12 decoders + 3x19.5K prompts): >1 s decode stalls drop 24 -> 0 (-100%), p99 ITL drops 1,670 -> 713 ms (-57.3%), max burst gap drops 1,699 -> 725 ms (-57.4%), trading +2.8% heavy TTFT p50 and -1.3% decode output. - 4x RTX PRO 6000 throughput control (pre-NVIDIA#656 571a447, --scheduler-policy throughput, n=2 across 3 workloads): prefill launches are bit-identical (28/24/19) and makespan stays within +0.3% (3.64 vs 3.65 s). - Host planning & calibrated simulation: 25-bucket dense-catalog plan() is 4.70x-8.65x faster than base 571a447 (55.8-196.0 us mean). All 21 existing workloads remain bit-identical under Python UtilityScheduler. Evidence Verified on a clean git archive of this commit atop 1fbcc3c (post-NVIDIA#663 main) via release cargo check (-D warnings) and cargo test (helios --features server and --features runtime-core,server, flare, flare-cli, and heliopause), pytest (core boundary and scheduling suites), ruff 0.12.8 lint, throttled scripts/scheduling_sim/learning.py smoke and screen presets (known, ttl, retained-refresh), and TLA+ lifecycle models, Rust trace conformance, and full source/model mutation testing (verification/helios-lifecycle/check.py --mutations). Standalone SM120 hardware A/B ran on direct pre-NVIDIA#663 predecessor fdb10bb (atop 5d53040) and stacked post-NVIDIA#663 SM120 A/B ran on 82f68ea8 (NVIDIA#660+NVIDIA#661+NVIDIA#663 atop a3c80e1), both prior to the resize_prefill deferred_prefill guard, select_plan() PlanOrigin::Discovery guard, doc sync, and rebase onto 1fbcc3c. Limitations: live flare run A/B benchmarks were not re-executed on this exact rebased SHA atop 1fbcc3c; gated Hugging Face chat-template tests require FLARE_TEST_TEMPLATE_DIR with gated repo credentials; cargo-kani was not run because completion-vector and StateView validators are unchanged. Discord: Dooner Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
29f2b5b to
c588d61
Compare
…l swap
Why
Under concurrent mixed prefill and decode load (multiple long cold prompts
competing alongside active decoders), prefill valuation in
helios/src/scheduler/policy.rs and scripts/scheduling_sim/utility.py has two
structural defects:
1. Scalar min_i(rem_i) collapse: clamping the decode-batch coalescing horizon
and expected speculative output across active decoders to min_i(rem_i)
collapses coalescing credit whenever one active decoder nears completion.
2. Multi-chunk prefill lockstep: ServicePrice::observe credits each
intermediate prefill chunk, dropping the executing prompt's normalized
price below untouched peers so long prompts advance in lockstep instead of
completing sequentially and freeing KV pages.
Averaging bounded per-decoder remaining budgets across active decoders prevents
single-stream collapse without inflating credit past the cohort's remaining
output. Recording planned normalized-entitlement swaps among competing
multi-chunk prefills at submission, projecting queued swaps across depth-2
pipelines, and applying the exchange only at validated completion conserves
aggregate prefill entitlement relative to active decoders while preserving
completion-only accounting and rejection safety.
What
- Helios scheduler (helios/src/scheduler.rs, helios/src/scheduler/policy.rs,
helios/src/scheduler/service.rs, helios/src/scheduler/utility.rs; +263/-39,
+224 net non-test Rust production LOC; zero CLI, config, decode, ABI, unsafe,
or lock changes):
- Replaced scalar min_i(rem_i) in coalescing_prefill_log_bonus with the
cohort mean across all active decoders for both speculative expected output
and the coalescing horizon (bounded by coalescing_horizon_tokens and each
prefiller's post-prefill output budget).
- Added ServicePrice::{log_normalized_share, swap_normalized_share},
best_prefill_chunk, stack-allocated heavy_prefill_donors (zero heap Vec
allocations), projected_services, and Submission::prefill_share_swap.
- Multi-chunk pairing activates only when active non-terminal decoders exist
(excluding retiring Snapshot requests), token_fairness > 0,
decode_age_price > 0 (inactive under --scheduler-policy throughput), and at
least two non-terminal, non-prompt_logprobs prefills exceed
prefill_chunk_size (including deferred TerminalPrefill chunks). Single-chunk
prefills (remaining <= prefill_chunk_size) are excluded even when the
highest-throughput chunk c_max is smaller than prefill_chunk_size.
- Submission records any non-self (recipient, donor) handle pair computed
from projected prices without mutating stored prices. Depth-2 projection
(projected_services) applies pending swaps before projecting queued frames.
observe_service executes swap_normalized_share only after
observed_duration_ns returns Some, verifying non-error status, positive
useful_tokens on the recipient, and matching live request handles.
- Python scheduling simulator (scripts/scheduling_sim/utility.py; +105/-7):
mirrored cohort-mean coalescing and weighted-conserving multi-chunk share
exchange (ranking and swapping log_price to conserve aggregate sum q_i across
unequal weights, gated on reference is not None, age_price > 0,
rate_history == "service", and remaining_prefill > max_prefill_cap, using
log-space urgency to avoid overflow on tiny durations, and validating
duration_ms and committed rows before mutating prices or clearing donors).
- Documentation and tests (+127/-35 docs; +784/-0 Rust tests; +245/-0 Python
tests): placed canonical specification and linear-aging preemption limits in
docs/scheduling-utility.md, reconciled docs/scheduling-runtime-design.md,
docs/scheduling-theory.md, and helios/README.md, and added unit tests
covering packed/unpacked speculative cohort-mean, zero-fairness/throughput
opt-out, prompt_logprobs exclusion, single-chunk exclusion below
prefill_chunk_size, arrival-wait aging and tie-breakers, completion-only
depth-2 pipelining, error/zero-timing invariance, Mixed prefill swaps, and
weighted Python conservation.
Result
Measured incrementally atop post-NVIDIA#663 main (1fbcc3c):
- All 21 standard simulator workloads in scripts/scheduling_sim/workloads.py
under both standard and mixed catalogs and both balanced and throughput
policies show zero regressions (0/21 changed).
- --scheduler-policy throughput (decode_age_price == 0) is byte-for-byte
unchanged by share swaps across all tested workloads.
- Under balanced policy on concurrent multi-chunk workloads alongside active
decoders (standard catalog): 2 decoders + 2x16k shifts heavy TTFTs from
[593.1, 678.4] ms to [383.9, 857.2] ms (first -35.3%, mean 320.1 -> 312.5 ms,
max_output_gap_ms unchanged at 217.3 ms, output_tok_s -1.9%, decode_age_area
+6.2%); 4 decoders + 4x16k shifts heavy TTFTs from [1436.0..1637.3] ms to
[788.0, 970.6, 1968.6, 2200.6] ms (first -45.1%, mean 773.5 -> 744.7 ms,
max_output_gap_ms 213.0 -> 226.6 ms, output_tok_s -2.4%, decode_age_area
+7.9%). On mixed catalog: 2 decoders + 2x16k shifts mean TTFT -17.2% (first
-36.9%, gap unchanged 145.0 ms, out -1.8%); 4 decoders + 4x16k shifts mean
TTFT -21.1% (first -57.4%, gap unchanged 114.7 ms, out -1.5%). Live
SM120/SM121 flare run GPU A/B is pending before upstream review.
Evidence
Verified on clean git archive (tree d0c622a) atop 1fbcc3c:
- Merge-tree: 0 conflicts vs upstream/main (1fbcc3c), NVIDIA#660 (9709d49),
NVIDIA#661 (c588d61), NVIDIA#665 (c5b3923), and composed main + NVIDIA#660 + NVIDIA#665.
- Rust builds & tests: RUSTFLAGS="-D warnings" cargo check --locked --release
across helios, flare, flare-cli, and heliopause passed with 0 warnings;
helios --features server --lib 1,284 passed; helios --features
runtime-core,server --lib 1,796 passed (excl. 6 FLARE_TEST_TEMPLATE_DIR
tests); flare --lib 246 passed; flare-cli 245 passed (0 failed).
- Python & simulator: pytest (test_core_boundary.py + test_scheduling*.py) 838
passed; ruff==0.12.8 0 issues; full 21-workload sweep under balanced and
throughput (standard + mixed catalogs).
- Formal & mutations: 10/10 standalone Java TLC configs, 8/8 observed Rust
TLA+ traces (594,065 transitions, 0 errors), 12/12 aux tests, 26/26 check.py
Rust lifecycle mutations + 13/13 TLA+ model mutations + 1/1 DispatchRing
SlotReuseSafe observed-edge check KILLED (0 survivors), plus 13/13 reachable
custom Rust PR mutations and 12/12 custom Python PR mutations KILLED.
- Limits: live SM120/SM121 flare run GPU A/B is pending; learning.py --preset
validate and cargo-kani were not run because their covered code is unchanged.
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedHead
Walkthrough
Merge Risk: Medium · up to
|
Why
In Helios's prepared-graph scheduler (`helios/src/scheduler/policy.rs`),
the per-prefill-token decode-batch coalescing bonus
(`coalescing_prefill_log_bonus`) prices the steady-state throughput gain
unlocked when queued prefills join an under-batched active decode cohort
over a bounded output-token horizon (`coalescing_horizon_tokens`, default
64.0). Previously, `coalescing_prefill_log_bonus` reduced all active
decoders' remaining output budgets to a single scalar minimum
(`peer_budget = peer_budget.min(rem)`), and the Python reference scheduler
(`scripts/scheduling_sim/utility.py`) used the same scalar minimum for the
coalescing horizon. Under heterogeneous mixed serving, any single active
decoder within one token of its output limit (`rem = 1`) collapsed both the
speculative per-round expected output (`mean_out`) and the coalescing
horizon to 1 token for the entire cohort, eliminating over 98% of the
coalescing incentive even when all other active decoders had large remaining
budgets.
Averaging per-decoder clamped budgets across the active cohort preserves
accurate continuation value when individual requests approach completion
while still shrinking smoothly as the cohort as a whole approaches its
output limit.
What
- In `helios/src/scheduler/policy.rs::coalescing_prefill_log_bonus` (+11/-10
lines, +1 net Rust production LOC; function visibility unchanged):
- Replace the scalar minimum `peer_budget` with a bounded per-decoder
remaining-budget array (`decoder_rems`), where each `rem` is an active
decoder's remaining output tokens.
- Compute speculative per-round expected output (`mean_out`) by clamping
`expected_at(width)` (speculative expected accepted tokens per round,
evaluated at `eff_width` in the packed branch and `width` in the
unpacked branch) to each active decoder's `rem` and averaging across
`decoder_rems[..decoder_count]`.
- Compute each prefiller's coalescing `horizon` by clamping each active
decoder's `rem` to `min(coalescing_horizon_tokens, post_prefill)`
(where `post_prefill` is the prefiller's remaining output budget after
its first generated token) and averaging across
`decoder_rems[..decoder_count]`.
- In `scripts/scheduling_sim/utility.py` (+2/-6, -4 net Python LOC): replace
`peer_budget = min(v.output_budget for v in decoders)` in the coalescing
horizon calculation with the cohort mean across active decoders, matching
Helios and the existing cohort-mean `mean_out` in `best_decode_rate`.
- In `docs/scheduling-runtime-design.md`: update the coalescing horizon
specification to reflect cohort-averaged per-decoder clamping.
- In `helios/src/scheduler/policy_tests.rs` and
`tests/test_scheduling_utility.py`: add unit tests covering pure Decode,
packed and full-width Speculative cohorts with a near-EOS (`rem = 1`)
decoder alongside a long decoder, single-decoder equivalence, and
zero-decoder / single-token-prefill no-op invariants.
Result
- Single-decoder cohorts and homogeneous-budget cohorts produce identical
values to the prior minimum formula.
- Mixed cohorts with one near-EOS decoder (`rem = 1`) and one long decoder
(`rem = 100`) retain a 32.5-token coalescing horizon instead of collapsing
to 1 token.
- Measured on `DeepSeek-V4.1-Flash` (`tokbench v0.3.0`, seed 42, temp 0,
base `1fbcc3c990b5`) on 4x NVIDIA RTX PRO 6000 Blackwell (SM120, TP4):
- Solo `long-context-mixed` (1-rep): +1.8% output (655.4 -> 667.3 tok/s),
stalled >250ms 28.1% -> 26.3%, -4.0% TTFT p50 (1,510 -> 1,449 ms),
+2.8 pp SLO (89.8% -> 92.6%).
- Solo `mixed-c32` (2-rep medians): -0.4% output (1,281.7 -> 1,276.8
tok/s), TTFT p50 1,425.3 -> 1,390.2 ms (-2.5%), stalled >250ms 11.29%
-> 11.49%, SLO 93.0% -> 91.1%.
- Solo `cold-heavy-mix` (1-rep): -3.7% output (541.8 -> 521.8 tok/s),
-9.0 pp SLO (88.1% -> 79.1%). Default-ON trade-off: keeping coalescing
active near EOS pulls competing 150K-250K cold prefills ahead of
decoders without chunk shrinking, raising `agentic_multiturn` TTFT p99
from 3,323 to 5,144 ms.
- Combined stack atop open PRs NVIDIA#660, NVIDIA#661, and NVIDIA#665 (attributed to that
composed stack):
- `mixed-c32` (2-rep medians): +1.4% output (1,374.6 -> 1,394.2 tok/s),
overall TTFT p50 1,001.0 -> 921.8 ms (-7.9%), stalled >250ms 4.82% ->
4.34% (-10.0% rel; spread [3.45%, 5.23%] vs [4.77%, 4.88%]), SLO
96.5% -> 97.1% (+0.6 pp). Trial-2 (1-trial rep): 233 -> 120 stalls,
Gap p99 230.2 -> 183.0 ms, `agentic_multiturn` TTFT p50 845 -> 681 ms
vs `heavy_prefill` 3,239 -> 7,551 ms.
- `long-context-mixed` (1-rep): output 707.8 -> 692.1 tok/s (-2.2%),
stalled >250ms 6.0% -> 4.0% (141 -> 94 stalls), SLO 94.1% -> 92.9%.
- `cold-heavy-mix` (1-rep): output 579.1 -> 574.0 tok/s (-0.9%), stalls
567 -> 672, cache hit 48.1% -> 52.8% (+4.7 pp).
- Measured on 4x NVIDIA DGX Spark GB10 (SM121, TP4, RoCEv2, signed core
`gb10-tp4-202612010547`, combined stack atop NVIDIA#660+NVIDIA#661+NVIDIA#665):
- `mixed-c8` (2-rep medians): output 128.4 -> 129.4 tok/s (+0.8%), TTFT
p50 1,181 -> 1,118 ms (-5.3%), stalled >250ms 41.8% -> 38.0%, SLO 79.0%
-> 81.7% (+2.7 pp).
- `agentic-coding` C=8 (1-rep): output 137.1 -> 135.0 tok/s (-1.5%), TTFT
p50 1,024 -> 877 ms (-14.4%), Gap p99 1,354 -> 725 ms (-46.5%), >1s
stalls 35 -> 12 (-65.7%), stalled >250ms 45.4% -> 34.5%, SLO 81.8% ->
85.7% (+3.9 pp), cache hit 74.6% -> 76.4%.
Evidence
Verified on clean `git archive` of tree `40596880cc64`:
- Rust (`RUSTFLAGS="-D warnings"`): `cargo check --locked --release` across
`eos`, `selene`, `selene-manager`, `helios` (`runtime-core,server`),
`flare`, `flare-cli` and `helios` tests -> 0 warnings.
- `cargo test --locked --release`: `helios --features server --lib` (1,283
passed, 15 ignored), `helios --features runtime-core,server --lib` (1,795
passed, 47 ignored), `flare --lib` (246 passed, 4 ignored), `flare-cli`
(245 passed, 3 ignored).
- Python (`pytest`): 853 passed across `tests/preparation/test_core_boundary.py`,
`tests/test_scheduling*.py`, and `tests/test_design_review_hook.py`.
- Scheduling simulator (`scripts/scheduling_sim`, 21 workloads x {std, mixed}
x {balanced, throughput}): 84/84 identical traces vs `1fbcc3c9`, 0
regressions.
- Cohort-mean mutation checks: reverting packed `mean_out`, Rust `horizon`,
and Python `utility.py` `horizon` back to `.min()` fails tests (3/3
reachable sites killed; the `!saw_packed` fallback branch in `policy.rs`
is structurally unreachable because `ActionCosts::duration(Speculative, b, w)`
queries `packed = b * w != 0` which `packed_round_shapes()` always yields).
- Formal lifecycle verification (`verification/helios-lifecycle/check.py`):
10/10 TLA+ configs, 8/8 observed Rust traces (594,065 edges) + negative
`DispatchRing SlotReuseSafe` check, 12/12 aux tests, 13/13 TLA+ model
mutations, and 26/26 Rust lifecycle mutations killed.
- `git merge-tree --write-tree`: clean against `1fbcc3c9`, NVIDIA#660 (`9709d496`),
NVIDIA#661 (`c588d610`), and NVIDIA#665 (`c5b39236`).
- Hardware binaries were built from unpushed local build trees `df9a8ebd`
(solo) and `dbbf65df` (stack) whose `helios/src/scheduler/policy.rs` is
byte-identical to this commit. SM120 `flare run` flags:
`--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`. External client harness
(`tokbench`): `python3 -m tokbench run --url http://127.0.0.1:8002
--scenario <mixed-c32|long-context-mixed|cold-heavy-mix> -c <32|20|32>
--warmup <15|15|20> --duration <75|90|120> --drain <20|30|45>
--repeats <2|1|1> --seed 42 --temperature 0`. Standalone GB10, other GPUs,
and other model recipes were not benchmarked.
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
c588d61 to
3d868f8
Compare
|
Updated the PR branch to Blocker 1 — 64-seed simulator timing gate, head SM120 A/B, and CI
Should Fix
Subtract / Simplify
Nits
Additional
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergeHead
Walkthrough
Merge Risk: Medium · up to
|
|
Review of 1. Should fix:
|
Why
In Helios's prepared-graph scheduler (`helios/src/scheduler/policy.rs`),
the per-prefill-token decode-batch coalescing bonus
(`coalescing_prefill_log_bonus`) prices the steady-state throughput gain
unlocked when queued prefills join an under-batched active decode cohort
over a bounded cohort-mean output horizon (`coalescing_horizon_tokens`,
default 64.0). Previously, `coalescing_prefill_log_bonus` reduced all
active decoders' remaining output budgets to a single scalar minimum
(`peer_budget = peer_budget.min(rem)`), and the Python reference scheduler
(`scripts/scheduling_sim/utility.py`) used the same scalar minimum for the
coalescing horizon (while already averaging per-decoder expected output
`mean_out` across active decoders in `best_decode_rate`). Under
heterogeneous mixed serving, any single active decoder within one token of
its output limit (`rem = 1`) collapsed both Rust's speculative per-round
expected output (`mean_out`) and both implementations' coalescing `horizon`
to 1 token for the entire cohort, eliminating over 98% of the coalescing
incentive even when all other active decoders had large remaining budgets.
Averaging per-decoder clamped budgets across the active cohort repairs the
Rust-to-simulator `mean_out` parity gap and extends cohort averaging to the
coalescing `horizon`, preserving continuation value when individual requests
approach completion while still shrinking smoothly as the cohort approaches
its output limit.
What
- In `helios/src/scheduler/policy.rs::coalescing_prefill_log_bonus`
(+16/-18 lines, -2 net Rust production LOC; visibility unchanged):
- Replace the scalar minimum `peer_budget` with a bounded per-decoder
remaining-budget array (`decoder_rems`), where each `rem` is an active
decoder's remaining output tokens clamped by KV sequence headroom
(`max_sequence_tokens - scheduled_consumed`).
- Extract local helper `mean_capped(rems: &[usize], cap: f64) -> f64`,
hoist `expected_at(eff_width)` and `expected_at(width as f64)` out of
the per-decoder loop, and delete provably dead `.max(1.0)` clamps and
the unreachable `if horizon > 0.0` branch while keeping the
`per_token.is_finite() && per_token > 0.0` guard.
- Compute speculative per-round expected output (`mean_out`, parity with
`utility.py`) and each prefiller's coalescing `horizon` (clamped to
`min(coalescing_horizon_tokens, post_prefill)`, where `post_prefill` is
the prefiller's remaining output budget after its first generated token)
via `mean_capped`.
- In `scripts/scheduling_sim/utility.py` (+2/-6, -4 net Python production
LOC): replace `peer_budget = min(v.output_budget for v in decoders)` in
the coalescing horizon calculation with the cohort mean across active
decoders, matching Helios and `best_decode_rate`'s existing cohort-mean
`mean_out`.
- In `docs/scheduling-runtime-design.md`: update the coalescing horizon
specification to describe the bounded cohort-mean decode horizon and
per-decoder clamped cohort averaging.
- In `helios/src/scheduler/policy_tests.rs` and
`tests/test_scheduling_utility.py`: add unit tests covering `[1, 100]`
and `n=3` `[1, 20, 100]` heterogeneous cohorts, Rust-specific KV-headroom
clamping, packed and unpacked speculative cohorts (reusing
`super::rounds::forecast_tokens`), single-decoder equivalence, zero-bonus
invariants, and an end-to-end `scripts/scheduling_sim` heterogeneous-budget
test (`max_new_tokens < 64`) under `balanced` (`age_price = 0.1`).
Result
- Single-decoder and homogeneous-budget cohorts produce identical values to
the prior minimum formula; a `[1, 100]` cohort retains a 32.5-token
horizon instead of collapsing to 1 token.
- End-to-end `scripts/scheduling_sim` (`catalog()`, `balanced`,
`age_price = 0.1`, cohort-mean vs prior `min(rem, ph)` horizon):
- Non-speculative (`short0` `max_new_tokens=8` + 3 long decoders + 4
queued 4K prefills): makespan 7,779.0 -> 7,734.0 ms (-45.0 ms), mean
prefill TTFT 266.8 -> 201.0 ms (-24.6%), max prefill TTFT 373.0 ->
327.0 ms (-12.3%), max output gap 226.0 -> 182.0 ms (-19.5%).
- Speculative (`short0` `max_new_tokens=32` + 3 long decoders + 5 queued
4K prefills): makespan 1,912.0 -> 1,878.0 ms (-34.0 ms), mean prefill
TTFT 293.6 -> 266.4 ms (-9.3%), max prefill TTFT 468.0 -> 432.0 ms
(-7.7%), max output gap 278.0 -> 212.0 ms (-23.7%).
- Measured on `DeepSeek-V4.1-Flash` (`FujitsuPolycom/tokbench`, seed 42,
temp 0, base `1fbcc3c990b5`) on 4x RTX PRO 6000 Blackwell (SM120, TP4)
and 4x DGX Spark GB10 (SM121, TP4, `gb10-tp4-202612010547`):
- Solo on `1fbcc3c9`: `long-context-mixed` (1-rep) +1.8% output (655.4 ->
667.3 tok/s), stalls 28.1% -> 26.3%, SLO 89.8% -> 92.6%; `mixed-c32`
(2-rep) output 1,281.7 -> 1,276.8 tok/s, TTFT p50 1,425 -> 1,390 ms,
stalls 11.29% -> 11.49%, SLO 93.0% -> 91.1%; `cold-heavy-mix` (1-rep)
regresses output 541.8 -> 521.8 tok/s (-3.7%) and SLO 88.1% -> 79.1%
(-9.0 pp, `agentic_multiturn` TTFT p99 3,323 -> 5,144 ms) because
keeping coalescing active near EOS pulls 150K-250K cold prefills ahead
of decoders without `NVIDIA#661` chunk shrinking.
- Atop `NVIDIA#661` (`3d868f84`, primary stall reduction from `NVIDIA#661`):
`mixed-c32` (2-rep med) output 1,254 -> 1,261 tok/s, stalls 6.65% ->
5.95%, TTFT p50 1,479 -> 1,439 ms, SLO 89.4% -> 90.5%;
`long-context-mixed` (1-rep) stalls 16.4% -> 9.8% while SLO dropped
89.3% -> 82.1% (-7.2 pp); `cold-heavy-mix` (1-rep) output 545.6 ->
547.8 tok/s, stalls 56.3% -> 55.7%, SLO 81.6% -> 79.8%.
- Composed 4-PR stack (`NVIDIA#660 + NVIDIA#661 + NVIDIA#665`, where prefix-cache hit-rate
gains come from `NVIDIA#665` and primary stall cuts from `NVIDIA#661`): SM120
`mixed-c32` (2-rep) output 1,374.6 -> 1,394.2 tok/s (+1.4%), stalls
4.82% -> 4.34%, TTFT p50 1,001 -> 922 ms (-7.9%), SLO 96.5% -> 97.1%;
GB10 `mixed-c8` (2-rep) stalls 41.8% -> 38.0%, TTFT p50 1,181 -> 1,118
ms, SLO 79.0% -> 81.7%; GB10 `agentic-coding` C=8 (1-rep) stalls 45.4%
-> 34.5%, TTFT p50 1,024 -> 877 ms, SLO 81.8% -> 85.7%.
Evidence
Verified on clean `git archive` of tree `fe2b8739991e`:
- Rust (`RUSTFLAGS="-D warnings"`): `cargo check --locked --release` across
`eos`, `selene`, `selene-manager`, `helios` (`runtime-core,server --tests`),
`flare`, `flare-cli` -> 0 warnings.
- `cargo test --locked --release`: `eos` (12 passed), `selene --features
test-support` (553 passed), `selene-manager --features test-support`
(426 passed, 1 ignored), `helios --features server --lib` (1,283 passed,
15 ignored), `helios --features runtime-core,server --lib` (1,795 passed,
47 ignored), `flare --lib` (246 passed, 4 ignored), `flare-cli` (245
passed, 3 ignored).
- Python: `ruff==0.12.8` passed on modified Python files; `pytest` passed
(854 passed across `tests/preparation/test_core_boundary.py`,
`tests/test_scheduling*.py`, and `tests/test_design_review_hook.py`,
including `test_coalescing_heterogeneous_budget_end_to_end_balanced`).
- Fault mutation checks (scratch copies): reverting `scripts/scheduling_sim/
utility.py` `horizon` to `min(ph, min(output_budget))` failed both
`test_coalescing_heterogeneous_budget_end_to_end_balanced` and
`test_coalescing_horizon_averages_active_decoder_budgets`; reverting
`helios/src/scheduler/policy.rs::mean_capped` to `.min()` failed both
Rust coalescing unit tests (`2/2` killed).
- `git merge-tree --write-tree`: clean (`rc=0`) against `main` (`4cc6f2fd`),
`2acc3f3a`, `NVIDIA#660` (`9709d496`), `NVIDIA#661` (`3d868f84`), and `NVIDIA#665`
(`c5b39236`).
- Hardware binaries were built from earlier equivalent trees `df9a8ebd`
(solo), `38130855` (on `NVIDIA#661`), and `dbbf65df` (stack) before the
semantics-preserving `mean_capped` / hoist refactor; final rebase onto
`main` after `NVIDIA#661` lands and CI/A/B confirmation on the rebased head
remain pending. Standalone GB10, other GPUs, and other recipes were not
benchmarked.
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
…ced streams Why: Under `--scheduler-policy balanced` (`decode_age_price = 0.1`), Helios interleaves prefill chunks with decode without mixed graphs. On `TERMINAL_PREFILL` cores (`256..=16384` alongside `PREFILL` `128..=16384`), cold prompts stall active decoders: unmeasured smaller `Prefill` shapes are skipped, tails `<= max_terminal` run as a single `TerminalPrefill`, and non-terminal `Prefill` fills both submission frames. Splitting a prompt whose uncached suffix at admission fits in one eligible prefill graph also resets `first_output_wait_ns` on every non-terminal `Prefill` chunk, and when the completing `TerminalPrefill` chunk lands on an interior checkpoint cut before `prompt_tokens`, pricing `first_output_value` only on that stub's tokens undervalues completion of the deferred segment. What: Changes 4 non-test Rust production files (`+236` net LOC, `+376/-140` atop `1fbcc3c9`, `15` files total `+2,778/-186`, no CLI flags, no `unsafe`, no hardcoded capacities, and no ABI changes): - Discovery (`helios/src/scheduler/cost.rs`, `policy.rs`): Adds `interpolated_prefill_duration` (same-capacity sibling, else linear interpolation between the nearest smaller peer or decode floor and nearest larger peer; `ScoredPrefill` remains isolated). Under `age_price > 0.0`, `prefill_candidate_ns` prices unmeasured shapes `<= nat_fit` in `add_prefill_candidate` and `continuation_candidate`; unmeasured winners return `PlanOrigin::Discovery`. - Chunking, service rates, wait clock, reconciled cut credit, and drain (`helios/src/scheduler.rs`, `policy.rs`, `service.rs`): Permits legal non-terminal `Prefill` chunks below `max_terminal` while active age-priced streams exist, restricts `deferred_prefill` and `resize_prefill` to `TERMINAL_PREFILL` capacities, caps age-priced `resize_prefill` growth at `candidate.capacity`, caches `terminal_prefill_window`, aligns `service_rates` via `prefill_must_complete_terminally_from`, preserves `first_output_wait_ns` in `preserves_first_output_wait` across non-terminal `Prefill` chunks without a checkpoint capture when the admission prompt fits in one eligible prefill graph, credits `first_output_value` across the reconciled segment `(end - prefix_tokens) / initial_prefill` in `lane_value_for_tokens_within` when a deferred `TerminalPrefill` chunk on such a prompt lands on `estimated_checkpoint_cut` before `prompt_tokens` (leaving token-work credit proportional to chunk tokens), and drains non-terminal `Prefill` in `prefill_step_requires_feedback`. `PolicyConfig::throughput()` (`decode_age_price = 0.0`, `terminal_age_price = 1.0`) keeps solo and decoder-concurrent prefills pipelined and drains only when `terminal_cleanup` is active. - Simulator, formal checks, tests, and docs: Models `interpolated` discovery in `scripts/scheduling_sim/`, updates `verification/helios-lifecycle/check.py`, adds scheduler unit tests in `helios/src/scheduler/policy_tests.rs`, and syncs `docs/scheduling-runtime-design.md`, `docs/scheduling-theory.md`, and `helios/README.md`. Existing signed model cores load unchanged. Result: On the 64-seed timing validation catalog (`scripts/scheduling_sim/learning.py --preset validate --reference ttl`, `15,872` runs), `retained-refresh` (`alpha=0.002`, `interpolated`) is ACCEPTED (`35/35` vs `ttl` geomean `1.0100x`; `35/35` vs `native`, `-17.5%` to `-27.0%` p99 TTFT on `prefill-16-decoders-*`; `0` diffs across `2,112` solo/zero-age pairs; `6/6` recovery; calibration PASS; `0/64` resets). On SM120 TP4 `flare run` (`4x NVIDIA RTX PRO 6000 Blackwell Workstation Edition`, `DeepSeek-V4.1-Flash` core `gb202-tp4-202612010626`, `--scheduler-policy balanced`, `--max-concurrency 32`, `0` server errors, `100.0%` clean) against base `1fbcc3c9`: - `mixed-c32` (`C=32`, `n=2`): `>250ms` stalls `538 -> 365` (`-32.2%`, 2-rep median stalled time `11.39% -> 6.65%`), burst gap p99 `261.5 -> 254.7 ms`, per-user decode `66.0 -> 67.8 tok/s`, 2-rep median output `1,273.0 -> 1,254.4 tok/s` (`-1.5%`), TTFT p50 `1,423 -> 1,479 ms`, 2-rep median SLO `91.05% -> 89.40%` (`long_decode` `93.8% -> 93.8%`, `agentic_multiturn` `87.2% -> 90.6%`), cache hit `47.3% -> 48.6%`. - `long-context-mixed` (`C=20`, `n=1`): `>250ms` stalls `863 -> 503` (`-41.7%`, stalled time `27.4% -> 16.4%`), output `661.3 -> 670.5 tok/s` (`+1.4%`), per-user decode `73.7 -> 77.1 tok/s` (`p10 54.5 -> 59.9`), TTFT p50 `1,476 -> 1,503 ms`, burst gap p99 `263.7 -> 256.4 ms`, SLO `94.8% -> 89.3%`. - `cold-heavy-mix` (`C=32`, `n=1`): output `534.8 -> 545.6 tok/s` (`+2.0%`), TTFT p50 `1,922 -> 1,713 ms` (`-10.9%`), TTFT p99 `81,032 -> 80,986 ms`, burst gap p99 `298.4 -> 278.2 ms` (`-6.8%`), `>250ms` stalls `2,988 -> 2,732` (`62.9% -> 56.3%`), SLO `89.0% -> 81.6%`. - `T_50C` (`n=2`, 4 decoders + staggered cold `14K/32K/64K` prefills): mean TPOT `7.12 -> 6.70 ms`, p95 gap `14.4 -> 14.1 ms`, peak gap `277.4 -> 433.7 ms` (`t0 218.7 ms`, `t1 433.7 ms`), mean max gap `229.3 -> 243.8 ms`, makespan `2.813 -> 2.906 s`. Users prioritizing peak batch fill over decode smoothness can select `--scheduler-policy throughput`. Evidence: Verified on exact tree `c1d6858bc71bb3b877da986d69960f56974df8b5` atop `1fbcc3c990b5ee603de74587e119e9fa55771f3d` from clean `git archive` extracts: - `cargo check --locked --release` (`RUSTFLAGS="-D warnings"`): 7/7 crates PASS (`0` warnings: `eos`, `selene --features test-support`, `selene-manager --features test-support`, `helios --features runtime-core,server`, `flare`, `flare-cli`, `heliopause`). - `cargo test --locked --release`: 7/7 crates PASS (`3,590` passed, `0` failed, `98` ignored; `flare-cli` run with `--test-threads=1` to avoid Linux concurrent fork/exec `ETXTBSY`). - `python3 verification/helios-lifecycle/check.py --jobs 16 --mutations`: PASS (all TLA+ configs, `13/13` TLA+ mutations, `8/8` observed Rust trace models / `594,065` transitions + negative `DispatchRing SlotReuseSafe`, `26/26` Rust source mutations). - Python and lint: `pytest tests/preparation/test_core_boundary.py tests/test_scheduling*.py` `839/839` passed; `ruff==0.12.8 check` `0` errors. - 64-seed `learning.py --preset validate` carries over unchanged with byte-identical `scripts/scheduling_sim/`, `cost.rs`, `scheduler.rs`, `service.rs`, and `utility.rs`. - Limitations: `cargo-kani` is not installed on the build host; GB10 hardware was not re-measured on this tree; `long-context-mixed` and `cold-heavy-mix` are single-repeat runs (`n=1`). Discord: Dooner Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Why `ActionCosts::interpolated_prefill_duration` in `helios/src/scheduler/cost.rs` included `GraphKind::Resume` when computing `decode_floor`, the zero-token forward-pass floor used to linearly interpolate unmeasured pure-prefill capacities when no smaller prefill peer has been measured. Because `GraphKind::Resume` runs only vocabulary projection and sampling from a checkpoint's saved final hidden vector rather than a full transformer forward pass, its GPU duration (~0.5-1 ms) is an order of magnitude below full-model weight-read latency (~18-30 ms). Once any prefix-cached request ran `Resume`, `decode_floor` collapsed to LM-head latency, severely underestimating unmeasured small prefill buckets and biasing cold discovery toward tiny chunks. What - `helios/src/scheduler/cost.rs`: narrowed `decode_floor` matching in `ActionCosts::interpolated_prefill_duration` from `GraphKind::Decode | GraphKind::Speculative | GraphKind::Resume` to `GraphKind::Decode | GraphKind::Speculative`, aligning Rust with the forward-pass floor contract and `scripts/scheduling_sim/learning_policy.py`. - `helios/src/scheduler/cost.rs`: added unit test `interpolated_prefill_duration_excludes_resume_from_decode_floor` covering `Resume`-only (returns `None`), `Decode` + faster `Resume`, and `Speculative` + faster `Resume`. Result - Observed in CPU unit tests: with `Prefill(16384) = 225 ms` and `Resume = 0.5 ms`, `interpolated_prefill_duration(Prefill, 128)` returns `None` until a full forward-pass decode graph is measured, and interpolates from the `Decode` (18 ms) or `Speculative` (15 ms) floor thereafter instead of `Resume`. - Expected in live serving: workloads with prefix-cache `Resume` hits retain realistic forward-pass duration estimates during cold prefill discovery rather than over-selecting tiny unmeasured prefill capacities. Evidence - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib scheduler::`: 445 passed, 0 failed, 4 ignored. - `RUSTFLAGS="-D warnings" cargo check --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --tests --target-dir flare-cli/target`: passed with 0 warnings. - `.venv/bin/python -m pytest tests/test_scheduling_sim.py tests/test_scheduling_utility.py tests/test_scheduling_learning_policy.py tests/test_scheduling_learning_experiments.py tests/preparation/test_core_boundary.py -q`: 510 passed. - `python3 verification/helios-lifecycle/check.py --tlc-jar /home/luke/.cache/flare-formal/tla2tools-1.7.4.jar --target-dir flare-cli/target --jobs 16 --mutations`: passed all TLA+ models, 8 observed Rust trace models (621,390 transitions), and all Rust and TLA+ mutation checks. - Limitations: live GPU serving benchmarks were not re-run in this environment; in the sandboxed full-crate `helios` run (1,814 passed), 13 `engram` `io_uring` tests failed under sandbox seccomp (`ENOSYS`) and 6 chat-template tests failed without `FLARE_TEST_TEMPLATE_DIR`. Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b Signed-off-by: Luke Alonso <lalonso@gmail.com>
3d868f8 to
b68e579
Compare
Why
In Helios's prepared-graph scheduler (`helios/src/scheduler/policy.rs`),
the per-prefill-token decode-batch coalescing bonus
(`coalescing_prefill_log_bonus`) prices the steady-state throughput gain
unlocked when queued prefills join an under-batched active decode cohort
over a bounded cohort-mean output horizon (`coalescing_horizon_tokens`,
default 64.0). Previously, `coalescing_prefill_log_bonus` reduced all
active decoders' remaining output budgets to a single scalar minimum
(`peer_budget = peer_budget.min(rem)`), and the Python reference scheduler
(`scripts/scheduling_sim/utility.py`) used the same scalar minimum for the
coalescing horizon (while already averaging per-decoder expected output
`mean_out` across active decoders in `best_decode_rate`). Under
heterogeneous mixed serving, any single active decoder within one token of
its output limit (`rem = 1`) collapsed both Rust's speculative per-round
expected output (`mean_out`) and both implementations' coalescing `horizon`
to 1 token for the entire cohort, eliminating over 98% of the coalescing
incentive even when all other active decoders had large remaining budgets.
Averaging per-decoder clamped budgets across the active cohort repairs the
Rust-to-simulator `mean_out` parity gap and extends cohort averaging to the
coalescing `horizon`, preserving continuation value when individual requests
approach completion while still shrinking smoothly as the cohort approaches
its output limit.
What
- In `helios/src/scheduler/policy.rs::coalescing_prefill_log_bonus`
(+16/-18 lines, -2 net Rust production LOC; visibility unchanged):
- Replace the scalar minimum `peer_budget` with a bounded per-decoder
remaining-budget array (`decoder_rems`), where each `rem` is an active
decoder's remaining output tokens clamped by KV sequence headroom
(`max_sequence_tokens - scheduled_consumed`).
- Extract local helper `mean_capped(rems: &[usize], cap: f64) -> f64`,
hoist `expected_at(eff_width)` and `expected_at(width as f64)` out of
the per-decoder loop, and delete provably dead `.max(1.0)` clamps and
the unreachable `if horizon > 0.0` branch while keeping the
`per_token.is_finite() && per_token > 0.0` guard.
- Compute speculative per-round expected output (`mean_out`, parity with
`utility.py`) and each prefiller's coalescing `horizon` (clamped to
`min(coalescing_horizon_tokens, post_prefill)`, where `post_prefill` is
the prefiller's remaining output budget after its first generated token)
via `mean_capped`.
- In `scripts/scheduling_sim/utility.py` (+2/-6, -4 net Python production
LOC): replace `peer_budget = min(v.output_budget for v in decoders)` in
the coalescing horizon calculation with the cohort mean across active
decoders, matching Helios and `best_decode_rate`'s existing cohort-mean
`mean_out`.
- In `docs/scheduling-runtime-design.md`: update the coalescing horizon
specification to describe the bounded cohort-mean decode horizon and
per-decoder clamped cohort averaging.
- In `helios/src/scheduler/policy_tests.rs` and
`tests/test_scheduling_utility.py`: add unit tests covering `[1, 100]`
and `n=3` `[1, 20, 100]` heterogeneous cohorts, Rust-specific KV-headroom
clamping, packed and unpacked speculative cohorts (reusing
`super::rounds::forecast_tokens`), single-decoder equivalence, zero-bonus
invariants, and an end-to-end `scripts/scheduling_sim` heterogeneous-budget
test (`max_new_tokens < 64`) under `balanced` (`age_price = 0.1`).
Result
- Single-decoder and homogeneous-budget cohorts produce identical values to
the prior minimum formula; a `[1, 100]` cohort retains a 32.5-token
horizon instead of collapsing to 1 token.
- End-to-end `scripts/scheduling_sim` (`catalog()`, `balanced`,
`age_price = 0.1`, cohort-mean vs prior `min(rem, ph)` horizon):
- Non-speculative (`short0` `max_new_tokens=8` + 3 long decoders + 4
queued 4K prefills): makespan 7,779.0 -> 7,734.0 ms (-45.0 ms), mean
prefill TTFT 266.8 -> 201.0 ms (-24.6%), max prefill TTFT 373.0 ->
327.0 ms (-12.3%), max output gap 226.0 -> 182.0 ms (-19.5%).
- Speculative (`short0` `max_new_tokens=32` + 3 long decoders + 5 queued
4K prefills): makespan 1,912.0 -> 1,878.0 ms (-34.0 ms), mean prefill
TTFT 293.6 -> 266.4 ms (-9.3%), max prefill TTFT 468.0 -> 432.0 ms
(-7.7%), max output gap 278.0 -> 212.0 ms (-23.7%).
- Measured on `DeepSeek-V4.1-Flash` (`FujitsuPolycom/tokbench`, seed 42,
temp 0, base `1fbcc3c990b5`) on 4x RTX PRO 6000 Blackwell (SM120, TP4)
and 4x DGX Spark GB10 (SM121, TP4, `gb10-tp4-202612010547`):
- Solo on `1fbcc3c9`: `long-context-mixed` (1-rep) +1.8% output (655.4 ->
667.3 tok/s), stalls 28.1% -> 26.3%, SLO 89.8% -> 92.6%; `mixed-c32`
(2-rep) output 1,281.7 -> 1,276.8 tok/s, TTFT p50 1,425 -> 1,390 ms,
stalls 11.29% -> 11.49%, SLO 93.0% -> 91.1%; `cold-heavy-mix` (1-rep)
regresses output 541.8 -> 521.8 tok/s (-3.7%) and SLO 88.1% -> 79.1%
(-9.0 pp, `agentic_multiturn` TTFT p99 3,323 -> 5,144 ms) because
keeping coalescing active near EOS pulls 150K-250K cold prefills ahead
of decoders without `#661` chunk shrinking.
- Atop `#661` (`3d868f84`, primary stall reduction from `#661`):
`mixed-c32` (2-rep med) output 1,254 -> 1,261 tok/s, stalls 6.65% ->
5.95%, TTFT p50 1,479 -> 1,439 ms, SLO 89.4% -> 90.5%;
`long-context-mixed` (1-rep) stalls 16.4% -> 9.8% while SLO dropped
89.3% -> 82.1% (-7.2 pp); `cold-heavy-mix` (1-rep) output 545.6 ->
547.8 tok/s, stalls 56.3% -> 55.7%, SLO 81.6% -> 79.8%.
- Composed 4-PR stack (`#660 + #661 + #665`, where prefix-cache hit-rate
gains come from `#665` and primary stall cuts from `#661`): SM120
`mixed-c32` (2-rep) output 1,374.6 -> 1,394.2 tok/s (+1.4%), stalls
4.82% -> 4.34%, TTFT p50 1,001 -> 922 ms (-7.9%), SLO 96.5% -> 97.1%;
GB10 `mixed-c8` (2-rep) stalls 41.8% -> 38.0%, TTFT p50 1,181 -> 1,118
ms, SLO 79.0% -> 81.7%; GB10 `agentic-coding` C=8 (1-rep) stalls 45.4%
-> 34.5%, TTFT p50 1,024 -> 877 ms, SLO 81.8% -> 85.7%.
Evidence
Verified on clean `git archive` of tree `fe2b8739991e`:
- Rust (`RUSTFLAGS="-D warnings"`): `cargo check --locked --release` across
`eos`, `selene`, `selene-manager`, `helios` (`runtime-core,server --tests`),
`flare`, `flare-cli` -> 0 warnings.
- `cargo test --locked --release`: `eos` (12 passed), `selene --features
test-support` (553 passed), `selene-manager --features test-support`
(426 passed, 1 ignored), `helios --features server --lib` (1,283 passed,
15 ignored), `helios --features runtime-core,server --lib` (1,795 passed,
47 ignored), `flare --lib` (246 passed, 4 ignored), `flare-cli` (245
passed, 3 ignored).
- Python: `ruff==0.12.8` passed on modified Python files; `pytest` passed
(854 passed across `tests/preparation/test_core_boundary.py`,
`tests/test_scheduling*.py`, and `tests/test_design_review_hook.py`,
including `test_coalescing_heterogeneous_budget_end_to_end_balanced`).
- Fault mutation checks (scratch copies): reverting `scripts/scheduling_sim/
utility.py` `horizon` to `min(ph, min(output_budget))` failed both
`test_coalescing_heterogeneous_budget_end_to_end_balanced` and
`test_coalescing_horizon_averages_active_decoder_budgets`; reverting
`helios/src/scheduler/policy.rs::mean_capped` to `.min()` failed both
Rust coalescing unit tests (`2/2` killed).
- `git merge-tree --write-tree`: clean (`rc=0`) against `main` (`4cc6f2fd`),
`2acc3f3a`, `#660` (`9709d496`), `#661` (`3d868f84`), and `#665`
(`c5b39236`).
- Hardware binaries were built from earlier equivalent trees `df9a8ebd`
(solo), `38130855` (on `#661`), and `dbbf65df` (stack) before the
semantics-preserving `mean_capped` / hoist refactor; final rebase onto
`main` after `#661` lands and CI/A/B confirmation on the rebased head
remain pending. Standalone GB10, other GPUs, and other recipes were not
benchmarked.
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
Why
With
--scheduler-policy balanced(decode_age_price = 0.1), Helios interleaves prefill and decode without mixed graphs. OnTERMINAL_PREFILLcores (256..=16384alongsidePREFILL128..=16384), cold prompts stall active decoders: unmeasured smallerPrefillshapes are skipped, prompt tails at or belowmax_terminalforce a singleTerminalPrefill, non-terminalPrefillsteps fill both dispatch frames, splitting a single-graph prompt resetsfirst_output_wait_ns, and deferredTerminalPrefillcompletions at an interior cut creditfirst_output_valueonly for the final stub tokens.What
+236net non-test Rust production LOC (+376/-140across 4 files; 15 files total,+2,778/-186atop1fbcc3c9; zero new CLI flags,unsafe, hardcoded capacities, or ABI changes; signed model cores unchanged):cost.rs,policy.rs): AddsActionCosts::interpolated_prefill_duration(uses a measured sibling at the same capacity if present, else linearly interpolates between the nearest smaller measured peer or fastest decode floor and the nearest larger measured peer; keepsScoredPrefillisolated). Whenage_price > 0.0,prefill_candidate_nsscores unmeasured capacities up to natural fit inadd_prefill_candidateandcontinuation_candidate, tagging winners asPlanOrigin::Discovery.scheduler.rs,policy.rs,service.rs): Unblocks non-terminalPrefillbelowmax_terminalunder active age-priced streams, restrictsdeferred_prefillandresize_prefilltoTERMINAL_PREFILL, caps age-pricedresize_prefillgrowth atcandidate.capacity, cachesterminal_prefill_window, alignsservice_ratesviaprefill_must_complete_terminally_from, retainsfirst_output_wait_ns(preserves_first_output_wait) across capture-free non-terminalPrefillon single-graph prompts, credits(end - prefix_tokens) / initial_prefillinlane_value_for_tokens_withinfor deferredTerminalPrefillsteps landing at an interior checkpoint cut, and drains non-terminalPrefillsteps viaprefill_step_requires_feedback.PolicyConfig::throughput()(decode_age_price = 0.0) keeps two-framePrefillpipelining across active decode and resume streams, draining only when a finishingterminal_cleanupstream is resident (terminal_age_price > 0.0).initial_discovery = "interpolated"inscripts/scheduling_sim, updatesverification/helios-lifecycle/check.pymutations, adds unit and simulator tests, and updates runtime, theory, and README documentation.Result
scripts/scheduling_sim/learning.py --preset validate --reference ttl, 15,872 runs):retained-refresh(alpha = 0.002,initial_discovery = "interpolated") ACCEPTED (35/35vsttlat1.0100x;35/35vsnativewith-17.5%to-27.0%p99 TTFT onprefill-16-decoders-*;0diffs across2,112solo/zero-age pairs;6/6recovery checks passed; calibration passed;0/64resets).flare runA/B (3d868f84/ treec1d6858bvsmain1fbcc3c9, 4x RTX PRO 6000,DeepSeek-V4.1-Flash,--scheduler-policy balanced, 0 server errors, 100% clean responses):mixed-c32(2)long-context-mixed(1)cold-heavy-mix[1] (1)Workloads come from
FujitsuPolycom/tokbench(v0.4.0, closed-loop client,--seed 42 --temperature 0.0). SLO passes when a request achieves at least15 tok/sper-user decode speed and meets its class TTFT target (<= 2 sinteractive,<= 3 sagentic and long-decode,<= 10 s/30 s/45 sheavy prefill):mixed-c32runs 32 concurrent clients (10 interactive chat at 0.7K–2.2K tokens, 12 multi-turn coding agents at 3.5K–8K tokens sharing a 2K prefix, 4 cold prefills at 10K–22K tokens, and 6 long-decode streams generating 480–850 tokens);long-context-mixedruns 20 clients (6 interactive at 1K–3K, 8 multi-turn agents at 12K–24K, and 6 cold prefills at 32K–128K tokens);cold-heavy-mix(-c 32) splits 32 clients evenly between multi-turn agents (4.5K–10K) and cold prefills (150K–250K).Across two
mixed-c32repeats, medians were output1,273 -> 1,254 tok/s(-1.5%), stalled decode time11.4% -> 6.7%(-41.6%), SLO91.1% -> 89.4%(long_decode93.8%,agentic_multiturn87.2% -> 90.6%), and prefix cache hit rate47.3% -> 48.6%. In a cold-burst micro-probe (4 active decoders plus staggered14K,32K, and64Kcold prefills,n=2), TPOT moved7.12 -> 6.70 ms, p95 gap14.4 -> 14.1 ms, mean max gap229.3 -> 243.8 ms, peak gap277.4 -> 433.7 ms(trial 0: 218.7 ms), and makespan2.81 -> 2.91 s. [1] Incold-heavy-mix,4 -> 7heavy-prefill requests hit client-side 45 s drain cutoffs under KV saturation (0server errors). Opt-out:--scheduler-policy throughput.Evidence
3d868f84/ treec1d6858b):cargo check --locked --release(RUSTFLAGS="-D warnings") andcargo test --locked --releasepassed across all 7 crates (3,590passed,0failed;flare-clirun with--test-threads=1);verification/helios-lifecycle/check.py --jobs 16 --mutationspassed (13/13TLA+ mutations,8/8observed traces /594,065transitions plusDispatchRing SlotReuseSafe,26/26Rust mutations);pytest839/839passed;uvx ruff==0.12.8 checkreported0errors; 64-seedlearning.pyresult carries over via unchangedscripts/scheduling_sim/*,cost.rs,scheduler.rs,service.rs, andutility.rs.flare runflags:--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.cargo-kaniis not installed on the build host; GB10 was not re-measured on3d868f84;long-context-mixedandcold-heavy-mixran single repeats (n=1).Discord: Dooner