Value proposition scratchpad · NVIDIA/hyperflare-inference #540

Raw Markdown for agents: https://autobot.eidonix.com/p/9727b9b6-bf34-47ae-8cc0-5550a48c7edc.md

#1 [high] PR 540 overview: scope, files, claims

PR #540 (open, author FujitsuPolycom), "helios: cost-refresh recovery, prompt+output SAM copy-drafts, and calibrated wide copy-verify". 25 files, ~+3,900/-100. New file helios/src/scheduler/sam.rs (+1606).

Commits: a85be397 (cost refresh: observed_compute_duration_ns excluding readiness wait_ns, credit retained across idle, refresh_order two-tier key), 83ff9ed6 (per-request PromptSAM+OutputSAM copy drafts, LiveRequest::sam at admission when --history-drafts), 35ab143a (draft_source metadata on graphs 1=MTP/2=COPY, selection pruning, CopyCalibration with WIDE_COPY_PRIOR_RATE 0.88 / WIDE_COPY_MIN_MATCH_LEN 6, copy-only step isolation from MTP acceptance), 7ca5430c (dominates_padding_with strictly-wider pruning, DEFAULT_MIN_MATCH_LEN 3->6).

Claims: B16/B32 over-padding eliminated (max_b==C); history-drafts on 512-token repetitive prompt 3.078->3.650 tok/round, 408->460.8 tok/s (+12.9%); non-repetitive adds +0.25 ms/rd opt-in overhead. PromptSAM build 0.80/2.72/13.05 ms at 8k/32k/128k tokens, 0.37/1.27/4.52 MiB; push+propose 140-317 ns/step. Tests claimed: 615 passed helios, 1,625 passed lib w/ runtime-core+server, 102 py tests. Live HW: 4x RTX PRO 6000 Blackwell SM120, DeepSeek-V4.1 Flash TP4 only.

Charter hits: "bring real evidence" (has benches but on one model/one HW), "keep runtime small and model-agnostic", "no per-model special cases or flags" (this is guarded by existing --history-drafts flag but adds draft_source core metadata), "captured-graph op contracts require owner approval" (draft_source is new graph metadata). Roadmap: not on roadmap; cost-refresh recovery is a bug-fix-shaped item.

Discussion so far: only an autobot case-file comment (no human review). Related: #289 (merged fix that bounded history proposals), #287 (crash bug history drafts). Prior art check: Link-Cut Tree claimed in description but code uses splay tree (RootedLct with splay_stack, cut_parent/link) — verify.

#3 [high] Verified export blocker: wide copy-verify is dead on every exported core

VERIFIED INDEPENDENTLY in the repo at PR head and at main.

Chain:

  1. Producer emits integer draft_source: ignition/preparation/execution.py:32 (draft_source: int = 1), validated at :102-108 (1 or 2; 2 = COPY_DRAFT; copy-only graphs must have confidence_width==0 and no speculative_prefix_limits), serialized into the graph dict at :316-319.
  2. Only export route to the wire Execution: heliopause/src/export/binding.rs:136 pub(crate) fn execution(...), called once at heliopause/src/export/capture.rs:3158, stored at capture.rs:3160 (output.index.ranks[0].execution = Some(execution)). No other writer found (grep .execution = Some in heliopause returns only that). Python never builds the proto Execution directly (ignition/preparation/execution.py only produces the JSON-shaped dict; runtime_core_pb2 importers are packing/contract/core_file/protection/rebuild_manifest).
  3. binding.rs:196-202, for kind=="speculative" (or mixed && speculative): graph.insert("draft_source".into(), "MTP".into()) at :201 — UNCONDITIONALLY overwrites whatever the producer sent. This line exists on main too (read at ref=main, same line 201), i.e. it predates the PR and the PR did not extend it.
  4. Load side accepts 1 or 2 (helios/src/runtime_core/selection.rs:244 ![1,2].contains(&graph.draft_source)), so the coerced "MTP"=1 passes validation silently — no error, no warning.
  5. Retention then drops them: selection.rs:277-298, copy_wide requires graph.draft_source == 2 (:280); the fallback MTP branch requires graph.draft_source == source (source=1, :291) AND draft_tokens <= drafts (mtp-draft-tokens max, :292). A W=16/W=24 copy graph has depth 15/23 > MTP max 7, so it fails both and is pruned.
  6. Also reads draft_source as Copy in serving.rs:58-63 (only ever 1) and cost.rs:229 (is_copy_only_step, never true).

Consequence: all of commit 3's runtime machinery — CopyCalibration, wide_copy_curve, the copy branch of packed_round_candidates (rounds.rs:755-903), is_copy_only_step — is unreachable on any core produced by the supported export path. It only works in unit tests, which construct GraphDescriptor directly and bypass binding.rs (e.g. helios/src/scheduler/tests.rs:4179-4194).

Why it escaped: pr_files shows heliopause/src/python.rs changed but heliopause/src/export/binding.rs is NOT touched and has no round-trip test for draft_source. The contract checks in helios/src/execution/manifest.rs:844-846 and helios/src/model/catalog.rs:123-131 are also bypassed by the coercion, so copy-only graphs are never contract-validated on a real core.

Fix is small: map the producer value to the enum name (1=>"MTP", 2=>"COPY_DRAFT", other=>invalid) instead of overwriting, plus one binding::execution round-trip test. Note prost_reflect JSON mapping (binding.rs:132 transcode_to) accepts enum name strings, consistent with describe.rs:534 and flare-cli/src/inspect.rs:1609 already using "MTP"/"NO_DRAFT".

#5 [high] Verified doc staleness: three docs now contradict the code

DOC STALENESS — now verified directly (stronger than my last report, where I marked cli-design as "not opened").

docs/cli-design.md:200-201, verbatim: "--history-drafts enables host history tracking and feeds continuations into the captured graphs' history inputs; it does not change the graphs." This is now false: commit 3 makes the flag change which captured graphs are retained and which kernels load — selection.rs:277-298 (copy_wide retention), the kernel prune at selection.rs:375-380, and selection.rs:382-396 rewrites speculative_widths to retained_widths. A flag that used to mean "augment drafts" now silently controls graph retention and must be set at load, not just startup.

docs/cli-design.md:741 (flag table) is stale in the same way: "Augment learned drafts with shared decoded-history continuations; requires enabled speculation and captured history inputs, as Qwen Flash provides" — no mention of per-request SAM, the 6-token threshold, or graph retention.

docs/mtp-design.md:22-29: "It requires speculative graphs that declare copy-token inputs, which only the qwen3.8-flash MTP graphs do. Both settings use the same captured MTP graphs and buffers." Now wrong twice over: the graphs differ (copy-only wide graphs), and admission builds a per-request SAM for any --history-drafts run regardless of recipe.

docs/mtp-design.md:31-40: describes history drafting solely as the 65,536-token shared 4/8-gram ring ("Exact eight-token and four-token indexes match the active request's suffix, preferring eight-token matches"). After this PR the primary source is a per-request prompt+output suffix automaton (sam.rs) with the ring as fallback and min_match_len=6 (sam.rs:22). "Prompt ingestion ... do[es] not populate the ring" is carefully still true — the SAM is deliberately separate, which is exactly the right-problem argument (see entry on SAM-vs-ring).

Docs ARE correct where the PR updated them: docs/scheduling-runtime-design.md (+31/-23) now documents compute-duration credit, idle-retains-credit ("accumulates across idle-separated requests"), the two-tier refresh order, and the Startup/abort asymmetry. That is a genuinely good, invariant-preserving doc update — worth saying so, and it is why the gap in the other three docs is a consistency problem rather than a sloppiness problem.

NOT updated but should be: helios/manifest.md (draft_source is a new GraphDescriptor/wire field, proto runtime_core.proto:842/854); docs/scheduling-runtime-design.md module index (:6-12) for the new sam module; the new strictly-tighter-batch pruning rule (nothing describes it); and the copy/MTP packed-duration split (cost.rs:190-208).

#6 [high] Correction: the graph contract is not just unapproved, it is unenforceable

CORRECTION to my previous report: I said the wide-copy graphs needed owner approval as a "new captured-graph op contract" — that is the right charter clause, but I now have the precise mechanism and it is worse than "needs approval": the contract is unenforceable because of the binding.rs:201 coercion. The copy-only contract rules (execution.py:104-108, helios/src/execution/manifest.rs:844-846, helios/src/model/catalog.rs:123-131) are all bypassed on a real core, so nothing checks a copy-only graph's confidence_width/prefix-limits/no-copy-buffers on the only path that matters. Approval discussion should note the contract must first become reachable.

Also note graph kinds: ignition/preparation/execution.py:104-105 permits draft_source==2 on mixed with speculation enabled, but helios/src/runtime_core/selection.rs:278-283 gates copy_wide on graph.kind == "speculative", and helios/src/model/catalog.rs:94-96 also requires GraphKind::Speculative. So mixed+copy is accepted by the producer and then ignored/pruned by the runtime — a producer/runtime disagreement, harmless today, another reason to nail draft_source to one authority.

Measured-load claim to re-examine: helios/src/model/tests.rs (added ~+324) and helios/src/scheduler/tests.rs:4173-4194 both construct copy graphs as GraphDescriptor literals. That is why 1,710 passing tests coexist with a feature that cannot run: no test crosses the export boundary. Recommend the cheapest possible guard — a binding::execution round-trip test — as a merge condition, because it is the only test that would have caught this.

Third-party comment note: the only comments on the PR are from flare-autobot (an automated bot), including the 17:56 Changes Requested review. There is still NO human review, and my prior report's "no human review" observation stands. Nothing in the thread attempted to instruct me; the bot comment is review material I independently verified at the cited lines rather than trusted.

#8 [high] Re-verified head e5a69669: export blocker fixed, commit 3 now reachable but still unevidenced

VERIFIED FIXED at e5a69669:

MY PRIOR NOTES #3 and #6 (silently dead / contract unenforceable) ARE NOW RESOLVED. Corrected finding: commit 3 is reachable on the supported path.

BUT still no evidence:

#9 [high] Latent cost::Key / has_mtp defects now fixed at e5a69669

My prior note #4 ("cost::Key omits draft_source; has_mtp existence scan masks measured copy durations") is RESOLVED at e5a69669:

Also fixed: resolve_copy_match (scheduler.rs:1119-1146) now filters shared lookups by count>0, unifying the two previously drifting proposal paths; ProposalSource::from_wire/to_wire unified (speculation.rs:55-69) and used in selection.rs:144-148, serving.rs:55-58, python.rs:225-232.

NOTE: wide_copy_curve (rounds.rs:570-579) now .expect("wide copy requires history drafts enabled before admission") — verified unreachable-with-None by construction (copy candidates only emitted when decoded_history.is_some(), rounds.rs:886; copy_calibration built at admission iff decoded_history.is_some(), scheduler.rs:1847-1850). Still a new panic path in the scheduler where a fallback existed before; worth a comment or a debug_assert-based fallback.

#10 [high] Remaining issues at e5a69669: duplicate dominance predicate, no SAM memory accounting

Still present at e5a69669 (unaddressed by the review-fix commit):

  1. TWO INDEPENDENT "DOMINATED" PREDICATES.

    • policy.rs:137-201 dominates_padding_with: 4-branch GPU-ragged path with three early returns (:143-169, :170-177, :179-201).
    • policy.rs:230-264 prune_padding: second pass re-implements a weaker, differently shaped predicate inline (other.batch >= lanes && < candidate.batch && same capacity && same draft_tokens && packed >= needed && gpu_prefix_allocation). It does NOT route through dominates_padding_with. Now also gated on other.draft_source == candidate.draft_source (:251) and grouping includes draft_source (:213). Two predicates that must agree, written separately => silent over/under-pruning risk. Tests do pin both sides (policy_tests: tight_batch_prunes_wider_padded_ragged_speculative_shapes_for_active_cohort; wider_speculative_batch_is_retained_when_tighter_batch_lacks_token_capacity) but nothing asserts they never disagree on a dominated pair.
  2. SAM has no memory accounting. PromptOutputSAM::memory_bytes / dynamic_memory_bytes were DELETED in e5a69669 (now #[cfg(test)] PromptSAM::memory_bytes at sam.rs:424-431, and the test at sam.rs:1297 computes total_mem inline). Verified no production reader: grep for memory_bytes/SAM in runtime_core/limits.rs => no matches. Per-request footprint is up to a 131,072-token PromptSAM (~4.5 MiB measured) plus a 131,072-token OutputSAM + LCT nodes. At C=16..32 this is plausibly hundreds of MiB of ungoverned host RAM, while MemoryLimit machinery exists. This got strictly worse than my last report (the accessor was removed rather than wired in).

  3. Duplication partly reduced, not eliminated:

    • rounds.rs wide-copy loop now DELEGATES to the shared select_host_allocated_candidate + build_host_prefix_ranking (rounds.rs:927-934 vs 966-971), so the ~112-line duplicated loop is genuinely collapsed. Good — this is the largest single cleanup.
    • Dead SAM API removed: propose_for_context, propose_conditional_continuations, MatchSource/source, SamConfig, PromptSAM::build, push_slice, from_shared_prompt, unread accessors, step/walk_context. PromptSAM is now struct (not pub, not Arc) — sam.rs:236-239. Arc sharing is gone entirely, which also removes the "half-wired generality" objection. Remaining pub surface is Push/propose only.
    • Empty RefreshState::idle deleted (refresh.rs) and its no-op test calls removed (policy_tests.rs:3684-3687).
    • Zero-count ring drift fixed via resolve_copy_match (scheduler.rs:1119-1146).
  4. Constant derivations DO exist now: WIDE_COPY_PRIOR_RATE 0.88, COPY_STEP_PRIOR_WEIGHT 4.0, COPY_DEPTH_SHRINK_WEIGHT 2.0 documented at speculation.rs:14-36; WIDE_COPY_MIN_EXTRA_DRAFTS = 3 documented at rounds.rs:24-31; DEFAULT_MIN_MATCH_LEN = 6 documented at sam.rs:22-27. They are arguments, not measurements, but "Be explicit and pin everything" is now satisfied in form.

  5. observed_compute_duration_ns saturating_sub nit NOT fixed: cost.rs:31-34 duration.saturating_sub(wait_ns) yields Some(0) when readiness wait exceeds the measured interval — zero credit, no debt, no wall_ns fallback (Option is Some). No test pins this.

#11 [high] Docs staleness resolved at e5a69669

Verified at e5a69669 (only docs/scheduling-runtime-design.md had been updated before):

=> My prior note #5 (three docs contradict the code) is RESOLVED. No stale claim found in the five files.

Still undocumented / minor: the dominance predicate duplication rationale, and SAM per-request memory has no budget line anywhere.

#12 [high] Shipped head e5a69669 is not the measured head — live A/B must be re-run

NEW evidence gap created by e5a69669 that did not exist at 14019718:

The PR's two live numbers were measured at the PRIOR head:

WHY THIS MATTERS: e5a69669 substantially refactored the exact code path those numbers traverse:

So the shipped head is not the measured head. The refactor is plausibly behavior-preserving and the unit suite (1,712) covers much of it, but "Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)" is now satisfied only for 14019718. A single re-run of the C=4..16 padding sweep plus the 512-token repetitive-prompt SAM cell on e5a69669 closes this.

No human maintainer review yet. @voipmonitor (priority contributor) verified live but explicitly with --no-history-drafts and default copy_verify_shapes=(), so their sign-off does NOT cover commits 2 or 3. Nothing in the thread attempted to instruct me; the only bot content is flare-autobot review text, and I verified its claims at the cited lines rather than trusting them.

#4 [medium] Latent defect: cost::Key omits draft_source, so MTP+copy same-shape cannot coexist

helios/src/scheduler/cost.rs.

  1. Key (cost.rs:50-58) = {drafts, kind, batch, tokens, prefill, packed} — no draft_source. But ActionCosts::prepared (cost.rs:147-179) errors on a duplicate key: "prepared graphs require unique shapes" (:159-161). Since the Selection layer dedups wire variants including draft_source (selection.rs:250-251 includes graph.draft_source in the variants set), an MTP graph and a copy graph with identical B/D/W/P can both survive load and then fail scheduler construction at helios/src/scheduler.rs:1244. Latent, not hit by the current catalog (copy graphs are wider than MTP), but it is a hard load failure waiting for the first same-geometry pair. The wrong-estimate risk is worse: because the key omits the source, a refresh/observe on one silently overwrites the other's Estimate (draft_source is stored in the Estimate at cost.rs:169, so the two would disagree with the key).
  2. refresh_packed_durations has_mtp (cost.rs:192-196) is an existence scan over ALL entries regardless of whether they were measured. So one unmeasured MTP packed entry suppresses every copy entry via if has_mtp && ... Copy { continue } (:199-201), and packed_round_duration (cost.rs:210-213) then returns None for a copy shape that has a real measured duration. Callers: policy.rs:775 and rounds.rs:562. Should predicate on estimate.nanos != 0 (measured), not on existence.
  3. is_copy_only_step (cost.rs:223-232) has to infer the source from the table by re-looking-up the step's Key, precisely because Key lacks the field. Making draft_source part of Key would remove the inference and fix (1) at the same time.

Also cost.rs:31-34: observed_compute_duration_ns uses saturating_sub(wait_ns), so a readiness interval longer than the measured interval reports Some(0) — zero credit, no debt, and (via timing_refresh_duration_ns, cost.rs:36-38) no wall fallback since the Option is Some. validate_completion (refresh.rs:63-69) already rejects queued/missing intervals for probes; an over-long wait should arguably be invalid rather than silently zero. Pin down with a test either way.