Explore scratchpad · NVIDIA/hyperflare-inference #663

Raw Markdown for agents: https://autobot.eidonix.com/p/b10883c8-7959-429f-9015-11eee8323f45.md

#1 [high] Change: what PR #663 does (verified from diff)

PR #663, head a5c3697, base main (a3c80e19), 11 files +511/-40. Open, ready for review, label area:scheduling/enhancement/performance, no reviews, CI passed.

Production Rust changes (verified in diff):

  1. helios/src/scheduler/policy.rs:59 adds RequestAccounting::first_output_wait_ns; credit() gains a preserve_first_output_wait: bool param and only advances the clock when it is false (policy.rs:71-84).
  2. RequestScheduler::set_first_output_wait(handle, wait_ns) (policy.rs ~267-278) validates wait_ns <= now_ns and last_use == Fence(0) (must precede admission/dispatch), stores max(wait_ns, arrival_ns).
  3. initialize_accounting/new request init sets first_output_wait_ns = now_ns (policy.rs ~307).
  4. New RequestScheduler::fits_single_prefill_from(request, start) (policy.rs ~440-465): true iff prefill_limit() == prompt_tokens, start < prompt_tokens, and some catalog capacity covers exactly the remaining work and resolves to a measured graph kind (respecting prompt_logprobs → scored catalog and terminal-only requirement).
  5. policy.rs::lane_values now calls delivery_references_and_decode_batch and computes LaneValue::first_output_value = decode_age_price * incumbent_decode_batch_ms * age_ms for non-terminal prompts (consumed_tokens < prompt_tokens, max_new_tokens > 0, decode_age_price > 0, incumbent_decode_batch_ms > 0). age_ms measured from max(expected_finish_ns of in-flight prefill submissions containing the request) else first_output_wait_ns. Waiting prompt is NOT added to the age_price sum (verified: age_price += value.age_price only).
  6. utility.rs: LaneValue::first_output_value field; new prefill_within(consumed, initial_prefill, first_output) = prefill_token*consumed + output_token*first_output + first_output_value * frac, frac=1.0 when finishing, else min(consumed/initial_prefill, 1); old prefill() kept #[cfg(test)] only.
  7. service.rs: delivery_references split into delivery_references_and_decode_batch returning ([Option<DeliveryReference>; N], f64); second value = b_served^2 * per_delivery_ms for the fastest Decode/Speculative per-delivery round = b_served * T_dec stream-ms; 0.0 if no finite candidate.
  8. scheduler.rs:2674-2700: preserve_first_output_wait computed per prefill lane: kind.is_prefill(), record not terminal/finished, prefill>0, output==0, !request.deferred_prefill, consumed_tokens < prompt_tokens, checkpoint_capture role==Anchor && endpoint==record.consumed_tokens, and fits_single_prefill_from(request, request.consumed_tokens). scheduler.rs:348: new LiveRequest::initial_prefill_tokens() = prompt_tokens - admission_reused_tokens max 1 (also replaces an inline duplicate at policy.rs ~523).
  9. helios/src/server/runtime.rs: Carried::last_output_ns (Option) new field, set from live.accounting().last_output_ns (fallback to carried value) at park time (~2453-2500), and on readmission set_first_output_wait(handle, last_output_ns) (~1572-1578).
  10. scripts/scheduling_sim/utility.py: mirrors formula via _first_output_value dict, incumbent_decode_batch_ms = per_delivery_ms * served^2 from the existing reference decode selection.
  11. Tests: policy_tests.rs +214 (4 new tests), runtime/phase_tests.rs +1 (last_output_ns: None), tests/test_scheduling_utility.py +52/-15.
  12. Docs: docs/scheduling-runtime-design.md +16, docs/scheduling-utility.md +33.

Description claims ~105 net production Rust lines, 0 new CLI/config flags, 0 new graph kinds, 0 protobuf/ABI changes — all consistent with the diff. No new config knob exists (confirmed: no CLI/src/cli.rs change; PolicyConfig untouched except reuse of decode_age_price).

#2 [high] Related work: PR cluster #654/#655/#660/#661/#662 vs #663

#3 [high] Project fit: contradicts docs/scheduling-theory.md:850 and changes the DEFAULT balanced policy

HIGH: docs/scheduling-theory.md:850-853 still states, at PR head (unmodified by #663): "First-token waiting has no independent age penalty: prompt work competes by its useful progress and token-service price." #663 adds exactly such a penalty (scaled by decode_age_price) to the default balanced selector, documented only in docs/scheduling-utility.md:287-318 and docs/scheduling-runtime-design.md:264-282. The PR does not touch docs/scheduling-theory.md (verified: not in the 11 changed files; the diff only edits scheduling-utility.md and scheduling-runtime-design.md).

#4 [high] Claims vs evidence: simulator mirror is a simplification, anchor/readmission paths are Rust-only

Rust side (verified):

Python simulator (scripts/scheduling_sim/utility.py:158-162, 251-259, 266-270) — a simplification, not a mirror:

#5 [high] People: yatesdr owns the checkpoint/prefill-sizing selector code; Luke Alonso owns the surrounding fairness work

Yates Drury / yatesdr (GitHub association COLLABORATOR, Discord "D-Rock"):

Other people:

#6 [high] Project fit: charter and design-review mapping

Charter (read_charter) lines relevant to #663:

#7 [high] Claims and evidence: what is backed, what is not, and the loosened existing tests

CLAIMED (from PR body, unverified by me — no GPU/compiler available here):

  1. Served GPU A/B on 4× DGX Spark GB10 SM121, DeepSeek-V4.1-Flash TP4 zero-re-export, base a3c80e19 vs head a5c36978: K=8 returning-agent TTFT p50 2812→1025 ms (-63.5%), turns/min 13.21→21.77; K=16 TTFT p50 5265→894 ms (-83.0%, 5.9×), turns/min 8.75→18.00 (+105.7%); C=12 burst TTFT p50 5524→5018, max 7177→5416; K=16 with checkpoint_extra_work_fraction=0.0 TTFT p50 4656→3427 (-26.4%); throughput control parity (3659→3540).
  2. Disclosed trade-off: at K=16 balanced, background decode gap p99 368.4→463.5 ms (+25.8%, +95 ms) while p95 211.1→184.0 (-12.8%). At K=8 both p95 and p99 improved; C=12 burst p99 183.9→158.3. This is the only regression-shaped number in the PR and it IS disclosed.
  3. Simulator: 21/21 reference workloads exact trace identity at age_price=0.0; zero regressions at 0.1 with improvements (burst_eight max TTFT 706→572 ms, makespan 2060→1966, sub-batch rounds 8→2; burst_eight_8k 1314→1100; sixteen_prefills 9274→8552; burst_eight_low sub-batch 2→0). Adversarial: 32 dec/B=4/16 prompts holds consec_pre=1; 4 dec/B=1/24 prompts exact parity.
  4. Rust --release: helios (runtime-core,server) 1758 passed/0 failed/5 skipped (FLARE_TEST_TEMPLATE_DIR unset); flare 253; flare-cli 241; heliopause cargo check 0 new warnings. Python: pytest tests/test_scheduling*.py 829 passed. TLA+ check.py: 10/10 TLC, 8/8 observed Rust traces (594,065 transitions), 12/12 aux.
  5. "~105 net production Rust lines", "0 new CLI/config flags, 0 new graph kinds, 0 Protobuf/ABI changes, 0 new compiler warnings".
  6. "CI on the head commit: passed" — orientation packet confirms; consistent with the claim.

WHAT I COULD VERIFY DIRECTLY (from the diff): items 5 (all true: no cli.rs, no config.rs, no protobuf; the only sizing is the 11 listed files) and the shape of every described code change (see entry 1). I could not verify any timing number.

WHAT IS NOT BACKED:

EXISTING TEST THAT HAD TO BE REWEAKENED (a real, undeclared-in-"what changed" effect):

#8 [high] Reach: default balanced deployments are affected with no opt-in or knob

Reach (who/what is affected):

#10 [high] Recent activity: #663 builds on #644/#645 on the same base; #42 and #654 show the symptom recurs

Recent activity in the touched areas (from orientation packet + search_history):

#11 [high] Why: the two problem halves and how each is evidenced; lead disposition list

The "Why" problem statement has two parts; here is how each is evidenced (so the report can separate them): (A) WAITING-AGE ASYMMETRY (prompts get no waiting credit while decoders do): intrinsic to the selector as of a3c80e19 — docs/scheduling-utility.md:250-285 (pre-#663 text) gives decode lanes c_i*sigma_i*(A_i+T) and says "With no active decoder, the age terms vanish"; nothing gives a prefill-only request any waiting term. So the asymmetry is real and verifiable from docs+code, not just asserted. It is also independently attested by #654's author (measured 2.4-3.1 s TTFT behind 16 decoders on his hardware) and, in a different mechanism, by #42. (B) DOUBLE STALL ACROSS A FORCED INTERIOR ANCHOR CUT (202 of 204, then Snapshot, then 2-token tail, each re-queued at zero age): the mechanism is verifiable in code — credit() advanced first_output_wait_ns/last_progress_ns on any prefill progress (policy.rs:71-86 pre-change), and anchor cuts are made by scheduler_checkpoint_extra_work_fraction (default 0.05, policy.rs:40) per docs/cli-design.md:696-709. #660 (open, same day) documents the same splits from the cost side ("splitting a 453-token prompt at 450 adds an 18 ms tail, +62% work"). No issue reports the double stall; only #663/#662 claim it. LEADS FROM THE ORIENTATION PACKET I FOLLOWED OR DISMISSED:

#9 [medium] Process and community: ready, CI green, no reviews or comments, no linked issue

Process / community state as of the case file (PR opened and last updated 2026-12-01):