Correctness and contracts report · NVIDIA/hyperflare-inference #664

Raw Markdown for agents: https://autobot.eidonix.com/p/a3c6dca2-db90-4fdb-bc4f-3d5f9d2ec991.md

Correctness, Contracts & System-Level Consequences — PR #664 (head 263dfe9b)

Reviewed lens: correctness/safety, system-level consequences, contracts/charter, tests & claim accuracy. Every finding below was verified by opening the file at 263dfe9b (and, where a main comparison is made, at main). Where the change is sound I say so plainly in the last section instead of inventing issues.

Key findings

  1. Blocker — a new captured-graph contract ships without recorded owner approval and without any in-repo producer. Encoding.BF16/Method.IDENTITY impose new producer obligations (helios/manifest.md:455-463, helios/proto/core.proto), which the design docs gate on owner approval; ignition/components/engram.py can still only emit two-plane FP8/NVFP4 tables. Verified sound: the Planes refactor itself.
  2. Major (system-level) — pinned staging for the new table class is ~2.8× larger per staged token than the tables it replaces, and the PR changes the delivery grouping so partitioned ranks always get their own staging + 1/N of the row cache. Fully budgeted (helios/src/runtime_core/model.rs:491-493,764-779) but it consumes the very KV headroom the PR exists to protect, and no staging number is reported.
  3. Major — coverage is hand-built wire fixtures only, and no CI check ran on this head. Nothing in the repo produces a BF16/IDENTITY core end to end; Validation is one E2B checkpoint on one GPU with no main baseline, and the headline counter (flare_engram_resident_scale_bytes = 0) is structurally zero for a single-plane table.
  4. Minor — "two-plane FP8/NVFP4 tables keep their … exact … validation rules" is not accurate for partitioned cores. The signer did tighten (GPU request delivery, rank count, full rank-ordered coverage). Impact is bounded and I rescope it below: Helios's loader already enforced all three, so no previously loadable core is newly rejected.
  5. Minor — an explicit --embedding-table-resident-scales on a single-plane-only catalog is a hard startup failure, while a mixed catalog silently ignores the flag for the BF16 tables.

1. BLOCKER — new contract (Encoding.BF16 = 3, Method.IDENTITY = 3) has no owner approval and no in-repo producer

helios/manifest.md:455-463:

Single-plane `BF16` tables store raw `embedding_width * 2`-byte rows without a
scale plane (`scales` absent, `scale_buffer` empty, `scale_block == 0`,
 `global_scale == 0`). Tables with `EngramHash.Method.IDENTITY` use one lookup
head (`heads = 1`), empty `token_map` and hash arrays, `compressed_vocabulary == rows`,
 and GPU request delivery (`request_buffer`): captured code publishes one `int64`
 row ID per token in `[0, stored_rows)` (converting to partition-local indices
 when sharded) or `-1` for inactive slots; out-of-range row IDs fail gathering.

This is a producer-side obligation on captured code — who writes the mailbox, in which index space, with -1 semantics — not merely an appended enum value. So the PR's framing ("no model allowlists, capability flags, or new captured-graph operation families") does not clear the gate in docs/design-review.md:22-26 (not opened),265-266, docs/core-design.md:276-280 (not opened), and the charter's "Captured-graph op contracts: Adding a new one—even if it reuses an existing graph kind—requires owner approval before you write it." Nothing on the PR records such approval: the only review is the @flare-autobot Changes Requested at 20:05 (which audited c769355, 22 minutes older than this head), and no human review or comment exists.

Second half of the blocker: no in-tree producer exists. ignition/components/engram.py:117-126 still allocates torch.zeros((tokens * heads, 256), dtype=torch.uint8 …) / torch.zeros((tokens * heads, 8) …) and buffers() exports only weights/scales/hashes; _lookup views weights as torch.float8_e4m3fn (:58). That is structurally unable to emit 8,960-wide (17,920-byte) BF16 rows or identity row IDs. The other changed Python file, ignition/preparation/rank_group.py, only changes plane counting in descriptor handoff, not representation.

Impact: the wire contract lands with no recorded approval and with no producer in this repository, so the new encoding can never be exercised or regression-tested here; every new test must hand-build wire::EngramTable (see finding 3). Precedent #566 (merged 2026-11-28) shipped with an explicit maintainer approval note, a #535 reference and a companion recipe PR (hyperflare-recipes#70); #664 has none of the three.

Fix: record explicit owner approval for both enum values and the mailbox semantics, and link the producer/recipe PR; otherwise land the Planes refactor alone (it is independently sound and useful).

2. MAJOR (system-level) — pinned staging amplification and per-rank delivery split on the new table class

Staging is sized per table per token (helios/src/engram.rs:203-219, doubled by STAGING_FRAMES = 2 at :348):

    fn staging_payload_bytes(&self, max_tokens: usize) -> Result<usize> {
        self.planes.iter().try_fold(0usize, |total, plane| total.checked_add(plane.row_bytes))
            .and_then(|bytes| bytes.checked_mul(self.heads))
            .and_then(|bytes| bytes.checked_mul(max_tokens))
            .ok_or_else(|| "embedding staging exceeds host range".into())
    }

Arithmetic with the geometry this PR encodes (helios/src/runtime_core/engram.rs:140-153: FP8 rows 256+8 B × 24 heads; BF16 rows embedding_width * 2, 1 head): a pre-existing two-plane table costs ~6,336 B per staged token (264 B/head × 24), while one PLE table costs ~17,920 B per staged token (8,960 B × 2) — ~2.8× per staged token, per table, and two frames are pinned per table (helios/src/engram.rs:686-693). At a 2,048-token prefill chunk that is ~70 MiB pinned per PLE table versus ~25 MiB for the FP8 table it replaces.

Second, related consequence: Table now carries partition: Option<usize> (helios/src/engram.rs:177-188) and delivery grouping is full-value equality (helios/src/engram.rs:195-201):

    /// Two ranks share one delivery group only when every table matches in
    /// planes, bindings, and partition ownership (`Table::partition`).
    pub(crate) fn shares_delivery_with(&self, other: &Self) -> bool {
        self == other
    }

With partition set to the owning rank, partitioned deployments now split into one group per rank by construction, and the row cache is then divided by the group count (helios/src/runtime_core/model.rs:842):

                let group_budget = embedding_table_cache_bytes / engram.len() as u64;

So a partitioned deployment that previously collapsed into a single group now gives each group budget / N, and each group pins its own staging frames.

Impact: this is budgeted amplification, not a leak — staging_bytes is added into embedding_table_cache_bytes accounting and checked (helios/src/runtime_core/model.rs:491-493, :764-779, check_memory_limit at :779) — but it is exactly the host-memory/KV-headroom budget the PR exists to protect, and the PR reports no staging or host-embedding-bytes figure for its Thor run. The Planes iteration is correct; what is unreported is its cost.

Fix: report staging_bytes (and per-group cache budget) for the Thor run, or size single-plane staging by prefill chunk × width rather than max_tokens, and state the duplicated-staging consequence of the new grouping in the description.

3. MAJOR — new paths are covered only by hand-built fixtures; nothing ran on this head

Every new test constructs the wire structure by hand and reads synthetic planes: helios/src/core/schema.rs:1805-1813, helios/src/runtime_core/engram.rs:861-991 and :1035-1099 (partitioned + shares_delivery_with at :1079-1084), helios/src/engram/reader.rs:2535-2599 (synthetic Planes::single, row_bytes 17,920), helios/src/engram/prepared.rs:418-462, heliopause/src/export/core.rs:3822-3900,4424-4462,5306-5336. Because there is no producer (finding 1), no test covers producer → exporter → Helios for either new primitive; only that each layer agrees with a fixture the same PR authored.

The Validation section is one checkpoint on one device (google/gemma-4-E2B-it-qat-w4a16-ct, Jetson AGX Thor SM110) with no main baseline, so it demonstrates a memory budget, not a speedup (docs/design-review.md:106-115 (not opened); charter "Performance PRs need benchmarks showing an actual speedup over main"). E4B is unexercised — it appears only in docs/templates. The reported test counts (helios 1,778 passed / 6 template 401 failures; heliopause 226 / 2 ext4 ctime; flare-cli 239; flare 237 / 1 loopback) are self-reported with no CI artifact.

Metric-scope check: the headline counter flare_engram_resident_scale_bytes = 0 is structurally zero for any single-plane table, so it confirms the skip path executes but cannot show the tables are serving correctly or faster. The author's own listed limitation — no serving replay of a previously exported FP8/NVFP4 core — is exactly the charter's "verify that existing data, artifacts, and exported cores still load".

Fix: attach the existing Windows / pytest / lifecycle jobs to this head (native-serving.yml (not opened), python-cpu.yml (not opened), helios-lifecycle.yml (not opened) all exist and cover the gaps the author lists as local-only), and replay one pre-existing FP8/NVFP4 core without re-export.

4. MINOR — claim "keep their … exact … validation rules" is inaccurate for partitioned two-plane tables (rescoped: no compatibility break)

helios/src/core/schema.rs:464-473 and :474-507 (all new):

            if table.request_buffer.is_empty() {
                return Err(invalid(
                    "partitioned engram table requires GPU request delivery",
                ));
            }
            if table.shards.len() != ranks as usize {
                return Err(invalid(
                    "engram partitions must match the deployment rank count",
                ));
            }

plus rank-ordered full coverage (shard.rank as usize != rank || shard.first_row != end) and end != table.rows → reject. main's signer only required shard.rank < ranks, non-empty, no overlap, and plane presence (helios/src/core/schema.rs:396-417 at main).

Rescope (important for adjudication): this does not break previously loadable artifacts. main's native loader already required all three — see helios/src/runtime_core/engram.rs:70-105 at main, which rejects unless table.request_buffer.is_empty() is false, table.shards.len() == world, shard.rank as usize == rank, shard.first_row == end, and end == table.rows. So the signer now refuses exactly what the loader already refused; the change closes a sign-what-you-cannot-load hole rather than rejecting existing cores.

Impact: the remaining issue is claim accuracy — the description asserts unchanged validation rules when the signer did tighten, which matters for reviewers assessing compatibility. Fix: state which rules changed and that Helios's loader already enforced them.

5. MINOR — explicit --embedding-table-resident-scales on a single-plane-only catalog is a hard startup failure; mixed catalogs silently no-op

helios/src/runtime_core/selection.rs:56-68, applied at helios/src/runtime_core/model.rs:477-481:

            if !has_scale_planes {
                return Err(invalid(
                    "resident embedding scales require an embedding table with a scale plane",
                ));
            }

Not a regression for main cores (any catalog with tables had scale planes), and it fails early, pre-GPU, which is the right place; it is documented (docs/cli-design.md:791-799). But any launcher passing the flag unconditionally now refuses to start on a BF16-only core, while a mixed catalog starts successfully with the flag doing nothing for the single-plane tables — two different outcomes for the same user intent, neither warned about. Fix: confirm fail-fast is intended with the operator-facing consumers (flare-cli just forwards the flag), or warn once when the flag is set and some tables have no scale plane.


Areas checked and found sound (no finding)

Open questions / not found

Provenance: the on-PR @flare-autobot review and its "Dropped on verification" section are accurate for the commit it audited (c769355); 6 of its 8 granular code asks no longer apply at 263dfe9b and should not be re-litigated.