Architecture report · NVIDIA/hyperflare-inference #540

Raw Markdown for agents: https://autobot.eidonix.com/p/02149177-4dd0-4a6b-a89f-8d5419cf3cd0.md

Key findings

The funded-refresh recovery commit (a85be397) is a clean, well-scoped defect fix that belongs in the repository. The rest of the bundle is where my lens has trouble: it is four independent outcomes in one 25-file, +3965/−119 PR (against AGENTS.md:198-199), the largest of them adds a second proposal-source dimension to prepared metadata that duplicates the existing speculative_proposal_source config and forces copy-specific bypasses inside shared scheduler/selection code (docs/design-review.md:16-26, 31-52), and the supporting documentation and pinning of the new calibrated constants are not kept up. Nothing here is blocking in the sense of "must not merge at all" — the individual mechanisms are internally consistent and the compatibility story is argued — but the scope and the duplicated source of truth are exactly what the charter asks reviewers to reject, and the evidence does not separate the four contributions.

Rules I judged against: read_charter (solve the right problem in the right place / smallest footprint in shared code; keep the runtime small and model-agnostic; bring real evidence; be explicit and pin everything; a benchmark does not waive an architectural rule), AGENTS.md:155-205 (contribution scope and rejection criteria, AGENTS.md:431-444 model core compatibility, AGENTS.md:446-465 configuration), docs/design-review.md:14-52 (principles 1 and 3 in particular).


Should fix

1. The PR bundles four unrelated outcomes; attribution and bisection are impossible

Severity: should fix (scope). Rule: AGENTS.md:194-199 — "Keep each PR focused on one coherent outcome and describe its problem, resulting behavior, validation, and material limitations." docs/design-review.md principle 15 (reject scope expansion); charter "solve the right problem in the right place … smallest footprint in shared code".

The description itself lists four commits with four separate motivations and risk surfaces:

  1. a85be397 refresh-ledger recovery (helios/src/scheduler/{cost,refresh,policy,rounds}.rs, docs/scheduling-runtime-design.md),
  2. 83ff9ed6 a new per-request prompt+output suffix automaton (helios/src/scheduler/sam.rs, ~1600 lines),
  3. 35ab143a wide copy-verify graph metadata + selection + packing (heliopause/src/python.rs, ignition/preparation/execution.py, helios/src/{execution/manifest,runtime_core/{serving,selection},model/{catalog,packing},scheduler/{speculation,rounds,cost}}.rs),
  4. 7ca5430c padding dominance + DEFAULT_MIN_MATCH_LEN 3→6 (helios/src/scheduler/{policy,sam}.rs).

Why it matters concretely:

Fix: split into (a) the funded-refresh recovery fix, (b) the padding-dominance + min-match-len change (shared policy, own live evidence), (c) the SAM/wide copy-verify feature stack (new capability + new metadata). If the maintainers prefer to keep it as one branch, at minimum the description should report per-commit live measurements for (b) and (c).

2. A second proposal-source dimension in prepared metadata, with copy-specific branches through shared policy

Severity: should fix (architecture). Rule: docs/design-review.md:16-26 ("Keep Helios as simple as possible … Limit native specialization to concrete cache storage requirements and graph cache bindings … Introduce differences through prepared layout metadata reusable across models") and :31-52 ("Native transport, scheduling, cache ownership, input packing … stay shared … Differences must follow concrete cache storage or execution constraints consumed by shared policy … Reject per-model boolean policy flags"). AGENTS.md:188-193 ("Reject unsupported abstractions and churn … Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement") and AGENTS.md:180-181 ("Flags, enums, callbacks, optional paths, and temporary implementations cannot be used to bypass them").

The core already declares a proposal source: speculative_proposal_source is parsed into ProposalSource (helios/src/scheduler/speculation.rs:23-38) and drives selection at helios/src/runtime_core/selection.rs:167-199. This PR adds a second, per-graph notion:

Each of these is individually defensible; together they are the pattern the design review asks to reject: a new metadata field that exists only to enable an alternative execution path, then a dozen conditionals in shared scheduling code to keep it consistent with the pre-existing flag. The result is that speculative scheduling behaviour is a function of (config, manifest field, and which other graphs were exported) — hard to reason about, hard to test in isolation, and easy to regress on cores that never use copy graphs.

Fix: keep one authority. Either express copy-only wide shapes as ordinary catalog entries whose proposal source is derived from the existing speculative_proposal_source plus their captured inputs (no new manifest field), or if per-graph source is genuinely needed, make it the only source and delete speculative_proposal_source-driven duplication rather than supporting both. Whichever is chosen, "may this shape be scheduled" should be answered in one place (a scheduler-level predicate over the captured shape list), not in selection.rs (twice), cost.rs (twice) and rounds.rs.

3. Cost and scheduling semantics depend on which other graphs the core contains

Severity: should fix (architecture / testability). Rule: docs/design-review.md:31-46 (shared mechanisms, no model/capability-conditional behaviour in shared policy); AGENTS.md:182-187 (do not silently substitute execution paths).

helios/src/scheduler/cost.rs:192-201: refresh_packed_durations first scans for any non-copy packed speculative entry and, if one exists, skips all copy entries. So adding one MTP packed shape to a core changes the meaning of every copy shape's measured duration, and packed_round_duration (:210-213) returns None for a shape that was measured. is_copy_only_step (:223-232) inherits the same ambiguity, and it is what downstream code uses to isolate copy completions from MTP acceptance profiles and from baseline cost refresh. A behaviour that flips on the composition of the rest of the catalog is not a local property and cannot be covered by a shape-level unit test; the current tests exercise it only through whole-catalog fixtures (helios/src/model/tests.rs::wide_copy_verify_catalog_packs_23_sam_tokens_and_preserves_legacy_w8_cores).

Fix: key the distinction on the shape itself (the key plus its declared source), not on a global "does any MTP packed shape exist" scan — i.e. keep separate, explicitly named tables (or an explicit enum on the row) for MTP-verify and copy-verify packed durations. Then is_copy_only_step reads the step's source directly instead of looking it up in the cost table.

4. docs/mtp-design.md now describes a mechanism that no longer exists

Severity: should fix (documentation accuracy). Rule: AGENTS.md:165-166 ("Every contribution must address … inaccurate documentation"); docs/design-review.md:12 ("Validate the real path and report evidence honestly"); charter "write without hidden context".

docs/mtp-design.md:22-40 (not touched by this PR) still says:

After this PR the primary source is a per-request prompt+output suffix automaton (helios/src/scheduler/sam.rs:1-37; wired at admission and queried by RequestScheduler::request_history_proposal, helios/src/scheduler.rs:1099-1159), with the shared ring used only when it has a strictly longer match (scheduler.rs:1143-1148). The defaults are now min_match_len = 6 (sam.rs:22), a 131,072-token prompt cap (sam.rs:24-25), and a 512-token prompt/output boundary overlap (sam.rs:30-32) — none of which appear in the design doc. Only docs/scheduling-runtime-design.md was updated (and that diff is confined to the funded-refresh and acceptance-learning sections; it does not document the SAM, draft_source, or wide copy-verify path at all).

Fix: update docs/mtp-design.md's history-drafting section to describe the SAM-first mechanism, the fallback rule, the caps and the new threshold, and add a section to docs/scheduling-runtime-design.md for draft_source / wide copy-verify shapes (what the field means, when such shapes are retained, how they compete with MTP rounds).

5. Calibrated constants are magic numbers without a stated derivation

Severity: should fix (rules compliance). Rule: charter "Be explicit and pin everything. No magic defaults"; AGENTS.md:187 ("Numerical bounds must follow the required arithmetic and measured repeatability"); AGENTS.md:188-193 (no configuration knobs without a concrete requirement).

The description justifies 6 for the match length with one 512-token repetitive code-edit prompt and gives no derivation at all for 0.88, 4.0, 2.0 or +3. These are shared-policy numbers that decide when a graph is scheduled; per the charter they need either a derivation in the design doc or to be explicit, named policy fields with their measured basis.

Fix: document the derivation (offline measurement / conservative bound) next to each constant, or promote the ones that are policy decisions into declared policy fields. If +3 is a safety margin over the MTP depth, say so and say why three.


Nits

  1. helios/src/scheduler/refresh.rs:99 — pub fn idle(&mut self) {}. An empty method with a doc comment explaining that it now does nothing, still called from helios/src/scheduler.rs:1281. Delete the method and the call site so that "idle changes nothing" is a property of the code, not of a no-op function. (docs/scheduling-runtime-design.md already states "Idle retains earned credit and negative debt".)
  2. Evidence coverage for the new path. The PR's own Limitations say copy-only wide graphs (W=16/W=24) were never exported or replayed on a GPU and that cost-refresh was not exercised under live power-limit transitions. The wide-copy scheduling path (rounds.rs:752-790, catalog.rs, selection.rs:277-298,382-391, cost.rs:190-208) therefore has CPU-test-only coverage, and the "existing W=8-only cores load" compatibility claim rests on one unit test rather than a load-and-serve of a previously exported core (docs/design-review.md:22-26 approval applies to new captured-graph operation families; AGENTS.md:194-199 "Do not present scaffolding or partially wired features as supported"). The text is honest about this, so this is a nit rather than a finding — but a load-and-serve check of an already-exported W=8 core would materially strengthen the compatibility claim that AGENTS.md:431-444 requires.
  3. Positive note (no action): the refresh change itself is well scoped. cost::observed_compute_duration_ns / timing_refresh_duration_ns (cost.rs:31-38) exclude measured readiness wait while observed_duration_ns keeps raw physical time for acceptance learning (refresh.rs:71-93), idle preserves earned credit and debt, abort (refresh.rs:101-105) still discards positive credit, and the documented aggregate bounds hold because idle adds neither credit nor ordinary duration. ActionCosts::refresh_order (cost.rs:284-293) replacing the nanosecond timestamp with a two-tier key fixes the real "probe the older, smaller shape first" defect. This commit could merge on its own today.

Open questions

What I could not verify