Repository navigation
fix(helios): per-step speculative calibration and excluded-only waiting/delivery fairness - #644
Conversation
…ng/delivery fairness
Why:
Two independent scheduler biases caused adaptive speculative verification
to under-select deeper, higher-throughput verification depths under the
default `balanced` policy:
1. Per-depth cumulative calibration in `rounds.rs` defaulted unobserved
deeper depths to unity while calibrating shallow depths, letting raw
drafter overconfidence persist at unobserved depths and mis-estimating
deeper cumulative survival when shallow shapes ran.
2. In `utility.rs`, `service.rs`, `policy.rs`, and `scripts/scheduling_sim/utility.py`,
linear decode-age waiting cost `c_i * (A_i * T + T^2 / 2)` was charged
to served decoders as well as excluded decoders (giving continuation
reference `sigma_i = mu / p_i > 0` even when `p_i = 1`), and delivery
fairness priced raw burst frequency `1 / T` (`delivered = 1`,
`maximum_rate = 1 / T_min`). On longer-round hardware such as 4x DGX
Spark (~35 ms/round), this penalized higher-`tok/s` speculative depths
even when every active decoder was served and zero requests were
excluded, violating the principle that hardware should only trade
throughput for latency to protect an actual excluded/underserved request.
What changed:
- **Per-step conditional calibration (`helios/src/scheduler/rounds.rs`,
`docs/scheduling-runtime-design.md`):** Switched `DepthCalibration` and
`RequestCalibration` from cumulative ratios to survival-weighted per-step
conditional ratios (`CALIBRATION_FACTOR_MAX = 4.0`, weight `w_d =
prev_realized`), multiplied cumulatively across `0..=depth` during
pricing. Unobserved deeper depths inherit the deepest observed shallower
depth's factor instead of defaulting to `1.0`.
- **Excluded-only waiting age (`helios/src/scheduler/utility.rs`,
`service.rs`, `policy.rs`, `scripts/scheduling_sim/utility.py`,
`docs/scheduling-utility.md`):** Charged linear waiting age only to
excluded delivery-bearing streams (`j in D \ S(a)`), yielding the exact
Bellman continuation reference `sigma_i = E[T * 1_{i not in S}] / p_i =
(K - b_f) * T_f / b_f` (`DeliveryReference::excluded_wait_ms`). Added
`LaneValue::decode_within(expected, preceding_ms, horizon_ms)` (and
updated `LaneValue::finish`) so served lanes cancel their `-c_i * T / 2`
term while preserving additive cohort selection and exact two-stage
prerequisite waiting over `[0, preceding_ms]`.
- **Served-share delivery fairness (`service.rs`, `utility.rs`, `policy.rs`,
`scripts/scheduling_sim/utility.py`, `docs/scheduling-utility.md`):**
Replaced burst-frequency delivery service (`delivered = 1`,
`maximum_rate = 1 / T_min`) with served wall-time share `s_i in (0, 1]`
(`delivered = duration_ms` on visible publication, `0` when excluded,
`maximum_rate = 1.0`, initialized at `served_share = b_f / K`). Served
decoders earn `+delivery_price_i * service_ms`, which divides by `T` to
a duration-independent constant `+g_i / s_i`, protecting skipped
requests without taxing deeper speculation on unskipped rounds.
- **No core format, Protobuf, or model-specific changes:** Existing cores
load and serve unchanged.
Claimed benefit and result:
- Eliminates artificial depth throttling under `balanced` whenever all
active decoders are served (solo `B = 1`, uncontended full `B = 4`, or
a decoder taking its turn alongside a waiting prefiller) while preserving
prefill chunk shrinking when decoders wait and duration/priority
protection for excluded decoders when oversubscribed (`K > b`).
- Live 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving (`max_tokens=256`,
5-prompt suite):
- On `gb10-tp4-202611301553`, default `balanced` achieves **76.11 tok/s**
mean (peaking at **80.89 tok/s** on `greedy_code` with `off/r = 4.80`),
matching `throughput` (**76.43 tok/s**, 0.4% difference, within `T=1`
sampling variance).
- On `gb10-tp4-202611301141`, default `balanced` on `greedy_code` rose
from 70.30 tok/s (`off/r = 2.04`) to 75.98 tok/s (`off/r = 3.17`), and
on DFly2 (`gb10-tp4-202611301002`), per-step calibration cured the
`W=1`/`P=3` collapse (`ctx16k_T1`: 70.94 vs 57.12 tok/s forced `P=6`,
+24.2%).
Supporting evidence and limitations:
- Rust crate tests (`cargo test --locked --release`): `eos` (2/2),
`selene` (548/548), `selene-manager`, `helios` scheduler suite (400/400,
including `balanced_unexcluded_decoders_maximize_throughput_without_delivery_or_age_penalty`
and `oversubscribed_decoders_incur_excluded_wait_and_protect_skipped_lanes`),
`flare`, and `flare-cli` (201/201).
- Scheduling simulator (`pytest tests/test_scheduling*.py -q`): **786/786**
passed, including the updated excluded-only Poisson equation check and
unexcluded `B = 1` / `B = 4` peak-throughput depth test.
- TLA+ lifecycle models and Rust trace conformance (`python3
verification/helios-lifecycle/check.py --tlc-jar
/home/luke/.cache/flare-formal/tla2tools-1.7.4.jar --target-dir
flare-cli/target`): all 8 models passed with 0 TLC errors (`Lifecycle`
1,342, `RankProtocol` 1,291, `DispatchRing` 7,940, `OffloadTransfer`
8,490, `CacheOwnership` 195,492, `Speculation` 13,566,
`ResponseLifecycle` 365,508, `CheckpointReservation` 68 observed
transitions).
- Limitations / unrun checks: `cargo-kani` is not installed locally (covered
by CI; completion-vector and `StateView` validators were not modified).
Live GPU multi-concurrency (`B = 4` and `K > 4`) serving benchmarks were
not run in this pass (covered by unit and 786 simulator tests).
Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b
|
A case file has been opened for 644. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe core calibration, Bellman continuation, and served-share fairness math check out across Rust and the simulator, but
Walkthrough
Merge Risk: Medium · up to
|
|
Tested #644 (+ #643) live on 4x DGX Spark (
One small edge case worth noting in |
…tep ring2) Why: On 4-rank switchless dual-port RoCE rings (DGX Spark / NVIDIA GB10, SM121), small-message BF16 allreduce previously used the oneshot protocol, which relays across opposite ranks over CPU mailbox hops. FlashInfer's merged `local-inference-lab/flashinfer#192` (`2a07747b8e12e54ec8e8e4bbef34de8586618e68`) adds a 2-step neighbor-only ring allreduce (`KIND_RING2_STEP1` / `KIND_RING2_STEP2`) plus small-message inline WR and ring-relay improvements in `_roce_proxy.c`. Per `docs/roce-ring.md`, Helios's vendored `helios/native/roce_proxy.c` must remain byte-identical to FlashInfer's `_roce_proxy.c` after its provenance header so preparation and serving share the transport protocol. What changed: Re-vendored `helios/native/roce_proxy.c` byte-for-byte (after the 9-line provenance header) from `local-inference-lab/flashinfer` commit `2a07747b8e12e54ec8e8e4bbef34de8586618e68` (`#192`). Relative to Flare `main`, this brings in: - `KIND_RING2_STEP1` (5) and `KIND_RING2_STEP2` (6) direct-neighbor RDMA write handling (`post_direct_striped_batched`, `post_ring2_step`) with batched completion signaling (`RING2_SIGNAL_STRIDE = 16`, `RING2_MAX_OUTSTANDING = 6`, statically verified against `ROCE_SEND_DEPTH` with queue slack for relay ops and ring ACKs). - Small-message and ring-relay transport improvements from FlashInfer `#192`: QP `max_inline_data` raised from 16 to 256 (with fallback to 16 and per-HCA `max_inline` tracking) to enable `IBV_SEND_INLINE` on relay mailbox and `post_striped` payloads `<= max_inline`; `ring_next_from` and precomputed `ring_relays_origin[]` so `ring_service` skips non-relayed origins; `post_op` posting relayed peers before direct peers on rings; and idle-loop polling (`ring_service` every spin when `!ring2_active`, every 16th when `ring2_active`; `drain_cqs` every 16th). - High-capacity CPU pinning (`pin_high_capacity_cpus`, `"flare-roce"` thread name) already merged upstream in `flashinfer#156` (overlaps open `#576`). - Existing control opcodes (0..4) and `ROCE_ABI_VERSION = 14` remain unchanged, preserving full compatibility with existing ABI-14 cores. Claimed benefit and result: Enables native Rust serving (`flare run`) to drive b12x's 2-step RoCE ring allreduce on 4-rank switchless rings without opposite-rank CPU relay hops. Note that an isolated `#643`-only run on a `main`-exported core does not emit kinds 5/6; paired with `local-inference-lab/flashinfer#192` (`2a07747b8`), `local-inference-lab/flashinfer#193`, `local-inference-lab/hyperflare-recipes#112`, and `#644` on 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving (`max_tokens = 256`, 5-prompt suite): - In node-level nsys P=4 traces, `RoceRing2AllReduceLaunch` averages 31.8-33.0 us/call across 88 calls/round (eliminating opposite-rank CPU relay hops on small BF16 allreduces). - Combined-stack matched-depth GPU round times dropped 1.5-2.2 ms across P=1..6 versus pre-existing non-ring2 baseline core `gb10-tp4-202611291503` (P=1: 22.3 -> 20.8 ms, P~4: 34.59 -> 32.36 ms, P~5: 35.92 -> 34.16 ms; 5-prompt mean 74.02 -> 76.11 tok/s under `balanced`, `greedy_code` 74.39 -> 80.89 tok/s). Supporting evidence and limitations: - Byte-parity check: `diff` between `tail -n +10 helios/native/roce_proxy.c` and `flashinfer@2a07747b8:flashinfer/experimental/b12x/comm/roce/_roce_proxy.c` returned 0 bytes diff. - Native RoCE proxy unit tests (`cargo test --locked --release --manifest-path helios/Cargo.toml --features roce --lib --target-dir flare-cli/target execution::roce`): **30 passed, 0 failed** (6 `execution::roce::tests` + 24 `execution::roce_fabric::tests`). - Full crate tests (`cargo test --locked --release` on `helios` with `--features runtime-core,server`, `flare`, `flare-cli`): all passed. - Live 4-rank multi-GPU collective execution verified on 4x DGX Spark dual-port switchless RoCE rings serving both ring2-enabled cores (`gb10-tp4-202611301141`, `gb10-tp4-202611301553`, 57 graphs each) and legacy non-ring2 ABI-14 core (`gb10-tp4-202611291503`). - Limitations / unrun checks: - Keeping `ROCE_ABI_VERSION = 14` preserves compatibility with existing ABI-14 cores, but an older Flare binary without `#643` loading a newer ring2-exported core will connect and fail on replay op 1 with `unknown op kind 5` rather than rejecting at startup. - Collides on `roce_proxy.c` with open `#576` (`pin_high_capacity_cpus` from merged `flashinfer#156`) and `#577` (`RING_WINDOW` / `reserve`); whichever lands second will rebase cleanly against the vendored file. - Non-4-rank ring topologies and non-SM121 RoCE NICs were not benchmarked. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b
…tep ring2) (#643) Why: On 4-rank switchless dual-port RoCE rings (DGX Spark / NVIDIA GB10, SM121), small-message BF16 allreduce previously used the oneshot protocol, which relays across opposite ranks over CPU mailbox hops. FlashInfer's merged `local-inference-lab/flashinfer#192` (`2a07747b8e12e54ec8e8e4bbef34de8586618e68`) adds a 2-step neighbor-only ring allreduce (`KIND_RING2_STEP1` / `KIND_RING2_STEP2`) plus small-message inline WR and ring-relay improvements in `_roce_proxy.c`. Per `docs/roce-ring.md`, Helios's vendored `helios/native/roce_proxy.c` must remain byte-identical to FlashInfer's `_roce_proxy.c` after its provenance header so preparation and serving share the transport protocol. What changed: Re-vendored `helios/native/roce_proxy.c` byte-for-byte (after the 9-line provenance header) from `local-inference-lab/flashinfer` commit `2a07747b8e12e54ec8e8e4bbef34de8586618e68` (`#192`). Relative to Flare `main`, this brings in: - `KIND_RING2_STEP1` (5) and `KIND_RING2_STEP2` (6) direct-neighbor RDMA write handling (`post_direct_striped_batched`, `post_ring2_step`) with batched completion signaling (`RING2_SIGNAL_STRIDE = 16`, `RING2_MAX_OUTSTANDING = 6`, statically verified against `ROCE_SEND_DEPTH` with queue slack for relay ops and ring ACKs). - Small-message and ring-relay transport improvements from FlashInfer `#192`: QP `max_inline_data` raised from 16 to 256 (with fallback to 16 and per-HCA `max_inline` tracking) to enable `IBV_SEND_INLINE` on relay mailbox and `post_striped` payloads `<= max_inline`; `ring_next_from` and precomputed `ring_relays_origin[]` so `ring_service` skips non-relayed origins; `post_op` posting relayed peers before direct peers on rings; and idle-loop polling (`ring_service` every spin when `!ring2_active`, every 16th when `ring2_active`; `drain_cqs` every 16th). - High-capacity CPU pinning (`pin_high_capacity_cpus`, `"flare-roce"` thread name) already merged upstream in `flashinfer#156` (overlaps open `#576`). - Existing control opcodes (0..4) and `ROCE_ABI_VERSION = 14` remain unchanged, preserving full compatibility with existing ABI-14 cores. Claimed benefit and result: Enables native Rust serving (`flare run`) to drive b12x's 2-step RoCE ring allreduce on 4-rank switchless rings without opposite-rank CPU relay hops. Note that an isolated `#643`-only run on a `main`-exported core does not emit kinds 5/6; paired with `local-inference-lab/flashinfer#192` (`2a07747b8`), `local-inference-lab/flashinfer#193`, `local-inference-lab/hyperflare-recipes#112`, and `#644` on 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving (`max_tokens = 256`, 5-prompt suite): - In node-level nsys P=4 traces, `RoceRing2AllReduceLaunch` averages 31.8-33.0 us/call across 88 calls/round (eliminating opposite-rank CPU relay hops on small BF16 allreduces). - Combined-stack matched-depth GPU round times dropped 1.5-2.2 ms across P=1..6 versus pre-existing non-ring2 baseline core `gb10-tp4-202611291503` (P=1: 22.3 -> 20.8 ms, P~4: 34.59 -> 32.36 ms, P~5: 35.92 -> 34.16 ms; 5-prompt mean 74.02 -> 76.11 tok/s under `balanced`, `greedy_code` 74.39 -> 80.89 tok/s). Supporting evidence and limitations: - Byte-parity check: `diff` between `tail -n +10 helios/native/roce_proxy.c` and `flashinfer@2a07747b8:flashinfer/experimental/b12x/comm/roce/_roce_proxy.c` returned 0 bytes diff. - Native RoCE proxy unit tests (`cargo test --locked --release --manifest-path helios/Cargo.toml --features roce --lib --target-dir flare-cli/target execution::roce`): **30 passed, 0 failed** (6 `execution::roce::tests` + 24 `execution::roce_fabric::tests`). - Full crate tests (`cargo test --locked --release` on `helios` with `--features runtime-core,server`, `flare`, `flare-cli`): all passed. - Live 4-rank multi-GPU collective execution verified on 4x DGX Spark dual-port switchless RoCE rings serving both ring2-enabled cores (`gb10-tp4-202611301141`, `gb10-tp4-202611301553`, 57 graphs each) and legacy non-ring2 ABI-14 core (`gb10-tp4-202611291503`). - Limitations / unrun checks: - Keeping `ROCE_ABI_VERSION = 14` preserves compatibility with existing ABI-14 cores, but an older Flare binary without `#643` loading a newer ring2-exported core will connect and fail on replay op 1 with `unknown op kind 5` rather than rejecting at startup. - Collides on `roce_proxy.c` with open `#576` (`pin_high_capacity_cpus` from merged `flashinfer#156`) and `#577` (`RING_WINDOW` / `reserve`); whichever lands second will rebase cleanly against the vendored file. - Non-4-rank ring topologies and non-SM121 RoCE NICs were not benchmarked. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b Signed-off-by: Luke Alonso <lalonso@gmail.com>
…obabilities (#111) Why: `_complete_block` in `hyperflare_recipes/components/vocabulary_sampling.py` previously reported the sequential rejection-sampling product `prod_{k <= s} min(p_k / q_k, 1)` as `completion_speculative_survival`. Under Sun et al. block verification, prefix length >= s + 1 is accepted whenever at least one independent test k in s..(limit - 2) succeeds with hazard `h_k`, so the sequential product is only a strict lower bound that under-reports survival at deeper depths (20-30 percentage points low at depths 2..5). Because Helios uses `completion_speculative_survival` as its Rao-Blackwellized realized target for adaptive verification calibration, this bias systematically underestimated deeper-depth acceptance. What changed: - In `hyperflare_recipes/components/vocabulary_sampling.py` (`_complete_block`): stored each clamped step hazard `h_k` in FP32 and computed the exact conditional survival probability `S_s = 1 - prod_{k=s}^{limit - 2} (1 - h_k)` via the backward FP32 recurrence `S_s = min(S_{s+1} + h_s * (1 - S_{s+1}), 1.0)`, preserving monotonicity and avoiding cancellation near 0. - Added Monte Carlo validation test `test_block_verification_survival_matches_monte_carlo_acceptance` in `tests/components/test_vocabulary_completion_abi.py` verifying that reported `survivals` match empirical acceptance across 4,096 Philox seeds within tight statistical tolerance. Claimed benefit and result: Eliminates the systematic downward bias in Rao-Blackwellized realized survival reported to Helios under block verification, allowing adaptive verification calibration to match actual realized acceptance at deeper draft depths. Combined with the companion Helios scheduler PR (`NVIDIA/hyperflare-inference#644`) and SM121 b12x kernel PRs (`local-inference-lab/flashinfer#192`, `#193`), 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving reached 76.11 tok/s mean (80.89 tok/s peak on `greedy_code`) under default `balanced` policy. Supporting evidence and limitations: - `TRITON_INTERPRET=1 pytest tests/components/test_vocabulary_completion_abi.py -q`: all tests passed (verified exact Monte Carlo survival match). - Full 4x DGX Spark TP4 export (`gb10-tp4-202611301553`) and 5-prompt live serving verified on SM121. - Limitations: non-block (sequential) speculative verification paths were unchanged and already report exact sequential survival. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=6fcc
…lining Why Four coupled scheduling defects degraded Helios prefill throughput, simultaneous-burst batching, and long-context chunk selection: 1. Under-batched decode coalescing: Helios executes pure prefill at batch 1 with prompt-token value 1.0 against output-token value 64.0 and did not price the multi-step K -> K + m decode-batch throughput surplus unlocked when queued prefills finish and join an active decode cohort. On simultaneous bursts, the scheduler launched premature sub-batch decode rounds and split prefill work into smaller chunks instead of coalescing waiting prompts into full decode batches. 2. Fill- and KV-context-blind prefill timing estimates (#485): ActionCosts keyed a single 9-sample rolling median purely on static graph capacity, ignoring live token count and KV history depth. Short masked tails poisoned full-chunk medians on large graphs, and deep KV-attention slowdown on larger chunks caused selection to drift down onto stale shallow-context smaller capacities. 3. Serialized nonterminal prefill chunks: plan_requires_feedback and the executor submission guards required completion feedback for every graph outside Decode and Speculative, draining the two-frame pipeline between consecutive nonterminal GraphKind::Prefill chunks even when no token is sampled and no checkpoint capture or prompt end is reached. 4. Mixed-graph and terminal-prefill catalog mismatches: Mixed decode rate and optimistic continuation paths bypassed powered_curve / forecast_tokens and lacked a !prefill guard, while unmeasured TerminalPrefill discovery looked up prefill_catalog instead of terminal_prefill_catalog. What Changed - Decode-batch coalescing continuation value (helios/src/scheduler/policy.rs, scripts/scheduling_sim/utility.py, docs/scheduling-runtime-design.md, helios/README.md): Added PolicyConfig::coalescing_horizon_tokens (default 64.0, validated nonnegative). When active decoders are under-batched relative to the measured decode/speculative catalog and queued prefills can enter decode (max_new_tokens > 1, not prompt_logprobs), each prefiller receives an intrinsic output_token_value * ((K + m) / m) * (1 - R_K / R_{K+m}) surplus over min(coalescing_horizon_tokens, post_prefill, peer_budget), amortized uniformly across its uncached prompt tokens so total credit sums to 1x regardless of chunking and chunk sizing stays smooth under active decoder waiting age. Checked in burst_four, burst_eight, burst_eight_8k, burst_four_low, and burst_eight_low in scripts/scheduling_sim/workloads.py. - Stratified fill/context prefill cost model and O(1) affine checkpoint stride (helios/src/scheduler/cost.rs, helios/src/scheduler/checkpoints.rs, helios/src/scheduler/policy.rs, helios/src/scheduler/service.rs): Replaced single-median prefill estimates with PrefillCostModel (6 strata crossing u <= 0.5 / u > 0.5 with start_position < 4096 / 4096..32768 / >= 32768, each keeping a 9-sample rolling median shared via Ring9) and exact 3-param relative-error-weighted NNLS fitting theta_0 + theta_1*u + theta_2*u*(pos/4096). Narrow-fill upward extrapolation applies a bounded 4x constant-throughput floor on the base term before adding theta_2*h, preventing partial fills from discounting full-chunk costs or locking out large capacities after TTL reset. Smaller capacities without deep-context observations borrow the per-token context slope theta_2 / peer_capacity from the largest fresh strictly larger peer of the same kind. Extended checkpoints::interval_prefill_ns with an O(1) closed-form arithmetic-series stride over full-chunk affine segments so long agentic prompts retain bounded cost evaluation under non-constant predictors. - Two-frame nonterminal GraphKind::Prefill pipelining (helios/src/execution/manifest.rs, helios/src/scheduler.rs, helios/src/scheduler/policy.rs, helios/src/model.rs, helios/src/execution/{transport,threaded,parallel}.rs, helios/src/execution/threaded/protocol.rs, verification/helios-lifecycle/check.py): Single-sourced GraphKind::pipelines(self) for Decode | Speculative | Prefill, added prefill_cursor / _from planning helpers and prefill_step_requires_feedback, allowed nonterminal non-capture Prefill steps to queue two deep while draining at prompt end, checkpoint cuts, deferred-prefill limits, grammar constraints, stale/probe costs, or terminal/scored prefill, and guarded ConsumedTokens / SnapshotConsumedTokens reuse. - Mixed-graph curve and terminal-catalog fixes (helios/src/scheduler/learning.rs, helios/src/scheduler/service.rs, helios/src/scheduler/policy.rs): Wired powered_curve + forecast_tokens with !prefill guards into Mixed rate and optimistic continuation paths, routed unmeasured prefill discovery and resize_prefill through effective_prefill_catalog, and removed unreachable is_prefill() branches in add_candidate and continuation_candidate. - Compatibility: No Protobuf, core-format, or CUDA-graph ABI changes; existing exported cores load and serve unchanged. Claimed Benefit and Result - Live SM120 flare run A/B vs origin/main (3e57bdc, including #644): - nvidia/Qwen3.8-27B-NVFP4@gb202-tp1-202610281501 (1x RTX PRO 6000 Blackwell, balanced policy, unique uncached prompts): - Simultaneous B=8 burst (8 x ~2,430-token prompts, 2,048 output tokens): aggregate throughput rose from 398.6 to 497.6 tok/s (+24.8%), max TTFT fell from 3,070.3 to 2,776.8 ms (-9.6%), prefill launches fell from 24 to 16 (-33%), and speculative rounds fell from 113 to 71 (-37%). - Simultaneous B=4 burst (4 x ~2,430-token prompts, 1,024 output tokens): aggregate throughput rose from 305.8 to 316.5 tok/s (+3.5%), max TTFT fell from 1,903.5 to 1,855.3 ms (-2.5%), prefill launches fell from 11 to 8. - Consecutive ~130k uncached prompts (#485): Run 0 improved 30,622.6 -> 29,510.2 ms (-3.6%, 57 -> 52 launches), Run 1 improved 30,349.9 -> 28,982.5 ms (-4.5%, 59 -> 40 launches), Run 2 29,209.2 -> 29,082.8 ms (-0.4%, 38 vs 39 launches). - nvidia/Qwen3.8-Flash-Next-FP4-Local@gb202-tp2-202610270419 (2x SM120): B=4 burst 252.9 -> 262.7 tok/s (+3.9%), B=8 burst 353.1 -> 354.9 tok/s (max TTFT 2,063.0 -> 2,017.6 ms), 77k uncached prompts 4,492.5 -> 4,488.1 ms; clean SIGTERM drain (rc=0) on both arms. - deepseek-ai/DeepSeek-V4.1-Flash-1017@gb202-tp4-202611281955 (4x SM120): 3 consecutive ~158k uncached prompts stayed flat at 20 prefill launches with ~13 ms lower TTFT per run (3,524.0 -> 3,510.8 ms, 3,497.3 -> 3,484.2 ms, 3,494.0 -> 3,487.5 ms); clean SIGTERM drain (rc=0). - Synthetic scheduling simulator (scripts/scheduling_sim, balanced policy): - burst_eight (8 x 4,096): makespan 2,188 -> 2,060 ms (-5.9%), max TTFT 876 -> 706 ms (-19.4%), sub-batch rounds 16 -> 8. - burst_eight_8k (8 x 8,192): makespan 2,746 -> 2,648 ms (-3.6%), max TTFT 1,448 -> 1,314 ms (-9.3%), sub-batch rounds 18 -> 12. - burst_eight_low (8 x 4,096, zero draft acceptance): max TTFT 611 -> 559 ms (-8.5%), sub-batch rounds 6 -> 2. Supporting Evidence and Limitations - Rust crate suites (cargo test --locked --release): - eos: 2 passed, 0 failed. - selene (--features test-support): 548 passed, 0 failed. - selene-manager (--features test-support): passed. - helios (--features runtime-core,server): 1,751 passed (406/406 scheduler:: tests including bounded post-TTL extrapolation, peer context-slope borrowing, O(1) affine checkpoint stride on 150k/999- boundary prompts, burst coalescing, and two-frame prefill pipelining); 6 chat-template tests require FLARE_TEST_TEMPLATE_DIR from a gated HF repo and did not run locally. - flare: 237 passed, 0 failed. - flare-cli: passed; release build succeeded with 0 warnings. - Python suites (pytest tests/cli tests/test_scheduling*.py -q): 961 passed. - 64-seed timing-learning validation (scripts/scheduling_sim/learning.py --preset validate --reference ttl across all 62 scenarios, seeds 10000..10063, Helios production retained-refresh alpha=0.002): accepted retained-refresh:funded:cumulative:alpha=0.002 with 35/35 core gates, 6/6 recovery gates, calibration passed, 0/64 stationary resets, geomean core throughput ratio 1.0093, worst core p99 decode-gap ratio 1.0101. - TLA+ lifecycle verification (verification/helios-lifecycle/check.py with tla2tools-1.7.4.jar): all 8 models and Rust trace conformance passed (and check.py --mutations detected all injected mutations). - Limitations: cargo-kani is not installed locally (covered by CI; Kani- covered completion-vector and StateView validators were not modified). Live GPU measurements cover SM120 TP1/TP2/TP4; SM103/SM121 and TP16 Kimi K3.1 were not re-measured on hardware in this pass. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b Signed-off-by: Luke Alonso <lalonso@gmail.com>
…lining (#645) Why Four coupled scheduling defects degraded Helios prefill throughput, simultaneous-burst batching, and long-context chunk selection: 1. Under-batched decode coalescing: Helios executes pure prefill at batch 1 with prompt-token value 1.0 against output-token value 64.0 and did not price the multi-step K -> K + m decode-batch throughput surplus unlocked when queued prefills finish and join an active decode cohort. On simultaneous bursts, the scheduler launched premature sub-batch decode rounds and split prefill work into smaller chunks instead of coalescing waiting prompts into full decode batches. 2. Fill- and KV-context-blind prefill timing estimates (#485): ActionCosts keyed a single 9-sample rolling median purely on static graph capacity, ignoring live token count and KV history depth. Short masked tails poisoned full-chunk medians on large graphs, and deep KV-attention slowdown on larger chunks caused selection to drift down onto stale shallow-context smaller capacities. 3. Serialized nonterminal prefill chunks: plan_requires_feedback and the executor submission guards required completion feedback for every graph outside Decode and Speculative, draining the two-frame pipeline between consecutive nonterminal GraphKind::Prefill chunks even when no token is sampled and no checkpoint capture or prompt end is reached. 4. Mixed-graph and terminal-prefill catalog mismatches: Mixed decode rate and optimistic continuation paths bypassed powered_curve / forecast_tokens and lacked a !prefill guard, while unmeasured TerminalPrefill discovery looked up prefill_catalog instead of terminal_prefill_catalog. What Changed - Decode-batch coalescing continuation value (helios/src/scheduler/policy.rs, scripts/scheduling_sim/utility.py, docs/scheduling-runtime-design.md, helios/README.md): Added PolicyConfig::coalescing_horizon_tokens (default 64.0, validated nonnegative). When active decoders are under-batched relative to the measured decode/speculative catalog and queued prefills can enter decode (max_new_tokens > 1, not prompt_logprobs), each prefiller receives an intrinsic output_token_value * ((K + m) / m) * (1 - R_K / R_{K+m}) surplus over min(coalescing_horizon_tokens, post_prefill, peer_budget), amortized uniformly across its uncached prompt tokens so total credit sums to 1x regardless of chunking and chunk sizing stays smooth under active decoder waiting age. Checked in burst_four, burst_eight, burst_eight_8k, burst_four_low, and burst_eight_low in scripts/scheduling_sim/workloads.py. - Stratified fill/context prefill cost model and O(1) affine checkpoint stride (helios/src/scheduler/cost.rs, helios/src/scheduler/checkpoints.rs, helios/src/scheduler/policy.rs, helios/src/scheduler/service.rs): Replaced single-median prefill estimates with PrefillCostModel (6 strata crossing u <= 0.5 / u > 0.5 with start_position < 4096 / 4096..32768 / >= 32768, each keeping a 9-sample rolling median shared via Ring9) and exact 3-param relative-error-weighted NNLS fitting theta_0 + theta_1*u + theta_2*u*(pos/4096). Narrow-fill upward extrapolation applies a bounded 4x constant-throughput floor on the base term before adding theta_2*h, preventing partial fills from discounting full-chunk costs or locking out large capacities after TTL reset. Smaller capacities without deep-context observations borrow the per-token context slope theta_2 / peer_capacity from the largest fresh strictly larger peer of the same kind. Extended checkpoints::interval_prefill_ns with an O(1) closed-form arithmetic-series stride over full-chunk affine segments so long agentic prompts retain bounded cost evaluation under non-constant predictors. - Two-frame nonterminal GraphKind::Prefill pipelining (helios/src/execution/manifest.rs, helios/src/scheduler.rs, helios/src/scheduler/policy.rs, helios/src/model.rs, helios/src/execution/{transport,threaded,parallel}.rs, helios/src/execution/threaded/protocol.rs, verification/helios-lifecycle/check.py): Single-sourced GraphKind::pipelines(self) for Decode | Speculative | Prefill, added prefill_cursor / _from planning helpers and prefill_step_requires_feedback, allowed nonterminal non-capture Prefill steps to queue two deep while draining at prompt end, checkpoint cuts, deferred-prefill limits, grammar constraints, stale/probe costs, or terminal/scored prefill, and guarded ConsumedTokens / SnapshotConsumedTokens reuse. - Mixed-graph curve and terminal-catalog fixes (helios/src/scheduler/learning.rs, helios/src/scheduler/service.rs, helios/src/scheduler/policy.rs): Wired powered_curve + forecast_tokens with !prefill guards into Mixed rate and optimistic continuation paths, routed unmeasured prefill discovery and resize_prefill through effective_prefill_catalog, and removed unreachable is_prefill() branches in add_candidate and continuation_candidate. - Compatibility: No Protobuf, core-format, or CUDA-graph ABI changes; existing exported cores load and serve unchanged. Claimed Benefit and Result - Live SM120 flare run A/B vs origin/main (3e57bdc, including #644): - nvidia/Qwen3.8-27B-NVFP4@gb202-tp1-202610281501 (1x RTX PRO 6000 Blackwell, balanced policy, unique uncached prompts): - Simultaneous B=8 burst (8 x ~2,430-token prompts, 2,048 output tokens): aggregate throughput rose from 398.6 to 497.6 tok/s (+24.8%), max TTFT fell from 3,070.3 to 2,776.8 ms (-9.6%), prefill launches fell from 24 to 16 (-33%), and speculative rounds fell from 113 to 71 (-37%). - Simultaneous B=4 burst (4 x ~2,430-token prompts, 1,024 output tokens): aggregate throughput rose from 305.8 to 316.5 tok/s (+3.5%), max TTFT fell from 1,903.5 to 1,855.3 ms (-2.5%), prefill launches fell from 11 to 8. - Consecutive ~130k uncached prompts (#485): Run 0 improved 30,622.6 -> 29,510.2 ms (-3.6%, 57 -> 52 launches), Run 1 improved 30,349.9 -> 28,982.5 ms (-4.5%, 59 -> 40 launches), Run 2 29,209.2 -> 29,082.8 ms (-0.4%, 38 vs 39 launches). - nvidia/Qwen3.8-Flash-Next-FP4-Local@gb202-tp2-202610270419 (2x SM120): B=4 burst 252.9 -> 262.7 tok/s (+3.9%), B=8 burst 353.1 -> 354.9 tok/s (max TTFT 2,063.0 -> 2,017.6 ms), 77k uncached prompts 4,492.5 -> 4,488.1 ms; clean SIGTERM drain (rc=0) on both arms. - deepseek-ai/DeepSeek-V4.1-Flash-1017@gb202-tp4-202611281955 (4x SM120): 3 consecutive ~158k uncached prompts stayed flat at 20 prefill launches with ~13 ms lower TTFT per run (3,524.0 -> 3,510.8 ms, 3,497.3 -> 3,484.2 ms, 3,494.0 -> 3,487.5 ms); clean SIGTERM drain (rc=0). - Synthetic scheduling simulator (scripts/scheduling_sim, balanced policy): - burst_eight (8 x 4,096): makespan 2,188 -> 2,060 ms (-5.9%), max TTFT 876 -> 706 ms (-19.4%), sub-batch rounds 16 -> 8. - burst_eight_8k (8 x 8,192): makespan 2,746 -> 2,648 ms (-3.6%), max TTFT 1,448 -> 1,314 ms (-9.3%), sub-batch rounds 18 -> 12. - burst_eight_low (8 x 4,096, zero draft acceptance): max TTFT 611 -> 559 ms (-8.5%), sub-batch rounds 6 -> 2. Supporting Evidence and Limitations - Rust crate suites (cargo test --locked --release): - eos: 2 passed, 0 failed. - selene (--features test-support): 548 passed, 0 failed. - selene-manager (--features test-support): passed. - helios (--features runtime-core,server): 1,751 passed (406/406 scheduler:: tests including bounded post-TTL extrapolation, peer context-slope borrowing, O(1) affine checkpoint stride on 150k/999- boundary prompts, burst coalescing, and two-frame prefill pipelining); 6 chat-template tests require FLARE_TEST_TEMPLATE_DIR from a gated HF repo and did not run locally. - flare: 237 passed, 0 failed. - flare-cli: passed; release build succeeded with 0 warnings. - Python suites (pytest tests/cli tests/test_scheduling*.py -q): 961 passed. - 64-seed timing-learning validation (scripts/scheduling_sim/learning.py --preset validate --reference ttl across all 62 scenarios, seeds 10000..10063, Helios production retained-refresh alpha=0.002): accepted retained-refresh:funded:cumulative:alpha=0.002 with 35/35 core gates, 6/6 recovery gates, calibration passed, 0/64 stationary resets, geomean core throughput ratio 1.0093, worst core p99 decode-gap ratio 1.0101. - TLA+ lifecycle verification (verification/helios-lifecycle/check.py with tla2tools-1.7.4.jar): all 8 models and Rust trace conformance passed (and check.py --mutations detected all injected mutations). - Limitations: cargo-kani is not installed locally (covered by CI; Kani- covered completion-vector and StateView validators were not modified). Live GPU measurements cover SM120 TP1/TP2/TP4; SM103/SM121 and TP16 Kimi K3.1 were not re-measured on hardware in this pass. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b Signed-off-by: Luke Alonso <lalonso@gmail.com>
Why: Adaptive speculative verification scores each joint prefix-survival probability p as p^alpha using a single static adaptive_verification_alpha across all decode batch sizes. Lower values (alpha < 1.0) favor longer verification prefixes, while higher values (alpha > 1.0) favor shorter prefixes. Because verification step latency grows steeply with active decode concurrency, a single static exponent tuned for low concurrency (C = 1..8) over-offers deep drafts at higher concurrency (C >= 12), inflating per-round latency, whereas raising a static exponent globally reduces low-concurrency speculative depth. Linearly interpolating the effective exponent with active decode concurrency lets operators balance low- and high-concurrency verification width independently at serving time using existing signed cores, without re-exporting cores or changing captured graph contracts. What: - Helios scheduler (helios/src/scheduler.rs, policy.rs, rounds.rs, policy_tests.rs): Adds opt-in adaptive_verification_alpha_high (default None), adaptive_verification_alpha_low_concurrency (default 8), and adaptive_verification_alpha_high_concurrency (default 12) to PolicyConfig, plus PolicyConfig::effective_adaptive_verification_alpha(active_decodes) and RequestScheduler::active_decode_concurrency() / effective_adaptive_verification_alpha(). When alpha_high is unset, or when fixed-width verification is configured, the effective exponent returns adaptive_verification_alpha unchanged. When set under adaptive verification, the exponent interpolates linearly across live RequestPhase::Decode slots between low and high concurrency thresholds, clamped to [min(low, high), max(low, high)] with finiteness guards. Per-step speculative calibration (NVIDIA#644), excluded-only waiting age and served-share delivery fairness (NVIDIA#644), decode-batch coalescing through powered_curve (NVIDIA#645), stratified prefill cost modeling (NVIDIA#645), and two-frame nonterminal prefill pipelining (NVIDIA#645) are preserved. configure_policy validates positive finite alphas and 1 <= low < high. - Server config and CLI (helios/src/server/config.rs, flare-cli/src/cli.rs, flare-cli/src/main.rs): Adds --mtp-adaptive-verification-alpha-high, --mtp-adaptive-verification-alpha-low-concurrency, and --mtp-adaptive-verification-alpha-high-concurrency to ServingOptions, validates them early before GPU initialization and in Bootstrap::load (rejecting thresholds without alpha_high, non-positive/non-finite alphas, and low >= high), forwards them to peer ranks via rank_options(), and emits bootstrap JSON keys only when set. - Scheduling simulator and docs (scripts/scheduling_sim/{__main__, learning_policy,model,scheduler,utility}.py, tests/test_scheduling_utility.py, docs/cli-design.md, docs/scheduling-runtime-design.md): Applies effective concurrency-aware alpha consistently across expected_output, candidates, UtilityConfig, UtilityScheduler (including decode-batch coalescing), LearningScheduler (_actions and _cohort_actions), and simulator CLI flags with matching validation; adds regression coverage verifying LearningScheduler matches UtilityScheduler under concurrency-aware alpha; updates CLI and scheduling-runtime docs as present-state specification. - Compatibility: No core format, Protobuf schema, captured graph contract, or model-specific changes; existing signed cores load and serve without re-export. Result: Enables opt-in runtime tuning of speculative verification prefix length across active decode concurrency with zero behavioral change when --mtp-adaptive-verification-alpha-high is omitted. In the deterministic scheduling simulator using the 28-shape multi-width catalog and survival curve from helios/src/scheduler/policy_tests.rs (256 output tokens per request, seed 0), ramping alpha from 1.0 to 1.5 across C = 8..12 leaves C = 1, 4, and 8 bit-for-bit identical to constant alpha = 1.0 (mean width 8.00 at C = 1 and C = 4; 4.55 at C = 8) while tightening mean verification width from 4.47 to 2.14 at C = 12 (p95 step 13.60 -> 9.80 ms, -27.9%; max output gap 20.90 -> 10.45 ms, -50.0%; output rate 2,163.1 -> 2,040.6 tok/s, -5.7%) and from 4.40 to 2.14 at C = 16 (p95 step 16.90 -> 11.60 ms, -31.4%; max output gap 40.80 -> 20.34 ms, -50.1%; output rate 2,360.9 -> 2,301.0 tok/s, -2.5%). Evidence: Verified on a clean git archive of this commit atop e85019b: conflict-free git merge-tree against e85019b; all 8 TLA+ lifecycle models and Rust trace conformance via verification/helios-lifecycle/check.py; release cargo test for helios (--features server and --features runtime-core,server), flare, and flare-cli; cargo check for heliopause; pytest for tests/preparation/test_core_boundary.py and tests/test_scheduling*.py (including LearningScheduler parity); scripts.scheduling_sim scenario checks; and ruff 0.12.8 on touched Python lines. Limitation: Controlled equivalent-baseline target-hardware flare run A/B serving benchmarks on this post-NVIDIA#644/NVIDIA#645 commit have not been run yet and are required before upstream readiness. Design-Signed-Off-By: Antigravity (gemini-4-neon); design-review=2e5b Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
Why
Two independent biases in Helios's scheduler caused adaptive speculative verification to under-select deeper, higher-throughput verification depths under the default
balancedpolicy:helios/src/scheduler/rounds.rs):DepthCalibrationandRequestCalibrationcalibrated cumulative prefix survival ratios independently per depth, defaulting unobserved deeper depths to1.0. When shallow shapes ran, deeper depths could not inherit the observed step-level calibration factor, causing mis-calibrated depth rankings (for example, collapsing to shallowW=1/P=3shapes when raw drafter confidence diverged from realized acceptance).helios/src/scheduler/utility.rs,service.rs,policy.rs,scripts/scheduling_sim/utility.py): Previously, linear waiting-age costdelivered = 1,maximum_rate = 1 / T_min). On longer-round hardware such as 4× DGX Spark (~35 ms/round), these two terms imposed a strong bias against deeper, higher-tok/sspeculative rounds even when every active decoder was served and zero requests were excluded. Under the scheduler's fairness principle, hardware should only trade throughput for shorter round duration in service of protecting actual excluded or underserved active requests—never to protect unarrived future requests.What Changed
helios/src/scheduler/rounds.rs,docs/scheduling-runtime-design.md):DepthCalibration/RequestCalibrationupdates with survival-weighted per-step conditional updates (CALIBRATION_FACTOR_MAX = 4.0, sample weightstep_c_d).0..=depth.1.0.helios/src/scheduler/utility.rs,service.rs,policy.rs,scripts/scheduling_sim/utility.py,docs/scheduling-utility.md):DeliveryReference::excluded_wait_ms).LaneValue::decode_within(expected, preceding_ms, horizon_ms)(and updatedLaneValue::finish) so served lanes cancel theirValueRate::newwhile keeping fixed-graph cohort selection (best_cohort,best_two_stage_cohort, packed-round DP) strictly additive and modeling prerequisite wait over[0, preceding_ms]exactly in two-stage sequences.service.rs,utility.rs,policy.rs,scripts/scheduling_sim/utility.py,docs/scheduling-utility.md):delivered = 1.0againstmaximum_rate = 1 / T_min, producing adelivery / Tscore term that taxed longer high-tok/srounds even when no stream was skipped.maximum_rate = 1.0,delivered = duration_mson visible publication,0.0when excluded, initialized from the batch-feasible served sharedelivery_price_i * service_ms, which divides byClaimed Benefit and Result
B = 1, uncontended fullB = 4decode, or a decoder taking its turn alongside a waiting prefiller), neither delivery fairness nor waiting age introduces anytok/sspeculation. Prefill chunks still shrink when decoders wait, and oversubscribed decode batches (max_tokens = 256, 5-prompt suite):gb10-tp4-202611301553, default--scheduler-policy balancedachieves 76.11 tok/s 5-prompt mean (peaking at 80.89 tok/s ongreedy_codewithoff/r = 4.80), matching--scheduler-policy throughput(76.43 tok/s, 0.4% difference, withinT = 1sampling noise).gb10-tp4-202611301141:greedy_codeunderbalancedrose from 70.30 tok/s (off/r = 2.04) to 75.98 tok/s (off/r = 3.17), and 5-prompt mean rose from 72.46 to 74.15 tok/s.gb10-tp4-202611301002,--scheduler-policy throughput), per-step conditional calibration eliminated theW=1/P=3collapse (ctx16k_T1: 70.94 vs57.12 tok/sforcedP=6,+24.2%;ctx4k_T1: 62.57 vs54.59 tok/s,+14.6%).Supporting Evidence and Limitations
cargo test --locked --release):eos: 2 passed, 0 failedselene(--features test-support): 548 passed, 0 failedselene-manager(--features test-support): passedhelios(--features runtime-core,server,scheduler::): 400 passed, 0 failed, including new unit testsbalanced_unexcluded_decoders_maximize_throughput_without_delivery_or_age_penalty,oversubscribed_decoders_incur_excluded_wait_and_protect_skipped_lanes, and the excluded-only continuation identity inutility.rs.flareandflare-cli: 201 passed, 0 failed (actual_load_core_leases_managed_local_entries_and_releases_on_failurepassed standalone).pytest tests/test_scheduling*.py -q): 786 passed, 0 failed, including the updated excluded-only reference Poisson equation test (test_age_continuation_satisfies_the_reference_poisson_equation),test_unexcluded_decoders_pick_peak_throughput_speculation_depth(B = 1andB = 4),test_short_prompt_startup_and_subsequent_decode_gaps, andtest_common_workloads_complete_or_make_progress_to_the_horizon.python3 verification/helios-lifecycle/check.py --tlc-jar /home/luke/.cache/flare-formal/tla2tools-1.7.4.jar --target-dir flare-cli/target): All 8 models passed with 0 TLC errors:Lifecycle.tla: 1,342 observed Rust transitionsRankProtocol.tla: 1,291 observed Rust transitionsDispatchRing.tla: 7,940 observed Rust transitionsOffloadTransfer.tla: 8,490 observed Rust transitionsCacheOwnership.tla: 195,492 observed Rust transitionsSpeculation.tla: 13,566 observed Rust transitionsResponseLifecycle.tla: 365,508 observed Rust transitionsCheckpointReservation.tla: 68 observed Rust transitionscargo-kaniis not installed locally (covered by CI's Kani job; Kani-covered completion-vector andStateViewvalidators were not modified).B = 4uncontended andK > 4oversubscribed) serving benchmarks were not run in this pass; those regimes are verified by the Rust unit tests and 786 simulator tests.Discord: lukealonso