#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:
- 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. - 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 = Somein 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). - 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. - 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. - Retention then drops them: selection.rs:277-298,
copy_widerequiresgraph.draft_source == 2(:280); the fallback MTP branch requiresgraph.draft_source == source(source=1, :291) ANDdraft_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. - 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:
- heliopause/src/export/binding.rs:201-216 now derives instead of overwriting: None => "MTP"; as_u64 0|1 => MTP, 2 => COPY_DRAFT; as_str "MTP"/"COPY_DRAFT"; else Err("unsupported graph draft_source"). Rejects "COPY_DRAFT" on kind != "speculative" (binding.rs:213-215).
- Round-trip test added: export::binding::tests::execution_preserves_mtp_and_copy_draft_source_and_rejects_unknown (binding.rs:1461-1511) asserts wire DraftSource::CopyDraft survives encode/decode, and rejects 3, -1, "UNKNOWN", and mixed+copy.
- Contract now enforced on the real path: helios/src/execution/manifest.rs:845-846 rejects Copy with confidence_width != 0; :849-850 rejects draft_source on non-speculative/non-mixed; model/catalog.rs:94-96,123-131 enforces copy-only graph has no GPU confidence and no SpeculativePrefixLimit.
- Producer validation tightened: ignition/preparation/execution.py:104-105 now
if self.kind != "speculative": raise(previously permitted mixed+speculation_enabled) — matches runtime selection.rs:278-283. Test: tests/preparation/test_execution.py:374-393.
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:
- No in-repo producer emits draft_source=2. Only producer touchpoint is ignition/preparation/execution.py:32 (default 1) and :316-319. The recipe-side copy_verify_shapes lives in out-of-repo local-inference-lab/hyperflare-recipes#48/#49.
- PR Limitations, verbatim: "Per-commit isolated live GPU A/B benchmarks on e5a69669, live GPU export/replay of wide copy-verify (W=16/W=24) graphs, live power-limit cost-refresh transitions ... were not run on hardware."
- @voipmonitor (priority contributor) 2026-11-26 23:53: live TP4 run was --no-history-drafts with default copy_verify_shapes=(); "opt-in wide copy-verify W=16/24 live GPU serving was not enabled in this run and remains separately to be qualified." => commit 3 satisfies correctness now but not charter #210 (measured speedup on a served workload), and adds a new captured-graph contract requiring owner approval.
#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:
- cost.rs:50-59 canonical_draft_source(kind, source) — Some(unwrap_or(Mtp)) for Speculative, None otherwise.
- cost.rs:63-79 Key gains
draft_source: Option<ProposalSource>; Key::from_step uses canonical_draft_source. Estimate.draft_source removed (cost.rs:97). - cost.rs:204-221 refresh_packed_durations now fills
[[Vec<Option<u64>>; 7]; 2](indexed by ProposalSource as usize); has_mtp existence scan deleted. - cost.rs:237-252 packed_round_duration combines: positive MTP first, then positive COPY, Some(0) only when no positive measurement exists.
- Duplicate-shape risk gone on both sides: selection.rs:302-312 dedups wire variants including draft_source; catalog.rs:240-303 adds select_shape_with_source; packing.rs:40-52 matches_step checks draft_source.
- Test: cost.rs:533-585 unmeasured_mtp_and_measured_copy_coexist_at_identical_shape_and_preserve_packed_duration builds MTP+copy at identical B/D/W/P and asserts both exist and pack durations stay separate.
- is_copy_only_step moved off the cost table (scheduler.rs:1196-1199 now reads step.draft_source), removing the need to infer source from the table.
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):
-
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.
-
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).
-
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.Arcsharing 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).
-
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.
-
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):
- docs/cli-design.md:200-210 now correctly says --history-drafts retains copy-only speculative graphs, keeps their widths in speculative_widths, and that pruning otherwise drops kernels and rewrites speculative_widths. The old false "it does not change the graphs" is GONE.
- docs/cli-design.md:747 flag table now includes per-request prompt-and-output suffix-automaton + shared decoded history + wide copy-only retention.
- docs/mtp-design.md:22-66 rewritten: two indexes (PromptOutputSAM with 131,072 caps, 512-token boundary overlap, min_match_len 6, recency tie-break, OOV truncation; shared ring 65,536 with 8/4-gram), SAM-first with ring fallback on strictly longer match, capacity bound min(completion_token_capacity-1, 63), and preempt->readmit re-indexing.
- docs/mtp-design.md:29-33 documents copy-only graph retention/pruning.
- docs/scheduling-runtime-design.md:6-15 module index now lists sam.rs, decoded_history.rs, checkpoints.rs, speculation.rs with copy-survival; :71-91 new "Proposal sources and calibrated wide copy-verify" section (draft_source, copy-only contract, retention rules, CopyCalibration constants); :271-285 stricter-batch pruning rule; :409-433 cost entry identity includes proposal source plus per-source packed duration tables.
- docs/scheduling-theory.md:577-582 and :714-737 now distinguish the simulator (idle discards credit) from Helios (retains bounded credit across idle, excludes readiness wait from timing-refresh credit, two-tier refresh order).
- helios/manifest.md:38 documents draft_source on the Python manifest dict.
=> 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:
- "Combined-stack live serving (flare run, 4x RTX PRO 6000 Blackwell, ... prior head
14019718)" — PR description, Result section. - padding dominance max_b == C at C=4,6,8,12,16 and 9.19 vs 9.55 ms/rd at C=4 (+5.1%), -7.9% at C=6, -5.2% at C=8 — all at 14019718.
- SAM +12.9% tok/s (408.0 -> 460.8), 3.078 -> 3.650 tokens/round — at 14019718.
- Author admits: "per-commit live GPU A/B on e5a69669 remains unrun on hardware and is disclosed in the PR limits."
WHY THIS MATTERS: e5a69669 substantially refactored the exact code path those numbers traverse:
- rounds.rs:937-972 now hoists
gpu_alloc = self.gpu_prefix_allocation(...)before the fixed-width branch and routes the non-GPU host-allocated MTP path through the NEW sharedselect_host_allocated_candidate(rounds.rs:764-862), replacing the inlinehost_ranking/lane_termsblock that previously lived at ~:991-1060. - The C=4..16 padding-dominance measurement is precisely a host-allocated multi-lane cohort selection. The refactor changed how
expectedandhost_lengthsare produced on that path (best tracked as (mask, value, value_zero) and expected recomputed after the loop). - policy.rs add_candidate/mixed_candidates also changed (zero_duration reuse, policy.rs:1022-1117, 1226-1302).
- cost.rs key/packed-duration lookup changed (packed_round_duration now consults two tables, cost.rs:237-252), which feeds
speculative_duration(rounds.rs:585-594) andpolicy.rs:785.
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.
Key(cost.rs:50-58) = {drafts, kind, batch, tokens, prefill, packed} — no draft_source. ButActionCosts::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 thevariantsset), 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_sourceis stored in the Estimate at cost.rs:169, so the two would disagree with the key).refresh_packed_durationshas_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 viaif has_mtp && ... Copy { continue }(:199-201), andpacked_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 onestimate.nanos != 0(measured), not on existence.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.