Repository navigation
helios: avoid splitting prefill on zero-budget checkpoint anchors - #582
Conversation
voipmonitor
left a comment
There was a problem hiding this comment.
Review & Live 4× SM120 Test Report (commit a3c64835)
Verdict: Request changes (2 blocker correctness bugs) — the motivation is solid, TLA+ conformance checks pass, and live 4× SM120 serving confirms the intended reduction in prefill splits at --scheduler-checkpoint-extra-work-fraction 0, but two bugs in checkpoints.rs cause duplicate RetentionRole::Anchor captures on normal multi-chunk workloads.
Automated & Live 4× SM120 Test Results
cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler::— 390 passed, 0 failed.python3 verification/helios-lifecycle/check.py(all 8 TLA+ models + mutation checks) — PASSED.- Live 4× SM120 (
DeepSeek-V4.1-FlashTP4,--scheduler-checkpoint-extra-work-fraction 0, identicalorigin/mainbase):- Short 2-turn chat (
242tok):prefill_stepsdropped2 → 1(anchor_captures = 1). - Multi-chunk 2-turn (
12,212–12,232tok, 5 runs):prefill_stepsdropped3 → 2across all 5 runs, thoughflare_checkpoint_skips_total{reason="work_budget"}still incremented1..3per request atfraction == 0.0(confirming Major #5 below). - 64K cold NIAH (
71,429tok):59,453 tok/s,needle_ok = True.
- Short 2-turn chat (
Findings
- [Blocker] Duplicate
RetentionRole::Anchorcapture on normal upward GPU EWMA timing drift (helios/src/scheduler/checkpoints.rs:364-388, 466-505):
checkpoint_selection_uncachedlatchesaccounting.initial_prefill_nsonce atstart = 0and passes it asknown_wholeintoanchor_split_is_zero_cost, comparingbefore(live_catalog) + after(live_catalog)againstwhole(old_latched_ewma).- Reproducer:
prompt = 1024,message_boundaries = [512],prefill_catalog = [512](512_000 ns),fraction = 0.0. Chunk 1 (0..512) sees zero split cost, keeps512asAnchor, runs on GPU with tiny normal jitter (515_000 ns→ EWMA512_300 ns), and publishes512asAnchor. At Chunk 2 (start = 512),raw_anchor > startis false, so execution enters theelse ifbranch:before(512_300) + after(512_300) - known_whole(1_024_000) = 600 != 0, flipping toanchor = 1024and capturing a secondRetentionRole::Anchorat1024. - (Why the PR's unit test missed this:
complete_test_steppasseddur_ns = 1_000vs512_000, pushing EWMA downward sosaturating_subclamped to0— which symmetrically causes the inverse bug where downward EWMA drift falsely classifies genuinely costly splits as zero-cost.)
- Reproducer:
- [Blocker] Duplicate
RetentionRole::Anchorcapture whenMixedprefill shifts chunk alignment (checkpoints.rs:466-505):- Reproducer (zero EWMA drift):
prefill_catalog = [128, 512](150k, 400k),mixed = [(2, 1, 256)],prompt = 1024,raw_anchor = 768,fraction = 0.0. Atstart = 0,0..768..1024is costly → fallback1024. Chunk 1 executesMixed(256)(0..256). Atstart = 256,256..768..1024(512 + 256) is zero-cost → selects & publishes768asAnchor(anchor_fallback_from = None). Atstart = 768, theelse ifbranch re-prices frombaseline_start = 0, sees0..768..1024is costly, and publishes a secondAnchorat1024. - Fix for Blockers #1 & #2: Always price
whole,before, andafterfrom the samecatalogsnapshot (do not pass staleknown_whole), and latch an explicit(raw_anchor, chosen_anchor)decision onCheckpointAccounting(preserved acrossclear_reservations()) instead of reconstructing fallback backwards frombaseline_start.
- Reproducer (zero EWMA drift):
- [Major]
is_request_anchor_endpointhardcodesstart = 0and checksraw_anchorbeforelimits.snapshots == 0(checkpoints.rs:390-420,scheduler.rs:1794):
On a partial prefix hit (baseline_start = 88,raw_anchor = 600,prompt = 1024,prefill_catalog = [128, 512]),checkpoint_selection_uncachedprices from88and selects600(zero cost), whileis_request_anchor_endpoint(req, 1024)prices from0and also returnstruefor1024, allowingpromote_request_anchor/ inbound restore to promote both. Checklimits.snapshots == 0first and price frombaseline_startwhenbaseline_start < raw_anchor. - [Major]
clear_reservations()wipesanchor_fallback_from(checkpoints.rs:48-52,scheduler.rs:1726):
admit_planned_with_checkpoint_accountingpreservesCheckpointAccountingacross preemption/readmission and callsclear_reservations(). Preserve the latched zero-budget anchor decision acrossclear_reservations()just likebaseline_intervalandinitial_prefill_ns. - [Major]
O(N)wasted prefill pricing & spuriouscheckpoint_skip_work_budgetstats atfraction == 0.0(checkpoints.rs:538-650):
Whenfraction == 0.0andanchorfalls back toprompt_tokens,raw_anchorand all earlier message boundaries entercandidatesand run2 * Ninterval_prefill_nswalks every step even thoughavailable == 0can never fund optional cuts. Return early after pushing theAnchorcut whenfraction == 0.0. - [Minor]
- Move
if self.limits.snapshots == 0beforeprefill_catalog_costsand short-circuitallocate_terminal_capturewhensnapshots == 0. - Update the stale follow-on sentences in
docs/core-design.md:1448-1449anddocs/scheduling-runtime-design.md:567-569so they agree with thefraction == 0.0unknown-cost fallback rule. - Add regression unit tests for upward EWMA drift,
Mixed-prefill alignment shift, partial prefix hit< raw_anchor, and preemption/readmission, and replace the brittle 13-line string literal mutation inverification/helios-lifecycle/check.py:325-343.
- Move
|
A case file has been opened for 582. Future reviews will auto-run 90 minutes after code updates are pushed.
|
A conversation message boundary can fall inside a prompt where cutting
prefill requires an extra padded graph launch, even when snapshot storage
capacity is zero or `scheduler_checkpoint_extra_work_fraction` is zero.
Avoiding that extra prefill launch requires evaluating split cost from one
consistent catalog snapshot, latching the resulting anchor endpoint across
multi-chunk prefill progress, `Mixed` prefill alignment shifts, EWMA timing
updates, and preemption readmission, and resolving a single anchor endpoint
for reuse promotion and Selene inbound restore.
- `helios/src/scheduler/checkpoints.rs` and `helios/src/scheduler.rs`:
- Before: Helios always kept the last eligible message boundary as the
anchor regardless of snapshot capacity or zero-fraction prefill split
cost, evaluated optional cuts even at zero extra-work fraction, and did
not short-circuit zero snapshot capacity before catalog pricing or
terminal capture allocation.
- After: Helios returns immediately with no cuts or terminal allocations
when snapshot capacity is zero. When
`scheduler_checkpoint_extra_work_fraction` is zero, Helios prices
`whole`, `before`, and `after` intervals from the same
`prefill_catalog_costs` snapshot, keeps an interior message boundary as
the anchor only when splitting there adds zero predicted prefill work,
falls back to `prompt_tokens` otherwise (including when prefill costs
are unknown), latches `(raw_anchor, chosen_anchor)` on
`CheckpointAccounting` across remaining chunks and
`clear_reservations()`, skips optional-cut pricing and `work_budget`
skip increments, and resolves a single consistent anchor endpoint across
partial prefix hits, `promote_request_anchor`, and Selene inbound
restore.
- Compatibility: Existing signed cores, Protobuf wire contracts, nonzero
extra-work fractions, and optional `Endpoint` eviction rules are
unchanged.
- `docs/cli-design.md`, `docs/core-design.md`, and
`docs/scheduling-runtime-design.md`: Document zero-capacity cut
suppression and zero-fraction interior-anchor split pricing, including
unknown-cost fallback to the prompt-end anchor.
Zero-budget serving avoids extra padded prefill launches on unaligned
interior message boundaries while preserving single-anchor checkpoint
capture and prefix reuse across single-chunk, multi-chunk, `Mixed`-prefill,
and preempted requests, without duplicate `Anchor` publications or spurious
`work_budget` skip counts. On prior PR revision `a3c64835` atop `167f22c8`
(`DeepSeek-V4.1-Flash` TP4 on 4x SM120 with
`--scheduler-checkpoint-extra-work-fraction 0`), reviewer live serving
observed `prefill_steps` drop `2 -> 1` on 242-token 2-turn chat and `3 -> 2`
across five 12,212-12,232-token 2-turn runs (`59,453 tok/s`,
`needle_ok = True` on 71,429-token 64K cold NIAH); live signed-core serving
has not been re-run on this revision.
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler::`:
394 passed, 4 ignored, 0 failed (0 warnings in touched files).
- `python3 verification/helios-lifecycle/check.py --mutations`: all TLA+
models, observed Rust trace-conformance checks (including 59
`CheckpointReservation.tla` transitions covering multi-chunk fallback,
upward EWMA drift, and `Mixed` alignment shift), and all 12 TLA+ model and
19 Rust guard mutations passed (`Detected Rust mutation: dropped
multi-chunk zero-budget fallback`).
- `pytest -q -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/test_scheduling_learning_policy.py tests/test_scheduling_learning_experiments.py tests/test_scheduling_sim.py`:
312 passed.
- Broad `helios --lib` reproduces only environment-gated and base-existing
failures (`FLARE_TEST_TEMPLATE_DIR` unset, WSL2 8 MiB `RLIMIT_MEMLOCK` on
two parallel `engram::reader` tests, and pre-existing
`model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape`).
- Limitations: Live `flare run` GPU serving and isolated latency benchmarks
were not re-executed on this post-review revision.
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4); design-review=c3a9
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe problem is real and in the right layer, and live 4× SM120 testing confirmed the expected prefill-launch reduction, but this head has two verified correctness blockers that emit duplicate
Have your agent review the Full Review for complete verified findings, To opt out, include |
a3c6483 to
69bf2cf
Compare
|
Updated branch to 69bf2cf (clean rebase on �a3afb13, verified conflict-free against main 44f59df, full scheduler:: 394 passed + �erification/helios-lifecycle/check.py --mutations 12 TLA+ & 21 Rust guard mutations passed) and added exact-SHA live 4× RTX PRO 6000 SM120 lare run A/B evidence (�a3afb13 vs 69bf2cf on signed DeepSeek-V4.1-Flash TP4 with --scheduler-checkpoint-extra-work-fraction 0):
|
voipmonitor
left a comment
There was a problem hiding this comment.
Verified updated commit 69bf2cf2 — every Round 1 blocker/major/minor finding is cleanly resolved (same-snapshot split pricing, latched zero_budget_anchor: Option<(usize, usize)> preserved across chunks & clear_reservations(), unified single-anchor request_anchor_endpoint across partial prefix hits/promote_request_anchor/Selene restore, zero-fraction optional candidate pricing skip, snapshots == 0 early exits, and updated docs/mutations).
Verification (69bf2cf2)
- Clean merge vs
origin/main(44f59df5): Zero conflicts. - Rust scheduler tests:
cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler::— 394 passed, 0 failed, 4 ignored (0warnings in touched files). - Formal verification (
verification/helios-lifecycle/check.py --mutations): All exhaustive TLA+ models, observed-edge conformance suites (including59observed Rust transitions againstCheckpointReservation.tlacovering upward EWMA drift &Mixedalignment shift), and all TLA+ & Rust mutations PASS. - Live 4× RTX PRO 6000 Blackwell (SM120)
flare runcheck (69bf2cf2--releasebinary, DS4.1-Flash TP4 signed core, RAM Engram,--prefix-cache-memory 64G --scheduler-checkpoint-extra-work-fraction 0):- Greedy
17 * 23:391(prompt=43,prefill_launches=1,anchor=1,0prefill budget skips). - Short 2-turn chat (
prompt=95):prefill_launches=1(down from2),anchor=1; identical repeatcached=95/95(restore_launches=1,prefill_launches=0). - Multi-chunk 2-turn chat (
prompt=12,051):prefill_launches=2(down from3),anchor=1. - 64K Cold NIAH (
prompt=66,367):dt=1.184s(56.1k tok/swall),needle_ok=True(VORTEX-6982-SAPPHIRE),prefill_launches=9,anchor=1.
- Greedy
Ready to merge.
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergeAll Round 1 correctness blockers, major issues, and minor items are cleanly resolved in
Walkthrough
Merge Risk: Low · up to
|
|
The core fix is in the right layer and addresses a real zero-budget / zero-capacity prefill-splitting defect, but Blockers
Should fix
Minor
|
Resolved trivial conflicts with NVIDIA#613 (combine limits.snapshots == 0 and request.deferred_prefill guard in allocate_terminal_capture) and NVIDIA#614 (preserve NVIDIA#582 checkpoint mutation check before build_test_binary / run_observed_checks in verification/helios-lifecycle/check.py). Design-Signed-Off-By: Antigravity (Gemini 4); design-review=2e5b
…anchor refresh) Address all review items from @lukealonso on NVIDIA#582: - Key CheckpointAccounting::zero_budget_anchor on (raw_anchor, prompt_tokens, chosen) so a growable request preempted after decode (extending prompt_tokens via park()) never turns an obsolete pre-preemption prompt-end fallback into a spurious interior prefill cut upon readmission. - Keep separate limits.snapshots == 0 and request.deferred_prefill checks in allocate_terminal_capture so NVIDIA#613's mutation test remains intact. - Latch zero_budget_anchor inside promote_request_anchor on first resolution so full-prompt GPU cache hits run O(1) on subsequent Resume/Decode steps without per-step catalog allocation or interval_prefill_ns calls. - Remove fragile parent_tokens reconstruction in request_anchor_endpoint: on a full-prompt GPU cache hit where raw_anchor is absent, keep prompt_tokens immediately when request.prefix is already RetentionRole::Anchor (guaranteeing demand_epoch refresh even with a system-prompt parent), otherwise price from 0. - Remove the dead zero_budget_anchor fallback branch in plan_checkpoints, wrap docs/scheduling-runtime-design.md line 573, update check.py's mutation target, and add targeted regression tests for grown-prompt readmission, full-prompt Anchor demand_epoch refresh with a system-prompt parent, and zero STRIDE_RUNS on latched Resume/Decode steps. Verified on origin/main (2147cd4, incl. NVIDIA#613 + NVIDIA#614): - cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler:: -> 403 passed, 0 failed, 4 ignored - python3 verification/helios-lifecycle/check.py --mutations --jobs 8 -> all TLA+ models, all 8 observed-edge suites (68 CheckpointReservation transitions on 16-int deferred model), and all TLA+/Rust mutations passed. Design-Signed-Off-By: Antigravity (Gemini 4); design-review=2e5b
|
@lukealonso Thanks for the thorough catch — addressed every item in Addressed Findings
Verification (
|
|
Everything from the previous round was addressed cleanly, except Blocker
Minor / Merge Hygiene
|
Design-Signed-Off-By: Antigravity (Gemini 4); design-review=2e5b Signed-off-by: Martin Vit <martin@voipmonitor.org>
…stale baseline guard) Address all review findings from @lukealonso on NVIDIA#582 (Rounds 1 & 2): - Key `CheckpointAccounting::zero_budget_anchor` on `(raw_anchor, prompt_tokens, chosen)` so a growable request preempted after decode (extending `prompt_tokens` via `park()`) never turns an obsolete pre-preemption prompt-end fallback into a spurious interior prefill cut upon readmission. - Filter stale `baseline_interval` in `request_anchor_endpoint` so it is only reused when `end == request.prompt_tokens`, preventing grown-prompt readmission from fabricating a stale anchor endpoint on `Restore`. - In `promote_request_anchor`, gate latching on `request.consumed_tokens >= prompt_tokens` (preventing premature latching before prefill completes) while preserving O(1) latched `Resume`/`Decode` steps without per-step catalog allocation or `interval_prefill_ns` calls. - Remove fragile `parent_tokens` reconstruction in `request_anchor_endpoint`: on a full-prompt GPU cache hit where `raw_anchor` is absent, keep `prompt_tokens` immediately when `request.prefix` is already `RetentionRole::Anchor` (guaranteeing `demand_epoch` refresh even with a system-prompt parent), otherwise price from `0`. - Keep separate `limits.snapshots == 0` and `request.deferred_prefill` checks in `allocate_terminal_capture` so NVIDIA#613's mutation test remains intact. - Remove the dead `zero_budget_anchor` fallback branch in `plan_checkpoints`, wrap `docs/scheduling-runtime-design.md` line 573, update `check.py`'s mutation target, and add regression tests covering: - grown-prompt readmission (`prefix=512` and `prefix=1024`) verifying `checkpoint_cut` stays `None` across `Restore`, `checkpoint_capture.is_none()`, `checkpoint_anchor_captures == 0`, and `ready_by_prefix(1124).is_none()`; - full-prompt `Anchor` `demand_epoch` refresh with a system-prompt parent and zero `STRIDE_RUNS` on latched `Resume`/`Decode` steps; - full-prompt `Endpoint` (`raw_anchor == 512`) latching in `promote_request_anchor` (`STRIDE_RUNS > 0` on `Restore`, `0` on `Resume`/`Decode`). Design-Signed-Off-By: Antigravity (Gemini 4); design-review=2e5b Signed-off-by: Martin Vit <martin@voipmonitor.org>
cc144c7 to
754f873
Compare
|
@lukealonso Thanks for catching those two! All items from your latest review are addressed in
|
Why
A conversation message boundary can fall inside a prompt where cutting prefill requires an extra padded graph launch, even when snapshot storage capacity is zero or
scheduler_checkpoint_extra_work_fractionis zero. Avoiding that extra prefill launch requires evaluating split cost from one consistent catalog snapshot, latching the resulting anchor endpoint across multi-chunk prefill progress,Mixedprefill alignment shifts, EWMA timing updates, and preemption readmission, and resolving a single anchor endpoint for reuse promotion and Selene inbound restore.What changed
helios/src/scheduler/checkpoints.rsandhelios/src/scheduler.rs:scheduler_checkpoint_extra_work_fractionis zero, Helios priceswhole,before, andafterintervals from the sameprefill_catalog_costssnapshot, keeps an interior message boundary as the anchor only when splitting there adds zero predicted prefill work, falls back toprompt_tokensotherwise (including when prefill costs are unknown), latches(raw_anchor, prompt_tokens, chosen)onCheckpointAccountingacross remaining chunks andclear_reservations()(invalidated ifpark()growsprompt_tokens), filters stalebaseline_intervalentries inrequest_anchor_endpointtoend == request.prompt_tokens, skips optional-cut pricing andwork_budgetskip increments, and resolves/latches a single consistent anchor endpoint across partial prefix hits, full-prompt GPU cache hits,promote_request_anchor(gated onconsumed_tokens >= prompt_tokensforO(1)Resume/Decodesteps), and Selene inbound restore.Endpointeviction rules are unchanged.docs/cli-design.md,docs/core-design.md, anddocs/scheduling-runtime-design.md: Document zero-capacity cut suppression and zero-fraction interior-anchor split pricing, including unknown-cost fallback to the prompt-end anchor.Claimed benefit and observed results
Mixed-prefill, and preempted requests, without duplicateAnchorpublications or spuriouswork_budgetskip counts.flare runA/B (ba3afb13vs69bf2cf2):DeepSeek-V4.1-FlashTP4 (gb202-tp4-202611281642,--scheduler-checkpoint-extra-work-fraction 0, plain local/dev/nvme1n1p1ext4) across interleaved--scheduler-policy balanced(2 passes,--prefix-cache-memory 8GiB),--scheduler-policy throughput(8GiB), and--prefix-cache-memory 0(balanced) runs on multi-turn chat prompts with interior message boundaries:short_2turn(4 req):flare_graph_launches_total{kind="prefill"}dropped8 -> 4(-50%) on every pass; TTFT p50 dropped-18.9%to-19.4%(82.2 -> 66.2 ms,79.7 -> 64.6 ms,80.7 -> 65.4 ms,80.2 -> 64.7 ms).long_12k_2turn(2 req, ~61K tok): prefill launches dropped6 -> 4(-33%) on every pass;long_20k_2turn(1 req, ~51K tok):5 -> 4(-20%).mixed_load(4 active decode streams + 2 staggered ~30K-token 2-turn cold prefills): prefill launches dropped16 -> 10(-37.5%), prefill TTFT p50 dropped-15.1%to-23.8%(2918.1 -> 2466.6 ms,2949.8 -> 2503.0 ms,2839.5 -> 2163.8 ms), and mixed wall time dropped-4.4%to-5.7%.flare_message_checkpoints_totaldropped to0,flare_prompt_checkpoints_totalabsorbed all terminal anchors,unknown_costskips dropped to0–1, and all containers exited cleanly (exit=0).Supporting evidence and limitations
754f873a94f5461110c8ff2a8fa12f8677b79f29merged withorigin/maine80b1f2f7da2221f7301bcd50f4bee3977b2b3e2(all commits DCO-signed).754f873a):cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler::: 403 passed, 4 ignored, 0 failed.python3 verification/helios-lifecycle/check.py --mutations --jobs 8: all TLA+ models, all 8 observed Rust trace-conformance suites (including 68CheckpointReservation.tlatransitions covering multi-chunk fallback, upward EWMA drift,Mixedalignment shift, and deferred prefill), and all TLA+ and Rust guard mutations passed (Detected Rust mutation: dropped multi-chunk zero-budget fallback).pytest -q -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/test_scheduling_learning_policy.py tests/test_scheduling_learning_experiments.py tests/test_scheduling_sim.py: 312 passed.69bf2cf2vsba3afb13): cleangit archiverelease binaries (flare_base_ba3asha25672c61a47759f9fe6f377ad2a16ba2d0847643f26e59211522fc5bbe849ecccc8,flare_pr582_69bfsha256bfd1a5a7bcc34470978d5b2bd5d8ae5547c2bd7a21f33592cd5626b0f8146825) onai01(4x RTX PRO 6000 Blackwell SM120). Live GPU serving was not re-run after the754f873ascheduler review follow-ups.temperature=0to the core's general sampling defaults, so live validation confirmed exact prompt-token counts, valid finish reasons, and coherent completions rather than greedy token-string equality. Live GPU serving was verified on 4× SM120 TP4 (DeepSeek-V4.1-Flash); SM103/SM121 were not re-benchmarked on this revision.Discord: Dooner