Architecture scratchpad · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/c4b8a732-bf7a-4b09-8e63-59e6c36ed847.md

#1 [high] PR 582 shape and governing rules

PR #582 "helios: avoid splitting prefill on zero-budget checkpoint anchors", head a3c6483, base 167f22c. 7 files, +931/−16: helios/src/scheduler/checkpoints.rs (+746/−4), checkpoint_lifecycle_tests.rs (+136), scheduler.rs (+11/−3), docs/cli-design.md, docs/core-design.md, docs/scheduling-runtime-design.md, verification/helios-lifecycle/check.py (+19). Review state: CHANGES_REQUESTED by voipmonitor (2 blockers about duplicate RetentionRole::Anchor captures, majors about hardcoded start=0 in is_request_anchor_endpoint, clear_reservations wiping the latch, O(N) pricing at fraction 0, minor doc/test notes).

Rules for this lens:

#2 [high] Should fix: anchor decision re-priced from three different start points (unstable anchor)

helios/src/scheduler/checkpoints.rs (head a3c6483):

#3 [high] Should fix / Blocking: special-cased zero fraction, unpreserved anchor decision, docs and evidence gaps

  1. [Should fix] checkpoint_extra_work_fraction == 0.0 is a hard-coded special case on a continuous knob. helios/src/scheduler/policy.rs:208-209 validates the fraction over [0,1]; checkpoints.rs:467-468 and 395-396 then branch on exact float equality and substitute a completely different anchor rule. The general rule already covers this: allowance(prefill, fraction) (87-89, 528) yields 0 at fraction 0, so no cut can ever be funded; the anchor is the only thing still funded — and it is pushed with split_ns 0/copy 0 at 512-519 without pricing. Better: price the anchor cut through the same allowance path (split_ns = extra splits, copy_ns = snapshot copy) instead of adding a second, magic-valued policy regime. Charter: "No magic defaults"; AGENTS.md:188-193 rejects configuration switches and special cases without concrete requirement.

  2. [Should fix] Latch is dropped by clear_reservations() while the accounting object survives preemption/readmission. checkpoints.rs:48-52 clears anchor_fallback_from; scheduler.rs:1722-1726 calls clear_reservations() on the preserved CheckpointAccounting, and helios/src/server/runtime.rs:2745/2771/2789/2800/2827 deliberately carry the accounting across preemption and inbound-restore retries (admit_planned_with_checkpoint_accounting). docs/core-design.md:1456-1457 states "Preemption preserves the logical request's earned and spent allowance" — the new zero-budget anchor decision is not preserved, so a readmitted request can re-decide its anchor. Fix: make the chosen anchor an explicit field of the request (not a re-derived latch) and preserve it with initial_prefill_ns/baseline_interval.

  3. [Should fix] Zero-budget pricing still walks every boundary and reports skips. checkpoints.rs:529-539 puts all message boundaries plus a distinct prompt end into candidates whenever the anchor is the prompt end; at fraction 0 available is 0, so each candidate charges split_ns + copy_ns > 0 against it and sets budget = true (592-605). Result at 100% of zero-budget serving: O(N) interval_prefill_ns walks per step and a spurious flare_checkpoint_skips_total{reason="work_budget"} increment (stats at 782-783 → helios/src/server/metrics.rs:501). voipmonitor observed exactly this live at fraction == 0.0. Fix: when the allowance is zero, return after pushing the anchor cut.

  4. [Should fix] Documentation asserts a policy the implementation does not yet satisfy. docs/core-design.md:1438-1445, docs/cli-design.md:703-708 and docs/scheduling-runtime-design.md:553-559 now state as specification "an interior message boundary is retained as the anchor only if splitting prefill there adds zero predicted prefill work". Given the two duplicate-Anchor blockers, the documented rule is not what the code does on upward EWMA drift or on a Mixed prefill alignment shift. AGENTS.md:52-60: designed behavior the code does not implement must be marked designed, not implemented. Also AGENTS.md:74-113 and design-review principle 16: the PR description does not mention the three documentation files at all (its "What changed" section omits them), so a reader cannot see the documented policy change.

  5. [Blocking — process/evidence] No scheduling-simulator evaluation and no Helios service measurement. docs/design-review.md:195-204 and 232-240 require changes to graph selection/service pricing and to the Helios scheduler to be evaluated against scripts/scheduling_sim reference solvers and to update the TLA+/conformance fixtures; "never touch covered code without running ... its simulator". The evidence lists only pytest runs of the simulator's own unit tests (tests/test_scheduling_sim.py etc.), not an evaluation sweep of the changed policy. docs/design-review.md principle 12 and charter line "Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)": the PR itself states "Live signed-core serving and isolated GPU latency measurements remain unverified" while the claimed benefit is a prefill-launch reduction; the live 2→1 measurement in the thread was produced by the reviewer, not supplied by the author.

  6. [Nit] verification/helios-lifecycle/check.py:325-343 mutates the production branch by matching a 13-line verbatim string literal of checkpoints.rs. AGENTS.md:194-196 ("source-text checks ... cannot establish runtime correctness") and the brittleness means the guard breaks on any formatting change to the code it guards. Prefer a guard whose behaviour is observable from the lifecycle projection (an Anchor capture count on a multi-chunk zero-budget prompt) rather than a text substitution.

#4 [high] Scope verdict and what the change gets right

Context for the final report's "what is right about the approach" and scope judgement:

#5 [high] Research summary

Reviewed PR #582 (helios: avoid splitting prefill on zero-budget checkpoint anchors, head a3c6483) through the architecture/scope lens: all 7 changed files read in context, callers followed (scheduler.rs admission/promotion, policy.rs planning, server/runtime.rs accounting preservation, metrics), judged against read_charter, AGENTS.md and docs/design-review.md.

Scope verdict: the change belongs in Helios — anchor/snapshot selection is shared scheduling and cache policy, with no model-identity branching — so it does not violate the "no per-model special cases" rule, and the zero-snapshot-capacity guard is correct in principle (previously cuts were selected whose captures could never be armed). The approach, however, is not right: it introduces a second anchor policy regime selected by exact float equality on a continuous knob, re-derives the anchor from three different pricing windows, and latches the result on a field that the preemption path clears.

Findings recorded in the scratchpad (6): the hard-coded checkpoint_extra_work_fraction == 0.0 branch with an unpriced anchor cut (should fix; the existing allowance path already yields zero); the anchor decision being unpreserved across preemption/readmission (should fix, contradicts docs/core-design.md:1456-1457); zero-budget selection still walking every boundary and emitting spurious checkpoint_skips_total{reason="work_budget"} (should fix, matches the reviewer's live observation); three design docs now specifying a rule the code does not satisfy plus the PR description omitting those docs entirely (should fix); no scheduling-simulator evaluation sweep and no Helios service measurement behind the performance claim, which the PR itself marks unverified (blocking per docs/design-review.md principle 12 and the simulator requirement at 195-204/232-240); and the 13-line source-text mutation guard in check.py (nit).

These overlap with, and give the architectural reasons for, the two duplicate-RetentionRole::Anchor blockers and the clear_reservations/hardcoded-start = 0 majors already raised by voipmonitor; I verified the underlying code paths (checkpoints.rs:364-388, 390-420, 459-519, 529-539, 48-52, 753-776; scheduler.rs:1722-1726, 1794). No new defect beyond that set was found, and I am not proposing kernel-level or per-model designs.

#6 [high] Citations for the final report

Verified code citations for each finding, so the report can carry file:line without re-reading: