Skip to content

Overhaul Helios prefill scheduling, cost modeling, and two-frame pipelining - #645

Merged
lukealonso merged 1 commit into
mainfrom
helios-prefill-burst-coalescing-cost
Nov 30, 2026
Merged

lukealonso merged 1 commit into
mainfrom
helios-prefill-burst-coalescing-cost

Conversation

@lukealonso

@lukealonso lukealonso commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #485

Why

Four coupled scheduling defects degraded Helios prefill throughput, simultaneous-burst batching, and long-context chunk selection:

  1. Under-batched decode coalescing (helios/src/scheduler/policy.rs, scripts/scheduling_sim/utility.py): 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 higher-utilization decode batches.
  2. Fill- and KV-context-blind prefill timing estimates (Scheduler ActionCosts aliases short- and long-context prefill timings, causing chunk-size drift at 64k–128k #485, helios/src/scheduler/cost.rs): 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 (helios/src/scheduler.rs, helios/src/model.rs, helios/src/execution/): plan_requires_feedback and the executor submission guards forced completion feedback for every graph outside Decode | Speculative, draining the two-frame pipeline between consecutive nonterminal GraphKind::Prefill chunks even when no token is sampled and no checkpoint capture or prompt boundary is reached.
  4. Mixed-graph and terminal-prefill catalog mismatches (helios/src/scheduler/{learning,service,policy}.rs): 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) and mirrored it in UtilityConfig.
    • 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 queued 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 (prompt_tokens - admission_reused_tokens) so total credit sums to 1× regardless of chunking and chunk sizing stays smooth under active decoder waiting age. The surplus vanishes automatically when decode capacity is saturated or when max_new_tokens == 1.
    • 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 via shared Ring9<T>) and exact 3-parameter relative-error-weighted NNLS fitting theta_0 + theta_1 * u + theta_2 * u * (start_position / 4096).
    • Narrow-fill upward extrapolation (u_max - u_min < 0.15, u > u_max) applies a bounded 4× constant-throughput floor t_at_umax * min(u / u_max, 4.0) to 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 (start_position >= 4096) borrow the per-token context slope theta_2 / peer_capacity from the largest fresh strictly larger peer of the same graph kind via an O(1) cached list (prefill_context_slopes, zero extra ENTRY_LOOKUPS).
    • Extended checkpoints::interval_prefill_ns with an O(1) closed-form arithmetic-series stride over full-chunk affine segments up to capacity-line crossovers 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) (Decode | Speculative | Prefill) across scheduler, policy, and all four executor layers.
    • Added prefill_cursor / _from planning helpers and prefill_step_requires_feedback, allowing consecutive nonterminal, non-capture GraphKind::Prefill chunks to pipeline two deep while draining at prompt end, checkpoint cuts, deferred-prefill limits, grammar constraints, stale/probe costs, or TerminalPrefill / ScoredPrefill.
    • Guarded ConsumedTokens | SnapshotConsumedTokens reuse in model.rs and updated verification/helios-lifecycle/check.py mutation targets to match the _from helpers.
  • 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 deleted 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 (3e57bdc8, balanced policy, unique uncached prompts, clean SIGTERM drain rc=0 on every run):

    Model / Hardware Workload origin/main (3e57bdc8) PR #645 Delta
    nvidia/Qwen3.8-27B-NVFP4@gb202-tp1-202610281501 (1× RTX PRO 6000 Blackwell) Simultaneous B=8 burst (8 × ~2,430 tok → 2,048 out) 398.6 tok/s, max TTFT 3,070.3 ms (24 prefill, 113 spec) 497.6 tok/s, max TTFT 2,776.8 ms (16 prefill, 71 spec) +24.8% tok/s, -9.6% max TTFT, -33% prefill launches, -37% spec rounds
    nvidia/Qwen3.8-27B-NVFP4@gb202-tp1-202610281501 (1× SM120) Simultaneous B=4 burst (4 × ~2,430 tok → 1,024 out) 305.8 tok/s, max TTFT 1,903.5 ms (11 prefill, 95 spec) 316.5 tok/s, max TTFT 1,855.3 ms (8 prefill, 91 spec) +3.5% tok/s, -2.5% max TTFT
    nvidia/Qwen3.8-27B-NVFP4@gb202-tp1-202610281501 (1× SM120) Consecutive ~130k uncached prompts (#485, Runs 0 / 1 / 2) 30,622.6 (57) / 30,349.9 (59) / 29,209.2 ms (38) 29,510.2 (52) / 28,982.5 (40) / 29,082.8 ms (39) -3.6% / -4.5% / -0.4% TTFT; -5 / -19 / +1 launches
    nvidia/Qwen3.8-Flash-Next-FP4-Local@gb202-tp2-202610270419 (2× SM120) B=4 / B=8 bursts (~3,275 tok, max_tokens=128) & 77k prompt 252.9 / 353.1 tok/s (B8 max TTFT 2,063.0 ms), 77k: 4,492.5 ms 262.7 / 354.9 tok/s (B8 max TTFT 2,017.6 ms), 77k: 4,488.1 ms +3.9% / +0.5% tok/s, -2.2% B8 max TTFT
    deepseek-ai/DeepSeek-V4.1-Flash-1017@gb202-tp4-202611281955 (4× SM120) Consecutive ~158k uncached prompts (#485, Runs 0 / 1 / 2) 3,524.0 / 3,497.3 / 3,494.0 ms (20 / 20 / 20 launches) 3,510.8 / 3,484.2 / 3,487.5 ms (20 / 20 / 20 launches) -13.2 / -13.1 / -6.5 ms per run, zero launch drift
  • Synthetic scheduling simulator (scripts/scheduling_sim, balanced policy, coalescing_horizon_tokens=64.0 vs 0.0):

    • burst_eight (8 × 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 × 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 × 4,096, zero draft acceptance): max TTFT 611 -> 559 ms (-8.5%), sub-batch rounds 6 -> 2.

Supporting Evidence and Limitations

  • 64-seed heldout timing-learning validation (scripts/scheduling_sim/learning.py --preset validate --reference ttl, all 62 scenarios × 64 seeds 10000..10063, Helios production retained-refresh alpha=0.002, credit_cap_ms=5.0, ttl_ms=30000.0, retain_idle_credit=true):
    • Accepted and selected: retained-refresh:funded:cumulative:alpha=0.002 — 35 / 35 core gates passed, 6 / 6 recovery gates passed, calibration passed (coverage_16=1.0, coverage_1000=1.0, mature_width=true), 0 / 64 stationary resets, geomean core throughput ratio 1.0093, worst core mean-seed p99 decode-gap ratio 1.0101 (below 1.05 ceiling).
  • Rust crate test 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 prefill_cost_model_prevents_tail_poisoning_and_tracks_fill_and_context, smaller_prefill_borrows_larger_peer_context_slope_to_prevent_run1_ladder_drift, non_constant_prefill_cost_model_preserves_stride_fast_path_on_long_agentic_prompts, simultaneous_burst_coalesces_prefills_into_full_decode_batches, nonterminal_prefill_frames_pipeline_two_deep_and_terminal_chunks_drain, unmeasured_terminal_prefill_discovery_uses_terminal_catalog_and_mixed_respects_alpha, and #644's excluded-only fairness tests). The 6 chat-template tests require FLARE_TEST_TEMPLATE_DIR from a gated Hugging Face repository and did not run locally.
    • flare: 237 passed, 0 failed.
    • flare-cli: passed; release build succeeded with 0 warnings.
  • Python test suites (pytest tests/cli tests/test_scheduling*.py -q): 961 passed, 0 failed.
  • TLA+ lifecycle verification (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 (Lifecycle, RankProtocol, DispatchRing, OffloadTransfer, CacheOwnership, Speculation, ResponseLifecycle, CheckpointReservation) and Rust trace conformance passed with 0 TLC errors; --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 A/B measurements cover SM120 TP1, TP2, and TP4; SM103/SM121 and TP16 Kimi K3.1 were not re-measured on hardware in this pass.

Discord: lukealonso

@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 645.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot flare-autobot added area:scheduling Request scheduling, fairness, batching, and speculative-width selection. bug Something isn't working enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:review Proposed change needs code review; this does not imply merge readiness. labels Nov 30, 2026
@flare-autobot flare-autobot added triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed. and removed triage:review Proposed change needs code review; this does not imply merge readiness. labels Nov 30, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The technical core (burst coalescing, stratified fill/context prefill cost modeling, two-frame GraphKind::Prefill pipelining, mixed/terminal catalog fixes) is well-scoped, model-agnostic, ABI-compatible and thoroughly tested on CPU, but two mandatory verification gates remain unmet and two verified cost-model edge cases need fixes.

  • Blockers: 2 · Should fix: 2 · Subtract/Simplify: 4 · Nits: 4
Walkthrough
  • Completion-attributed burst coalescing: Adds PolicyConfig::coalescing_horizon_tokens (default 64.0, validated nonnegative at helios/src/scheduler/policy.rs:222-234), LaneValue::prefill_finish (helios/src/scheduler/utility.rs:78-93), and coalescing_prefill_log_bonus (helios/src/scheduler/policy.rs:444-621), mirrored in scripts/scheduling_sim/utility.py:12-246 with burst workloads in scripts/scheduling_sim/workloads.py:50-53 and tests in tests/test_scheduling_utility.py:335-376 and helios/src/scheduler/policy_tests.rs:6494-6545.
  • Stratified fill-ratio and KV-context prefill cost model (#485): Adds PrefillPredictor, PrefillBucket, and PrefillCostModel in helios/src/scheduler/cost.rs:66-379 (6 strata of 9-sample medians, 3-parameter relative-error-weighted NNLS, narrow-regime upward bound), wired through ActionCosts::{prefill_duration, prefill_entry, prefill_predictor, get, observe} (cost.rs:529-587, 679-724) into policy.rs, service.rs:167-193, and checkpoints.rs:168-341.
  • Two-frame pipelining for consecutive nonterminal GraphKind::Prefill: Adds prefill_cursor / _from helpers and prefill_step_requires_feedback in helios/src/scheduler.rs:854-944, 1109-1143, widens eligible (policy.rs:311-322), model.rs:349-354 (ConsumedTokens | SnapshotConsumedTokens guard), and all four executor layers (transport.rs:967-968, 1020-1021, threaded.rs:872-876, threaded/protocol.rs:32-37, parallel.rs:262-264), and mirrors the _from refactor in verification/helios-lifecycle/check.py:544-605.
  • Mixed-graph curve and terminal-catalog fixes: Applies powered_curve + forecast_tokens in helios/src/scheduler/learning.rs:11-13, service.rs:250-265, and policy.rs:808-817 (with the !prefill guard), and switches unmeasured prefill discovery to effective_prefill_catalog (policy.rs:341-354, 729, 966, 1256).
  • Docs & tests: Updates docs/scheduling-runtime-design.md:198-207, 403-423, 567-577, updates helios/src/server/runtime/phase_tests.rs:1311-1318, and adds unit/lifecycle tests in cost.rs:848-943, policy_tests.rs:1420-1483, 6494-6640, and threaded/protocol_tests.rs:360-370.
Merge Risk: Medium · up to 05cccb6
  • Global unflagged scheduler/cost-model change: ActionCosts::get (helios/src/scheduler/cost.rs:679-691) routes all single-lane prefill steps through PrefillCostModel, and coalescing_prefill_log_bonus (helios/src/scheduler/policy.rs:444-621) is enabled by default (coalescing_horizon_tokens: 64.0), affecting prefill durations, admission ordering, and checkpoint pricing for every prefill-capable core.
  • Two-frame pipelining across scheduler and all four executors: Widening Decode | Speculative to Decode | Speculative | Prefill (helios/src/scheduler.rs:1132-1143, helios/src/model.rs:349-354, helios/src/execution/{transport,threaded,parallel}.rs, helios/src/execution/threaded/protocol.rs) is consistent and verified against device-side sticky error status (ignition/components/sampling.py:367-409) and check.py --mutations, though live TP2 serving was only checked single-arm on SM120.
  • Same-day semantic overlap with open PR fix(helios): per-step speculative calibration and excluded-only waiting/delivery fairness #644: Shares 7 files (policy.rs, policy_tests.rs, service.rs, utility.rs, docs/scheduling-runtime-design.md, scripts/scheduling_sim/utility.py, tests/test_scheduling_utility.py), including LaneValue and delivery-fairness units (policy.rs:582-586 uses inverse delivery rate stream_deliv_rate, whereas #644 switches delivery fairness to duration-independent served share s_i).
Pre-merge checks: ✅ 1 passed · ⚠️ 3 warnings
  • ✅ Security / malicious screen: No credential handling, shell/network additions, unsafe code, or prompt-injection attempts in PR text or diff.
  • ⚠️ Charter & value fit: Strong architectural alignment (shared runtime layer, no per-model branches, no ABI/Protobuf changes, closes #485), but fails Charter #210 / docs/design-review.md:109-111 (no served-workload A/B baseline over main) and skips a mandatory runnable CPU gate (docs/design-review.md:201-206, 247-251). Also closes #485 with an affine NNLS design rather than @voipmonitor's measured logarithmic-band prototype without re-running #485's long-context workload.
  • ⚠️ Related / duplicate / conflict check: Direct extension of merged #619, #538, #550, #459; non-duplicate, but open PR #644 (same author, same day) overlaps 7 files and changes LaneValue and delivery-fairness units—merge order and formula reconciliation need to be settled.
  • ⚠️ Tests & verification evidence: Crate suites (eos, selene, selene-manager, helios, flare, flare-cli), pytest (644 passed), and check.py --mutations (all 8 TLA+ models) are reported passing and CI is green on 05cccb6, and all new tests are properly isolated and exercise production entry points. However, learning.py --preset validate (64-seed sweep) was not run, 8 × 8,192 burst numbers have no checked-in workload, and live GPU measurements lack a main control.

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

…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>
@lukealonso
lukealonso force-pushed the helios-prefill-burst-coalescing-cost branch from 05cccb6 to 2f3c079 Compare November 30, 2026 20:44
@lukealonso
lukealonso merged commit e85019b into main Nov 30, 2026
3 checks passed
FujitsuPolycom added a commit to FujitsuPolycom/flare-local-inference that referenced this pull request Nov 30, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:scheduling Request scheduling, fairness, batching, and speculative-width selection. bug Something isn't working enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler ActionCosts aliases short- and long-context prefill timings, causing chunk-size drift at 64k–128k

2 participants