Architecture report · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/2495b96e-a154-4dce-9281-ccffbef3cfd1.md

Review: PR #582 — helios: avoid splitting prefill on zero-budget checkpoint anchors (architecture & scope lens)

Key findings

Scope is right, the approach is not. Anchor/snapshot selection is shared Helios scheduling and cache policy (AGENTS.md:408-431, docs/design-review.md:47-55), and nothing in the diff branches on model identity, so this does not violate the "no per-model special cases or flags" rule (read_charter, "Keep the runtime small and model-agnostic"). The zero-snapshot-capacity guard is correct in principle: with limits.snapshots == 0 no snapshot row can ever be reserved, so the old code selected cuts whose captures could never be armed.

What I cannot accept through this lens:

  1. Blocking — no evidence at the required layer. A change to graph selection and service pricing must be evaluated against scripts/scheduling_sim/ reference solvers, and no scheduler change may land without running the simulator and formal checks (docs/design-review.md:195-206 and the blocking rule at 232-240). Performance claims additionally require "actual Helios service measurements" (docs/design-review.md:106-115). The PR supplies neither: its evidence is CPU unit/lifecycle tests plus pytest runs of the simulator's own unit tests (tests/test_scheduling_sim.py (not opened) in the PR's run list), and it states outright that "live signed-core serving and isolated GPU latency measurements remain unverified" while the claimed benefit is a prefill-launch reduction. The one live 2→1 prefill_steps measurement in the thread came from the reviewer, not the author.
  2. Blocking — three design docs now specify a rule the code does not satisfy, and the PR description does not mention those docs at all. docs/core-design.md:1436-1445 now reads as specification that an interior boundary is the anchor "only if splitting prefill there adds zero predicted prefill work"; docs/cli-design.md:703-708 and docs/scheduling-runtime-design.md:553-559 say the same. Given the two duplicate-RetentionRole::Anchor blockers already raised in review, that documented policy is false on upward EWMA drift and on a Mixed prefill alignment shift. AGENTS.md:52-60 requires designed-vs-implemented behaviour to be distinguished, and AGENTS.md:74-113 plus design-review principle 16 require the description to cover the change.
  3. Should fix — the anchor is not a stable function of the request. The same policy question is priced from three different start points (details below), so a request can flip between "interior anchor" and "prompt-end anchor" across chunks with no change in costs — the architectural root cause of both blockers.
  4. Should fix — a second anchor regime selected by exact float equality, with an anchor cut that is pushed unpriced.
  5. Should fix — the latched decision is destroyed by clear_reservations() on a path that is documented to preserve the request's accounting.
  6. Should fix — zero-budget selection still walks every boundary and emits a spurious work_budget skip, which is a 100%-of-configurations cost and matches the reviewer's live observation.

Everything below is verified against head a3c6483.


Findings

Blocking: evidence does not meet the documented bar for a scheduler/pricing change

Blocking: documentation specifies a policy the implementation does not satisfy; docs absent from the description

Should fix: the anchor decision is re-priced from three different windows, so it is not a stable function of the request

checkpoints.rs:364-388 defines anchor_split_is_zero_cost(request, catalog, terminal_window, start, end, anchor, known_whole) — "does cutting at anchor add predicted prefill work?" — and its answer depends entirely on the start/known_whole the caller picks. Three call sites pick three different windows for the same request:

  1. checkpoints.rs:474-482: (start = consumed_tokens, end = prompt_tokens, known_whole = initial_prefill_ns only when start == baseline_start) — moves with every chunk.
  2. checkpoints.rs:491-501: after prefill passes the interior boundary, (baseline_start, prompt_tokens, initial_prefill_ns) — fixed at admission.
  3. is_request_anchor_endpoint, checkpoints.rs:411-419: (0, prompt_tokens, None) — hardcoded 0, ignoring baseline_start/consumed_tokens.

Because (1) moves while (2) does not, the same prompt with unchanged costs can decide "interior anchor" on one chunk and "prompt-end anchor" on the next; the result is latched at 483/486/503 and then consumed as sticky truth. That is the mechanism behind both duplicate-Anchor blockers in review (EWMA drift, prompt=1024/boundary 512; and Mixed alignment shift with prefill_catalog=[128,512], mixed=[(2,1,256)], raw_anchor=768).

Two further signs the predicate was assembled from special cases rather than designed: baseline_end is always request.prompt_tokens (CheckpointAccounting::for_epoch, checkpoints.rs:35-41 sets (consumed, prompt)), so the guard (baseline_end == request.prompt_tokens).then_some(...) at 498-500 is always true, and (start, prompt_tokens) == (baseline_start, baseline_end) at 471 is true only before any prefill progress.

Why it matters (scope/architecture): docs/design-review.md principle 1 ("Keep Helios as simple as possible") and AGENTS.md:188-193 ("Do not add … fallback layers … without a concrete requirement"). Three pricings of one question is exactly the "fallback layer" pattern. It also makes the policy untestable as a function: any regression test must reproduce a specific chunk history to pin an answer.

Fix: price the anchor once over the fixed admission interval (baseline_start, prompt_tokens), decide the endpoint, and store it as an explicit request field. checkpoint_selection_uncached, plan_checkpoints, is_request_anchor_endpoint and promote_request_anchor should all read that one decision instead of each re-deriving it.

Should fix: a second anchor policy regime selected by exact float equality, with an unpriced anchor cut

Should fix: the latched anchor decision is not preserved across preemption/readmission, contrary to the documented accounting contract

Should fix: at zero budget the selector still prices every boundary and reports a skip that did not happen

Nit: promote_request_anchor widens its own policy surface

checkpoints.rs:753-776 now falls back to a prompt-end key when the raw anchor key is not cached, gated on is_request_anchor_endpoint(prompt_tokens) — the third, start = 0 pricing of the finding above. This is what allows an Endpoint checkpoint at prompt end to be upgraded to Anchor (a genuinely new policy surface, and a second way to end up with two anchors). Simplest correct form: promote only the endpoint the selection actually chose.

Nit: brittle mutation guard

verification/helios-lifecycle/check.py:325-343 guards the multi-chunk fallback by substituting a 13-line verbatim source string with } else if false {. AGENTS.md:194-196 explicitly says source-text checks cannot establish runtime correctness, and any reformat of the guarded block silently disables the guard. Prefer an observable assertion on the lifecycle projection (one Anchor capture for a multi-chunk zero-budget prompt) rather than a text substitution.

Nit: zero-capacity pricing in allocate_terminal_capture

checkpoints.rs:917-963 still prices a snapshot copy when limits.snapshots == 0, learning there is no row only at quote time (949-961), which only costs a checkpoint_skip_storage counter — behaviourally harmless, but it is the same "check capacity where it is already known" inconsistency the PR fixes elsewhere.


Why the added tests do not catch these

The new tests (checkpoints.rs zero-capacity / zero-fraction fallback incl. Mixed and aligned anchors / 16-request batching, plus checkpoint_lifecycle_tests.rs) drive linear_costs (checkpoints.rs:1009-1019, capacity * 1_000 ns) and commit dur_ns = 1_000 through complete_test_step, so the EWMA sits far below the 512 000 ns measured cost and saturating_sub clamps to 0. That is why the duplicate-Anchor cases pass the suite. Any regression test for the fixed anchor rule needs measured costs above the chunk interval and an explicit assertion on the number of Anchor-role captures.

What the change gets right

Open questions / what I could not settle

Verdict

Scope: belongs in Helios. Approach: not yet — one stable, priced anchor decision per request would replace three pricings of one question, a magic == 0.0 regime, an unpriced anchor cut, an unpreserved latch, and would make the new documentation true.