PR #732: helios,heliopause,ignition: add FP8_E4M3_GLOBAL single-plane engram table support

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/9a04ffaf-70a7-45ca-8c6c-1670f1c57d8e

Opened by a workflow run, Dec 4, 2026 2:38 PM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: yatesdr (COLLABORATOR; 84 merged PRs in 180 days, mostly helios/src, selene, docs); Discord D-Rock Motivation: Some checkpoints (Qwen4-35B-A3B) store their huge offloaded PLE embedding tables as plain FP8 E4M3 bytes with a single shared scale, a shape the core format could not describe, so they could not be exported or served natively. This adds that one encoding by extending the single-plane mechanism a predecessor PR merged hours earlier. Scale: +565 / −145 lines in 10 files Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #732 (FP8_E4M3_GLOBAL single-plane engram tables)

Verdict: Worth it with changes

Charter alignment — right layer, gate not yet passed. The change is a signed-format addition: one enum tag appended (FP8_E4M3_GLOBAL = 4), one match arm in helios/src/runtime_core/engram.rs, one validation branch in schema.rs. It reuses #664's Planes{weights, scales: Option} seam and adds no FP8-specific export code and no per-model runtime branch, consistent with "keep the runtime small and model-agnostic." But it is a format contribution: the charter requires listing checkpoints from an official or widely used source and more than one — two are listed, yet both are first-party (local-inference-lab, eidonix), so they are not independent evidence. And no owner approval is recorded, while docs/design-review.md:22-26 requires prior explicit approval for a new contract "even if it reuses a graph kind or enum value." Precedent cuts both ways: #664 merged without it; unanswered #535 shows the gate is otherwise live.

Novelty — genuinely additive. Not obsolete: #664 shipped BF16 = 3 and the single-plane seam, not FP8. Not superseded: no competing FP8 single-plane engram PR exists, and it reverses nothing. It stacks on #664/#716, sits above #711, and carries only textual conflict risk with #723 (6 shared files) and #334/#554 in engram.rs.

Value vs maintenance cost. The real logic is small — ~75 lines in heliopause/src/export/core.rs plus +207/−12 across schema.rs/engram.rs; the +112/−112 runtime_core_pb2.py churn is generated, and no dependencies are added. Beneficiaries are narrow: only Qwen4-35B-A3B–family FP8 E4M3 PLE checkpoints, and on SM120 access is blocked by open #731 (the author's hardware run was SM121). Evidence is unit-level and consistent with the tree, but the claimed DGX Spark end-to-end run and NVFP4 backward-compat replay have no commands, logs or artifacts — thinner than #664's or #716's. The TP>1 CPU-only limitation is honestly disclosed.

Required before merge: (1) fix the description's enum numbers — actual tags are FP8_E4M3_E8M0=1, NVFP4_E4M3_GLOBAL=2, BF16=3, FP8_E4M3_GLOBAL=4; (2) disclose and directly test the undeclared BF16 row-size tightening, a behaviour change to an already-merged encoding; (3) obtain lukealonso's explicit sign-off on the format contract; (4) attach commands/logs for the hardware run and NVFP4 replay; (5) establish authority for the external b12x fp8_e4m3_per_tensor mode name, which appears only in the two files this PR touches; (6) update stale docs/core-design.md:607; (7) rebase over #723.

Small, additive, backward-compatible at the wire level, and cheap to keep — worth it once the format gate and evidence gaps close.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Classify intake

Selected: triage:review, enhancement, area:engram

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review, +enhancement, +area:engram

Subtraction and simplicity

Subtraction & Simplicity Audit — PR #732 (FP8_E4M3_GLOBAL single-plane engram)

Bottom line

The format/production code is genuinely lean — I am not asking for deletions there. The PR adds one enum tag, one validation branch, one decode arm, and zero lines of FP8-specific export code (it rides #664's schema::engram_scales seam). That is the right shape.

Three of the four changed areas still carry copy-paste that the new encoding made visible. The net recoverable size is small (~60–80 lines out of +565/−145), but two of the duplications are the exact kind that produce divergent validation messages, so they are worth fixing now rather than in a follow-up.

One honesty note on method: pr_diff on this PR diffs against a stale pre-#664 base (it renders #664's and #711's merged work as if #732 added it), and search_history errors out on a missing object (c513e46a). I therefore read the real delta from ref: pr/732 and attributed BF16 branches to #664 (merged) rather than to this PR.


1. Collapse the two single-plane decode arms — helios/src/runtime_core/engram.rs:150-167

The two arms differ in exactly three respects: a *2, a different overflow message, and which half of the global_scale contract is enforced.

wire::engram_table::Encoding::Bf16
    if table.embedding_width > 0 && table.global_scale.to_bits() == 0 =>
{
    let row_bytes = usize::try_from(table.embedding_width)
        .ok()
        .and_then(|width| width.checked_mul(2))
        .ok_or_else(|| invalid("BF16 embedding row width overflow"))?;
    (table.embedding_width, 0, row_bytes, None)
}
wire::engram_table::Encoding::Fp8E4m3Global
    if table.embedding_width > 0
        && table.global_scale.is_finite()
        && table.global_scale > 0.0 =>
{
    let row_bytes = usize::try_from(table.embedding_width)
        .map_err(|_| invalid("FP8 global embedding row width overflow"))?;
    (table.embedding_width, 0, row_bytes, None)
}

Both produce (width, 0, row_bytes, None). Collapsing to Fp8E4m3Global | Bf16 with bytes_per_element = 1 | 2 is ~9 lines instead of 18, and the guard becomes data (Ok(bytes) | Err(_)) instead of a duplicated if. Note also that both overflow guards are unreachable on any 64-bit target (u32::MAX * 2 < 2^33), so the two distinct messages "BF16 embedding row width overflow" / "FP8 global embedding row width overflow" are two unreachable strings defending the same non-event — a single usize::try_from(width).ok().and_then(...) covers both 32- and 64-bit.

2. The Python three-way quant_mode dispatch is duplicated verbatim — ignition/components/ngram_delivery.py:106-114 vs 137-144

This PR adds the second copy of the fp8_e4m3_per_tensor branch. The two copies must stay in lockstep or the pre-declared plan (line 145) will disagree with what run_lookup is actually called with at execution time:

# _lookup (106-114)                      # PreparedPLELookup.__init__ (137-144)
if mode == "bf16":                       if mode == "bf16":
    ... .view(torch.bfloat16), None, None    lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.bfloat16), None, None
elif mode == "fp8_e4m3_per_tensor":      elif mode == "fp8_e4m3_per_tensor":
    ... .view(torch.float8_e4m3fn), scale, None   ... .view(torch.float8_e4m3fn), table.scale, None
else:                                     else:
    ... scales.view(...), scale              lookup_scale = self.scales.view(torch.float8_e4m3fn) ...

Extract one module-level helper — _lookup_views(mode, weights, scales, scale) -> (weight, weight_scale, weight_scale_2) — and call it from both. That is ~8 lines removed, one fewer invalid state, and the two call sites become impossible to drift.

Related, adjacent to this PR's growth: the file now reads quant_mode from two different objects — caps.quant_mode (line 136) in __init__ and state.query.quant_mode (line 105) in _lookup. If those caps came from the same plan they could not disagree; worth a one-line confirmation from the author in review rather than a code change I can justify from the diff alone.

3. The new test is three assertions where one would do — tests/components/test_ngram_delivery.py:29-35, 80, 86, 104-131

135 lines for one behavioural claim. Concretely droppable:

4. The new Rust tests clone their siblings instead of extending them — helios/src/core/schema.rs:2068-2167, helios/src/runtime_core/engram.rs:1162-1235

validates_single_plane_fp8_global_engram_table (2068) is the BF16 test that ends at 2065 with encoding/global_scale swapped. Verbatim duplication:

Same pattern in engram.rs: fp8_global_single_plane_tables_decode_shared_and_partitioned (1162) rebuilds a make(|global_scale, width, partitioned|) closure whose body is a near-copy of the existing make(|width, row_bytes, scale_bytes|) at 1113-1146, including the three buffer-geometry lines at 1212-1214 vs 1135-1137. Including the encoding in the existing make and adding a global_scale argument would merge both tests at roughly net-negative line count.

5. engram_scales already collapses the pair; validate_engram should match it — helios/src/core/schema.rs:504-512, 561-571

This PR puts the new encoding in the good group at 443-457 (engram_encoding_has_scales), which lets engram_scales (460-471) express plane present ⟺ encoding needs it in one expression. But validate_engram still hand-inlines the same predicate twice, and the two adjacent branches now need the same message:

} else if !table.scale_buffer.is_empty() || table.scale_block != 0 {
    return Err(invalid("single-plane engram table cannot carry scale metadata"));
} else if table.encoding == wire::engram_table::Encoding::Bf16 as i32 {
    if table.global_scale.to_bits() != 0 {
        return Err(invalid("single-plane engram table cannot carry scale metadata"));
    }

Folding the BF16 global_scale.to_bits() != 0 test into the preceding || collapses two branches and one duplicate string into one condition. Separately, single_plane_row_bytes (561-571) is a 4-branch if/else if/else over a minted Option<u64> whose Some-side overflow guard (566) is unreachable as noted in §1; the guard reduces to u64::from(table.embedding_width) * u64::from(stride) once the arm is chosen.

6. One predicate, two copies — schema.rs:504-505 vs engram.rs:204-206

The same rule is stated twice with different words for the same user-visible failure:

engram_encoding_has_scales/engram_scales already live in schema.rs and are already imported by engram.rs:35,45,59, so a schema::single_plane_bindings(table, &scales) -> Result<()> next to them would be a drop-in for both. Note the decoder copy (204) is dead for any core that passed validate_engram — it is defence in depth, which is fine, but it does not need its own wording.

7. What is already lean — do not touch

One maintainability note rather than a deduction: the new encoding's contract is now stated in prose in three places — core.proto:267-268, runtime_core.proto:663-664, and helios/manifest.md:526-528 (not opened). That triplication is pre-existing, but it is exactly what let the PR body's tag numbers drift to FP8_E4M3_GLOBAL = 3 … BF16 = 2 when the code has = 4 … = 3. Single-sourcing the comment (cite manifest.md (not opened) from the protos) would have caught it.


# Where Ask Est. saving
1 ngram_delivery.py:106-114 + 137-144 One _lookup_views(mode, …) helper ~8 lines, removes a drift class
2 engram.rs:150-167 Merge the two single-plane arms ~9 lines
3 schema.rs:504-512 Fold BF16 global_scale guard into the `
4 test_ngram_delivery.py Drop has_scales/scale_dtype columns and the 120-131 re-assert ~15–20 lines
5 schema.rs:2068 / engram.rs:1162 Extend the BF16 tests' existing fixtures rather than cloning them ~40–50 lines
6 schema.rs:505 vs engram.rs:205 One shared predicate + one message consistency

None of these is a correctness bug, and #732 should not be blocked on them — but #1 and #2 are cheap enough that they belong in this PR while the seam is fresh, and #6 prevents the decoder and the validator from describing the same rejection differently to operators.

Overall: the diff is lean where it counts (format, export, docs) and repetitive where it does not (tests, the mode dispatch, the second single-plane arm). Ship-able; polishable in an hour.

Full report · Notes

Gates and contracts

Audit report — PR #732 (contract, vendored-dependency, and mandatory-verification gates)

Scope: governance only (no algorithm/kernel review). I read the changed code at ref: pr/732 (not the stale pr_diff base), docs/design-review.md, AGENTS.md, docs/verification.md, docs/core-format-design.md, docs/runtime-core-design.md, helios/manifest.md, docs/core-design.md, both protos, pyproject.toml, and the diff's tests.

Verdict: Two gate items must be resolved before merge — one mandatory-verification (Layer 1) gap and one material claim/compatibility contradiction (an undeclared BF16 validation tightening presented as "preserved behavioral compatibility", plus wrong enum numbers for a signed format). No vendored-file violation. No unapproved-captured-graph-family violation is established, but an owner adjudication question is open.


Gate 1 — Signed core-format / wire / captured-graph / public contract boundaries

What the PR actually changes (verified):

Owner-approval question (open, not a proven violation). docs/design-review.md:22-26 and AGENTS.md:377-382 require prior explicit owner approval for "a new operation contract … even if it reuses a graph kind or enum value." This PR adds an EngramTable.Encoding value on a signed format. It adds no new operation contract — the gather/mailbox/lookup operation family and its captured ops are unchanged; only = how the element bytes are interpreted differs — so on the plain reading of the rule this is a shape/format variant rather than a new operation family, and merged precedent (#664 added BF16 = 3 through the same seam) is the same. I do not score this as a blocker, but it is the one item a reviewer should not silently assume: no owner sign-off by lukealonso is recorded anywhere on #732, and docs/design-review.md:22-26 explicitly says a design acknowledgment does not grant that approval. Recommend an explicit yes/no from the owner rather than inferring consent from #664.

Gate 2 — Vendored upstream dependencies and cross-PR dependencies

Gate 3 — Mandatory verification evidence (docs/design-review.md testing hierarchy)

What is claimed and plausible in the tree: helios::core::schema::tests (18) including validates_single_plane_fp8_global_engram_table (schema.rs:2068-2167), runtime_core::engram (10) including fp8_global_single_plane_tables_decode_shared_and_partitioned (engram.rs:1162-1235), heliopause --lib payload_export_tests (33) including the 6-table NVFP4/BF16/FP8 shared+partitioned export and hardlink fixture (core.rs:4525-4689), flare --lib (247 passed / 4 ignored — the full suite for that crate), and pytest tests/components/test_ngram_delivery.py (3, parametrized over all three modes at tests/components/test_ngram_delivery.py:29-36). Layer-3 obligations for a core-format change (live export/serve + legacy-core replay, principle 12/13, docs/verification.md:32) are claimed: single-GPU SM121 ignition export + native flare run for FP8 (disk and RAM backing) and an NVFP4_E4M3_GLOBAL core. No failing CI or failing test is reported anywhere on 078b043, so nothing is flagged on that axis.

Blocker — Layer 1 not run as required for the affected crates. The Layer-1 command is cargo test --locked --release on every affected crate, matching .github/workflows/native-serving.yml (docs/design-review.md:180-194; AGENTS.md:309-321). #732 ran only name-filtered, non-release subsets for the two crates it changes:

docs/design-review.md:247-251 is explicit that "Disclosure does not excuse skipping runnable CPU checks… Leaving an applicable crate test… unrun blocks commit and PR acceptance." Unlike the externally supplied template fixtures, an unfiltered cargo test --manifest-path helios/Cargo.toml --features runtime-core,server --release and the same for heliopause are runnable on CPU without a GPU or checkpoint. flare was run whole, which shows the intended pattern. Required: post the unfiltered release-mode results for helios and heliopause (and the affected Python component suite, which was run).

Additionally, the new Python test replaces the real upstream plan with stubs (tests/components/test_ngram_delivery.py:62-67 monkeypatches ple_embedding.invocation_from_tensors and ple_embedding.plan, and require_prepared at line 60). It does establish the changed view/scale selection, but it cannot establish that the pinned b12x accepts weight_scale_2=None with an FP8 weight and the "fp8_e4m3_per_tensor" mode (AGENTS.md:194-199).

Gate 4 — Material scope / claim contradictions

Major — the description claims preserved BF16 behavior while the diff tightens BF16 validation, and it misstates the wire numbers. Both are material for a signed-format PR:

  1. Undisclosed BF16 behavior change. helios/src/core/schema.rs:561-571 now pins row bytes for both Bf16 (embedding_width * 2) and Fp8E4m3Global (embedding_width), enforced for shared planes at 578-586 and per shard at 622-630. main has no such check (main:helios/src/core/schema.rs:316-421 validates presence/roles only). So a BF16 core whose plane size was not rows * width * 2 — accepted after #664 — is now rejected at load/export. The body asserts "Preserved full wire and behavioral compatibility for existing NVFP4_E4M3_GLOBAL … and BF16 cores," which the diff contradicts. Correctly exported BF16 cores are unaffected (export derives the size identically), and the exposure is narrow, but AGENTS.md:88-94 requires material compatibility changes to be named with before/after, and no test asserts the tightened BF16 rejection (the new byte-size assertions are FP8-only: schema.rs:2140-2142, 2164-2166).
  2. Wrong enum numbers in the description. The body says FP8_E4M3_GLOBAL = 3 "alongside NVFP4_E4M3_GLOBAL = 1 and BF16 = 2"; the code is E8M0 = 1, NVFP4 = 2, BF16 = 3, FP8_E4M3_GLOBAL = 4 (core.proto:269, runtime_core.proto:665). For a PR whose entire subject is a signed wire tag, tag numbers a reader could copy into a producer or into a review of core compatibility are not a phrasing nuance; the text also implies a standalone feature while the diff is a stacked follow-on to #664 (which took tag 3).

Nothing else is bundled: file scope matches the description (10 files), the +112/−112 runtime_core_pb2.py is generated, and no unrelated tooling is included.


Not flagged (deliberately)

Required before merge: (1) unfiltered cargo test --locked --release results for helios --features runtime-core,server and heliopause (docs/design-review.md:247-251 is non-waivable); (2) correct the enum numbers and disclose the BF16 row-size tightening with a direct BF16 rejection test; (3) an explicit owner decision on the format-contract question, plus a one-line statement of which pinned b12x revision provides fp8_e4m3_per_tensor.

Full report

Code correctness

Deep Code Correctness Audit — PR #732 (helios,heliopause,ignition: add FP8_E4M3_GLOBAL single-plane engram table support) @ 078b043

Scope note. The PR is 10 files / ~710 changed lines across helios/, heliopause/, ignition/ — under the >12-file / >900-line partition threshold, so I audited directly. The pr_diff base is stale and carries unrelated merged work (external_extents/async_transfers, workflow YAML, AGENTS.md (not opened), THIRD_PARTY_NOTICES.md (not opened), docs/api.md (not opened), flare-winui), so I compared main against head for each of the 10 files and confined findings to the encoding/schema/export/delivery change.


Finding 1 — Major: duplicated quant-mode dispatch in the PLE lookup, with a catch-all else that silently selects the NVFP4 two-plane path and dereferences a possibly-None scales

ignition/components/ngram_delivery.py:98-114 (changed):

@torch.library.custom_op("flare::staged_ple", mutates_args=("out", "timings", "barrier_output"))
def _lookup(source: torch.Tensor, weight: torch.Tensor, scales: torch.Tensor | None,
            scale: torch.Tensor | None, ids: torch.Tensor, count: torch.Tensor, out: torch.Tensor,
            ...
    mode = state.query.quant_mode
    if mode == "bf16":
        state.run_lookup(weight.view(torch.bfloat16), None, None, ids, count, out, token_count=out.shape[0])
    elif mode == "fp8_e4m3_per_tensor":
        state.run_lookup(weight.view(torch.float8_e4m3fn), scale, None, ids, count, out, token_count=out.shape[0])
    else:
        state.run_lookup(weight, scales.view(torch.float8_e4m3fn), scale, ids, count, out, token_count=out.shape[0])

and the second, independent decision at ignition/components/ngram_delivery.py:132-155 (changed):

        self.scales = None if table.scales is None else table.scales[:tokens * heads]
        ...
        mode = caps.quant_mode
        if mode == "bf16":
            lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.bfloat16), None, None
        elif mode == "fp8_e4m3_per_tensor":
            lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.float8_e4m3fn), table.scale, None
        else:
            lookup_weight = self.weights
            lookup_scale = self.scales.view(torch.float8_e4m3fn)
            lookup_scale_2 = table.scale

Three distinct defects in the same construct:

  1. Two sources of truth for one decision. __init__ resolves the mode from caps.quant_mode and bakes the resulting tensor views into the captured plan (self.plan = ple_embedding.plan(...) / declare(... run=lambda: state.run_lookup(lookup_weight, ...)), lines 145-157), while __call__ (lines 184-193) re-enters _lookup, which re-resolves the mode from a different object — state.query.quant_mode obtained from require_prepared(plan_from_handle(plan), ...) at line 104. Nothing in the file ties state.query.quant_mode to caps.quant_mode. If they disagree, the graph-captured path uses the precomputed views while the eager path re-derives from raw uint8/None — same table, different numerics under graph replay vs eager, with no error.

  2. Non-exhaustive dispatch on a free-form string. Any mode value other than the two literals — "nvfp4_group16" (the documented NVFP4 mode, see tests/components/test_ngram_delivery.py:32), a new "fp8_e4m3_per_block", a different casing ("FP8_E4M3_PER_TENSOR") — falls into the else branch, i.e. is treated as the two-plane NVFP4 layout. No validation error is raised.

  3. None dereference in the fallback. Because self.scales is now legitimately None for single-plane tables (line 132) and is forwarded unconditionally as the scales operand (line 190), the else branch at line 113 executes scales.view(torch.float8_e4m3fn) on None.

    Concrete counterexample (no hardware needed): a Qwen4-35B-A3B PLE table declared FP8_E4M3_GLOBAL (single plane ⇒ table.scales is None ⇒ self.scales is None) served with caps.quant_mode == "nvfp4_group16" (the model body's mode, since Helios' schema has no field tying EngramTable.encoding to a quant mode — see helios/proto/core.proto:266-292, which has no such field). PreparedPLELookup.__init__ succeeds (its else branch is only reached if caps.quant_mode is also "nvfp4_group16", in which case line 143 already raises), but _lookup reaches line 113 with scales is None → AttributeError: 'NoneType' object has no attribute 'view' at the first decode step. The reverse skew (caps.quant_mode == "fp8_e4m3_per_tensor" but state.query.quant_mode == "nvfp4_group16") silently runs the row data through the group-scale kernel instead.

    The new test cannot catch this: tests/components/test_ngram_delivery.py:86 only pairs scales=None with mode in {"bf16", "fp8_e4m3_per_tensor"}, never exercising the fallback with a single-plane table.

Fix. Make the dispatch a single exhaustively-checked function returning a mode tag plus the views, use it in both places, and fail loudly:

def _planes(weight, scales, scale, mode, *, view):
    if mode == "bf16":
        return weight.view(torch.bfloat16), None, None
    if mode == "fp8_e4m3_per_tensor":
        return weight.view(torch.float8_e4m3fn), scale, None
    if mode == "nvfp4_group16":
        if scales is None:
            raise ValueError("nvfp4_group16 requires a scale plane")
        return weight, scales.view(torch.float8_e4m3fn), scale
    raise ValueError(f"unsupported PLE quant mode {mode!r}")

and in __init__ assert (scales is None) == (mode != "nvfp4_group16"), then pass the precomputed views (or the resolved tag) into _lookup so the eager and captured paths cannot diverge.


Finding 2 — Minor: spans() accepts encoding == UNSPECIFIED while decode() and engram_encoding_has_scales() reject the same table

helios/src/runtime_core/engram.rs:29-36 (added):

        // Legacy pre-encoding `ModelIndex` fixtures leave `encoding == 0` with two planes.
        let encoding = if table.encoding == wire::engram_table::Encoding::Unspecified as i32 {
            wire::engram_table::Encoding::Fp8E4m3E8m0 as i32
        } else {
            table.encoding
        };
        let has_scales = crate::core::schema::engram_encoding_has_scales(encoding)?;
        validate_shards(table, world, has_scales)?;

versus helios/src/runtime_core/engram.rs:137-138 (unchanged in this respect):

        let encoding = wire::engram_table::Encoding::try_from(table.encoding)
            .map_err(|_| invalid("unknown n-gram encoding"))?;

and helios/src/core/schema.rs:445-456, which returns Err(invalid("engram table has no encoding")) for Unspecified.

Counterexample: wire::EngramTable { encoding: 0, weights: Some(w), scales: Some(s), .. } (exactly the "legacy pre-encoding fixture" the new comment describes, e.g. the byte fixture decoded in helios/src/runtime_core/engram.rs:500-524). spans(index, Some(rank)) returns Ok with two planes, but decode(...) on the same value returns Err("unknown n-gram encoding"). spans() is called on the payload-accounting/verification path (helios/src/runtime_core/protection.rs:1254, for (owner, span) in super::engram::spans(index, self.rank)?), so verification admits an index that loading then rejects — a late, misattributed failure ("unknown n-gram encoding" instead of a schema error). The same resolver also makes any future encoding value (≥ 5) fail verification with a stale message.

Fix. Hoist one resolver, e.g.

fn resolve_encoding(encoding: i32) -> Result<wire::engram_table::Encoding> // with the UNSPECIFIED→Fp8E4m3E8m0 legacy arm

and use it in both spans() and decode() (line 137 currently bypasses the legacy arm), or delete the fallback in spans() and let the single engram_encoding_has_scales error stand.


Finding 3 — Minor (hot path): per-call .view() tensor allocations, duplicating views already built once at plan time

ignition/components/ngram_delivery.py:107 and :110 allocate a fresh TensorImpl on every flare::staged_ple invocation — i.e. every PLE lookup, every decode step, on every rank. PreparedPLELookup.__init__ already precomputes exactly these views (lines 137-144) and hands them to the captured plan (line 155), so the per-call construction is redundant as well as cheap-but-nonzero. For a 160M-row, 8960-wide PLE table at decode time this is one extra ATen view per step per rank, plus it re-enters Python attribute lookups (state.query.quant_mode) inside an op that make_fx traces. Passing the precomputed lookup_weight/lookup_scale/lookup_scale_2 (or a small integer mode tag) as op operands removes both the allocation and Finding 1's divergence.


Verified sound (checked, no defect found)

One item I could not verify (needs a command, not another read)

ignition/preparation/runtime_core_pb2.py shows +112/−112 with the only textual change being Protobuf Python Version: 7.36.1 → 7.36.2; the enum values live inside the single-line escaped DESCRIPTOR blob, so I could not confirm that the regenerated descriptor actually contains BF16 = 3 / FP8_E4M3_GLOBAL = 4. If it is stale, ignition would silently alias the new encodings. Worth one check: python -c "from ignition.preparation import runtime_core_pb2 as p; print(p.EngramTable.Encoding.items())" — expected [(0,'UNSPECIFIED'),(1,'FP8_E4M3_E8M0'),(2,'NVFP4_E4M3_GLOBAL'),(3,'BF16'),(4,'FP8_E4M3_GLOBAL')].

Full report Merge Risk: medium_high (100%): Medium or high merge risk (core runtime/scheduler/GPU/CUDA/VMM/RoCE/multi-rank/contracts/ABI, large multi-crate changes, or Blocker/Major findings) — route to Super Agent.

Final review

Recommendation: Changes Requested

The core format, schema validation, and runtime decoding additions for EngramTable.Encoding.FP8_E4M3_GLOBAL = 4 are small, additive, wire-compatible, and cleanly reuse #664's Planes { weights, scales: Option<Plane> } seam with zero FP8-specific exporter or native reader/staging branches. However, the PR is blocked on Layer-1 verification (docs/design-review.md:180-194, 247-251) because only narrow name-filtered debug subsets were run for helios and heliopause, and it has two real should-fixes: non-exhaustive fallback dispatch with missing None guards in ignition/components/ngram_delivery.py and factual discrepancies in the PR description (off-by-one wire enum numbers and an unbacked hardlink-reuse test claim).

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

  1. Incomplete Layer-1 CPU verification for affected crates (docs/design-review.md:180-194, 247-251; AGENTS.md:309-321):
    • Verified gap: This PR modifies the signed core-format schema, runtime-core decoder, exporter tests, and Ignition ABI component across helios, heliopause, and ignition, yet reports only three narrow name-filtered debug test runs (helios --lib core::schema::tests, helios --lib runtime_core::engram, heliopause --lib payload_export_tests), non-release flare --lib, and a single pytest file (tests/components/test_ngram_delivery.py). It skipped --locked --release builds and unfiltered tests across the affected crates—omitting helios::engram::*, helios::core::reader, helios::core::conversion, helios::runtime_core::{protection,selection}, heliopause::export::{weight_reuse,binding}, and tests/preparation/ (including test_core_boundary.py and test_embedding_table_handoff.py (not opened)). Per docs/design-review.md:247-251, disclosing skipped runnable CPU checks as limitations does not waive them and blocks PR acceptance.
    • Fix: Run and report the Layer-1 release-mode commands for the affected crates and Python suites (matching .github/workflows/native-serving.yml (not opened) and .github/workflows/python-cpu.yml (not opened)):
      • cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server (with FLARE_TEST_TEMPLATE_DIR prepared via tests/frontend/prepare_templates.py (not opened), or running the full crate suite and noting only externally-gated template fixtures if offline),
      • cargo test --locked --release --manifest-path heliopause/Cargo.toml (not opened) --lib,
      • pytest tests/components/ tests/preparation/.

Should Fix

  1. Non-exhaustive catch-all else: and missing optional-plane validation in ignition/components/ngram_delivery.py:98-115, 132-145:
    • Verified behavior: Both _lookup (flare::staged_ple, lines 105–114) and PreparedPLELookup.__init__ (lines 136–144) duplicate the same three-way if mode == "bf16" / elif mode == "fp8_e4m3_per_tensor" / else: dispatch. Because scales and scale are now torch.Tensor | None (lines 99–100, 132):
      • Any unrecognized quant_mode string silently falls into the two-plane NVFP4 else: branch rather than raising an error, and crashes with AttributeError: 'NoneType' object has no attribute 'view' if scales is None.
      • "nvfp4_group16" with scales is None or scale is None crashes with AttributeError or forwards None as weight_scale_2.
      • "fp8_e4m3_per_tensor" does not reject scale is None or an unexpected non-None scales plane, and "bf16" does not reject unexpected scales/scale.
    • Fix: Extract one module-level helper _ple_lookup_planes(mode, weights, scales, scale) called by both PreparedPLELookup.__init__ and _lookup that explicitly handles "bf16", "fp8_e4m3_per_tensor", and "nvfp4_group16", validates presence/absence of scales and scale per mode, and raises ValueError on unsupported modes or mismatched planes. Add negative test cases in tests/components/test_ngram_delivery.py.
  2. PR description wire-tag errors, unbacked hardlink-reuse claim, and missing SM121 verification details (helios/proto/core.proto:269, helios/proto/runtime_core.proto:665, heliopause/src/export/core.rs:3907-4146):
    • Verified discrepancies:
      • The description states Added Encoding::FP8_E4M3_GLOBAL = 3 alongside NVFP4_E4M3_GLOBAL = 1 and BF16 = 2, which is off by one on every tag and omits FP8_E4M3_E8M0 = 1. The actual signed-core enum in both .proto files is UNSPECIFIED = 0; FP8_E4M3_E8M0 = 1; NVFP4_E4M3_GLOBAL = 2; BF16 = 3; FP8_E4M3_GLOBAL = 4.
      • The description claims FP8_E4M3_GLOBAL hardlink-reuse test coverage in heliopause/src/export/core.rs, but reuse_engram_hardlinks_shared_and_partitioned_embedding_planes (heliopause/src/export/core.rs:3907-4146) only loops over Nvfp4E4m3Global and Bf16 ((partitioned, bf16) at line 3910). Fp8E4m3Global is only exercised in core_engram_preserves_shared_and_partitioned_plane_layouts (4560-4768), which passes cache = None.
      • The claimed live SM121 ignition export + native flare run verification (disk/RAM FP8_E4M3_GLOBAL and backward-compatible NVFP4_E4M3_GLOBAL replay) omits commands, observed results, and confirmation that the pinned flashinfer-python[b12x] revision (1441ce86 in pyproject.toml:47) provides "fp8_e4m3_per_tensor" (which tests/components/test_ngram_delivery.py:56-67 mocks out).
    • Fix: Correct the enum tag numbers in the PR description, either add Fp8E4m3Global cases to reuse_engram_hardlinks_shared_and_partitioned_embedding_planes (recommended—small loop extension) or update the description to match actual coverage, and include a brief command/result summary for the SM121 export/serve and NVFP4 replay runs (docs/design-review.md Principles 12 & 16).

Subtract / Simplify

  1. Match the decoded Encoding enum once in helios/src/core/schema.rs:497-512, 561-571: After engram_encoding_has_scales, validate_engram re-compares table.encoding == ... as i32 three times (506, 561, 567) and duplicates the "single-plane engram table cannot carry scale metadata" error return (505, 508). Decoding wire::engram_table::Encoding once and matching exhaustively removes raw-i32 comparisons, collapses the duplicate error branch, and ensures future encodings cannot silently fall into an else branch.
  2. Consolidate single-plane decode geometry in helios/src/runtime_core/engram.rs:150-167: Encoding::Bf16 and Encoding::Fp8E4m3Global construct the same (table.embedding_width, 0, row_bytes, None) tuple differing only in bytes_per_element (2 vs 1) and the global_scale check; factoring the shared width-to-bytes conversion trims boilerplate while keeping both scale guards clear.

Nits

  1. docs/core-design.md:607 still describes PLE lookup as "b12x NVFP4 PLE embedding" (pre-existing staleness since #664's BF16, now also omitting FP8_E4M3_GLOBAL); consider updating it for consistency across the core-format doc set.
  2. Although adding an EngramTable.Encoding tag does not introduce a new captured-graph operation contract, getting a brief maintainer sign-off (@lukealonso) on the new signed-core enum tag and b12x "fp8_e4m3_per_tensor" vocabulary before merge is good hygiene.

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found

explore

Author: yatesdr (COLLABORATOR; 84 merged PRs in 180 days, mostly helios/src, selene, docs); Discord D-Rock Motivation: Qwen4-35B-A3B checkpoints store their giant offloaded PLE/engram tables as raw FP8 with one shared scale per table, a layout the format could not yet describe, so those checkpoints could not be exported or served natively. This PR adds that one encoding tag, reusing the single-plane seam merged hours earlier in #664. Scale: +565 / −145 lines in 10 files Proposal:

Full report · Notes

Classify intake

Selected: triage:review, performance, enhancement, area:engram

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +performance

Gates and contracts

Contracts, Charter & Verification Gates Audit — PR #732 @ 02ba762

Verdict: one mandatory-verification BLOCKER stands (Layer 1), plus one MAJOR claim contradiction (Gate 4). No vendored-file violation. No proven contract-boundary violation.

I read at ref: pr/732 (not pr_diff, which diffs against a stale pre-#664 base) and compared against main, covering docs/design-review.md, AGENTS.md, docs/verification.md, docs/core-format-design.md, docs/core-design.md, helios/manifest.md, both protos, pyproject.toml, and every changed source file.

Gate 1 — Signed core-format / wire / captured-graph contracts: CLEAN

Gate 2 — Vendored dependencies & cross-PR: CLEAN

Gate 3 — Mandatory verification: BLOCKER (checked prior round first)

I checked the Case File History and the 19:54 review at 078b043 before filing. The head moved to 02ba762, but the new body's evidence is still --lib and name-filtered subsets: heliopause --lib (234), helios --lib core:: (527), helios --lib runtime_core:: (204), flare --lib (247), and one pytest file.

The mandated command (AGENTS.md:317, .github/workflows/native-serving.yml (not opened)) is the whole crate: cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server. That also runs helios/tests/, which holds exactly the core loading / legacy-core compatibility harnesses a core-format change must exercise — legacy_core.py (not opened) (v4/v5 ModelIndex fixtures), legacy_cluster_fixture.py (not opened), runtime_core_fixture.py (not opened), engram_core_fixture.py (not opened) — all omitted by a --lib filter. docs/verification.md:32 requires loading and compatibility tests for a core field change; docs/design-review.md:116-123 requires previous cores validated through loading and serving. tests/preparation/ also went unrun and is affected (test_core_boundary.py:15 (not opened) pins the engram module; test_core_protection.py:838 (not opened),873 exercise engram shard export). docs/design-review.md:247-251 is non-waivable: "Disclosure does not excuse skipping runnable CPU checks." Both commands run CPU-only. (heliopause has no tests/ dir, so its --lib run is effectively the whole crate — that part is fine.)

Layer 3 is plausibly satisfied, so I do not file that gap: live SM121 ignition export + native flare run (disk and ram) plus an NVFP4_E4M3_GLOBAL replay are claimed, and nero-'s 22:52 comment independently corroborates SM120 + SM121 with GSM8K-1319. Caveats: no artifacts, and the corroborator authored the closed duplicate #733.

No failing CI or failing test is reported anywhere, so nothing is flagged on that axis.

Gate 4 — Claim contradictions: MAJOR

Four checkable "what changed" claims are absent from the tree:

  1. _ple_lookup_planes does not exist — repository-wide search returns no matches; ngram_delivery.py:105-114 and :136-144 still hold two duplicated three-way dispatches with a bare else: (:112-114, :141-143) calling scales.view(...) on a possibly-None plane, and there is no ValueError for a mode anywhere in the file. The body presents this refactor as done.
  2. The cited hardlink test is pre-existing and does not cover FP8 — reuse_engram_hardlinks_shared_and_partitioned_embedding_planes exists identically at main:3907 and pr/732:3907, and its loop for (partitioned, bf16) in [(false,false),(true,false),(false,true),(true,true)] (:3910) has only NVFP4/BF16 branches. Fp8E4m3Global appears in core.rs at exactly :4570 and :4583, inside core_engram_preserves_shared_and_partitioned_plane_layouts (cache = None). So FP8 hardlink reuse is genuinely uncovered.
  3. docs/core-design.md is not in the 10 changed files and :607 is still stale.
  4. "pytest … 10 passed" is impossible — the file has one test (tests/components/test_ngram_delivery.py:37) parametrized over three modes (:29-35) = 3 collected; the figure also changed from an earlier "3 passed."

Also unsupported: "exhaustively matches the decoded Encoding enum once" (raw i32 compares at schema.rs:506,561,567; duplicate error string at :505 and :508) and "consolidates single-plane row-byte geometry in runtime_core::engram" (no helper; inline arm at engram.rs:159-167). This is a docs/design-review.md:156-162 (principle 16) failure, and the exact in-scope class: prose asserting a test/refactor completely absent from the diff. Not scope bundling — the file list matches the stated subject and the +112/−112 runtime_core_pb2.py is generated churn, correctly regenerated (:5 shows protoc "7.36.2", so #664's regeneration carries over).

Explicitly not flagged

Required before merge

  1. Post unfiltered --locked --release results for helios --features runtime-core,server (including helios/tests/ legacy-core loading targets) and heliopause, plus pytest tests/preparation/ — docs/design-review.md:247-251 is non-waivable.
  2. Correct or delete the four unsupported description claims, which also fixes the impossible pytest count.
  3. Optional: an explicit owner yes/no on the enum tag, and a statement of which pinned b12x revision provides "fp8_e4m3_per_tensor".

Full report · Notes

Subtraction and simplicity

Subtraction & Simplicity Audit — PR #732 (helios,heliopause,ignition: add FP8_E4M3_GLOBAL single-plane engram table support, head 02ba762)

Verdict: the wire additions are lean — one enum value, one match arm per layer, no new CLI flags, no new exporter path, no native-reader change (Fp8E4m3Global appears in exactly two non-test production sites: helios/src/core/schema.rs:453,567 and helios/src/runtime_core/engram.rs:159). But the change ships a duplicated mode→tensor-shape map in Python, duplicated encoding→row-bytes arithmetic across two crates, and ~170 lines of test code that re-derive fixtures already present in the same files. Concrete, high-signal reductions below.


1. HIGH — the same mode→(weight, scale, scale₂) mapping is written twice, and the extraction the description claims is missing

ignition/components/ngram_delivery.py:105-114 (in _lookup) and :136-144 (in PreparedPLELookup.__init__) are the same three-way branch:

105      mode = state.query.quant_mode
106      if mode == "bf16":
107          state.run_lookup(weight.view(torch.bfloat16), None, None, ids, count, out,
...
109      elif mode == "fp8_e4m3_per_tensor":
110          state.run_lookup(weight.view(torch.float8_e4m3fn), scale, None, ids, count, out,
...
112      else:
113          state.run_lookup(weight, scales.view(torch.float8_e4m3fn), scale, ids, count, out,
136          mode = caps.quant_mode
137          if mode == "bf16":
138              lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.bfloat16), None, None
139          elif mode == "fp8_e4m3_per_tensor":
140              lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.float8_e4m3fn), table.scale, None
141          else:
142              lookup_weight = self.weights
143              lookup_scale = self.scales.view(torch.float8_e4m3fn)
144              lookup_scale_2 = table.scale

search_code over the PR head for _ple_lookup_planes returns zero matches, so the description's "Extracts _ple_lookup_planes(mode, weight, scales, scale) shared by PreparedPLELookup and flare::staged_ple" is not in the tree — the duplication the bullet says it removed is still present, now as two copies of a three-mode switch instead of one NVFP4 path.

Subtraction — one helper used by both sites:

def _ple_lookup_planes(mode, weight, scales, scale):
    if mode == "bf16":                 return weight.view(torch.bfloat16), None, None
    if mode == "fp8_e4m3_per_tensor":  return weight.view(torch.float8_e4m3fn), scale, None
    if mode == "nvfp4_group16":        return weight, scales.view(torch.float8_e4m3fn), scale
    raise ValueError(f"unsupported PLE quant mode {mode!r}")

This also fixes, at one site instead of two, the defect that the last branch is a bare else (:112, :141): an unknown quant_mode silently takes the NVFP4 path and dereferences scales at :113/:143, which is None for single-plane tables (:132 sets self.scales = None if table.scales is None else ...). Making "nvfp4_group16" explicit is fewer lines than the current else and removes the crash. _lookup and __init__ then differ only in which tensor triple they pass; the run= lambda at :155 and the _lookup(...) call at :190 stay unchanged. The module already has a precedent for a named validating helper: _validate_staged_heads at ignition/components/engram.py:90.


2. HIGH — encoding→row-byte geometry is now computed twice, in two different crates

helios/src/core/schema.rs:561-571:

let single_plane_row_bytes = if table.encoding == wire::engram_table::Encoding::Bf16 as i32 {
    Some(
        u64::from(table.embedding_width)
            .checked_mul(2)
            .ok_or_else(|| invalid("BF16 engram row width overflow"))?,
    )
} else if table.encoding == wire::engram_table::Encoding::Fp8E4m3Global as i32 {
    Some(u64::from(table.embedding_width))
} else {
    None
};

helios/src/runtime_core/engram.rs:150-167 (same PR, same commit) re-derives the identical quantity with the identical ×2 vs ×1 rule:

wire::engram_table::Encoding::Bf16
    if table.embedding_width > 0 && table.global_scale.to_bits() == 0 =>
{
    let row_bytes = usize::try_from(table.embedding_width)
        .ok()
        .and_then(|width| width.checked_mul(2))
        .ok_or_else(|| invalid("BF16 embedding row width overflow"))?;
    (table.embedding_width, 0, row_bytes, None)
}
wire::engram_table::Encoding::Fp8E4m3Global
    if table.embedding_width > 0 && table.global_scale.is_finite() && table.global_scale > 0.0 =>
{
    let row_bytes = usize::try_from(table.embedding_width)
        .map_err(|_| invalid("FP8 global embedding row width overflow"))?;
    (table.embedding_width, 0, row_bytes, None)
}

The FP8 arm is the BF16 arm minus checked_mul(2); and the two crates now encode the same elements-per-row→bytes-per-row table. The description claims it "consolidates single-plane row-byte geometry in runtime_core::engram" — no shared helper exists (single_plane occurs only at schema.rs:561,578,622).

Subtraction: add one pub fn engram_plane_row_bytes(encoding: i32, width: u32) -> Result<Option<u64>> beside engram_encoding_has_scales (schema.rs:445) and engram_scales (:460) — helpers the sibling crate already imports across the boundary (heliopause/src/export/core.rs:108,131,1556,1598), and runtime_core/engram.rs already imports from crate::core::schema (:35,:45,:59), so both call sites become two-liners. That also folds the two duplicated guards (is_finite() && > 0.0 here, to_bits() == 0 there) into one place, and lets the two single-plane match arms collapse into one parameterised by element bytes (~12 lines).


3. MEDIUM — schema.rs:504-512: three-branch chain, duplicated error string, as i32 instead of the enum

} else if !table.scale_buffer.is_empty() || table.scale_block != 0 {
    return Err(invalid("single-plane engram table cannot carry scale metadata"));
} else if table.encoding == wire::engram_table::Encoding::Bf16 as i32 {
    if table.global_scale.to_bits() != 0 {
        return Err(invalid("single-plane engram table cannot carry scale metadata"));
    }
} else if !(table.global_scale.is_finite() && table.global_scale > 0.0) {
    return Err(invalid("FP8 global engram table requires a finite positive global scale"));
}

Same message at :505 and :508; the shape exists only because Bf16 rejects any nonzero scale while FP8 requires a finite positive one. The body claims it "exhaustively matches the decoded Encoding enum once in validate_engram" — the code actually compares table.encoding == ... as i32 three times (:506, :561, :567). One match Encoding::try_from(table.encoding) returning NoPlane | GlobalScale(f32) | BlockScale expresses all three cases in one place and removes every as i32 comparison.


4. MEDIUM — the new schema test re-implements the BF16 test 100 lines above it

helios/src/core/schema.rs:2068-2167 (validates_single_plane_fp8_global_engram_table) duplicates :1945-2065 (bf16_identity_single_plane_engram_validation): same catalog.insert(&descriptor(1..4)) (:2074-2077 vs :1951-1954), same use_ closure (:2078-2085 vs :1955-1962), same assert_err closure (:2117-2120 vs :1991-1994), same with_scales / with_scale_buf / bad_size / partitioned / bad_shard_bytes cases. The only genuinely new assertions are the four-value loop for bad_scale in [0.0f32, -0.25, f32::NAN, f32::INFINITY] (:2122-2126) and the byte factor (rows * u64::from(width) vs * 2, :2072-2073).

Subtraction: one table-driven test over [(Encoding::Bf16, 2, 0.0), (Encoding::Fp8E4m3Global, 1, 0.25)], running the negative-scale loop only for the case that can fail — ~25 net lines instead of ~100, and the two encodings' contracts become visibly identical in one place.


5. MEDIUM — runtime_core/engram.rs:1162-1235 builds a second bespoke fixture next to one 40 lines up

fp8_global_single_plane_tables_decode_shared_and_partitioned carries an inline make(global_scale, width, partitioned) closure that mutates a decoded fixture field-by-field (:1173-1214): sets encoding/width/scale_block/global_scale, clears scale buffer, rebuilds hash arrays, hand-builds two shards, then hand-patches the engram_1_weights buffer's shape/strides/nbytes and retains away engram_1_scales. The immediately preceding nvfp4_tables_accept_width_128_and_160_and_reject_unaligned_widths (:1111-1159) already has a make(width, row_bytes, scale_bytes) closure doing exactly that buffer patching, and bf16_identity_single_plane_decodes_and_enforces_strict_contract (:868) already covers the no-scales path. make is also called three times (:1218, :1223, :1229) rebuilding identical fixtures just to vary one scalar — a for (global_scale, partitioned) in [...] loop is ~8 lines instead of ~20.


6. LOW — heliopause/src/export/core.rs test additions are positional and hand-offset


Confirmed lean — no subtraction warranted


Summary table

# Site Kind Est. lines saved
1 ignition/components/ngram_delivery.py:105-114, 136-144 duplicated map + bare-else crash path ~10 (and fixes a real defect)
2 helios/src/core/schema.rs:561-571 ↔ helios/src/runtime_core/engram.rs:150-167 duplicated encoding→row-bytes arithmetic across crates ~15
3 helios/src/core/schema.rs:504-512 three-branch chain, duplicated error string, as i32 vs enum match ~6
4 helios/src/core/schema.rs:2068-2167 test copies :1945-2065 ~75
5 helios/src/runtime_core/engram.rs:1162-1216 second bespoke fixture builder beside :1113 ~30
6 heliopause/src/export/core.rs:3910, 4641-4648, 4557-4611 positional bool/index coupling, doubled hardcoded offsets ~10

Two of these (#1, #2) are cases where the PR description asserts a consolidation was done and the tree shows it was not; #1 additionally leaves an unguarded else that dereferences a possibly-None scales tensor. None of the requested functional behaviour is lost by any reduction above.

Full report · Notes

Code correctness

Deep Code Correctness, Invariants & Hot-Path Performance Audit — PR #732 (02ba762)

Scope: 10 files, ~565 changed lines across helios, heliopause, ignition → below the >12-file / >900-line partitioning threshold, so audited directly (no sub-agents).

Verdict: The Rust, protobuf, and export halves are correct and I verified several non-obvious invariants hold. I found one Major defect, in the Python (ignition) dispatch that this PR's new encoding makes newly reachable, plus three Minor observations.


Findings

1. Major — ignition/components/ngram_delivery.py:105-114 and :136-144: non-exhaustive mode dispatch folds unknown modes into the NVFP4 branch and dereferences a None scale plane; no ValueError on unsupported modes

The diff widens scales/scale to Optional (ngram_delivery.py:99-100) and turns scales is None into a normal, expected state for the new FP8_E4M3_GLOBAL encoding — precisely because the Rust decoder now emits scales: None for it (helios/src/runtime_core/engram.rs:159-167 → has_scales = scale_bytes.is_some() = false → :270-273 scales: scale_bytes.map(...) = None → :423 scales: has_scales.then_some(table.scale_buffer) = None, surfaced as table.scales on the Python side). The dispatch that then decides whether scales may be None is a two-literal if/elif with a catch-all else:

105     mode = state.query.quant_mode
106     if mode == "bf16":
107         state.run_lookup(weight.view(torch.bfloat16), None, None, ids, count, out, ...
109     elif mode == "fp8_e4m3_per_tensor":
110         state.run_lookup(weight.view(torch.float8_e4m3fn), scale, None, ids, count, out, ...
112     else:
113         state.run_lookup(weight, scales.view(torch.float8_e4m3fn), scale, ids, count, out, ...

and the identical structure in PreparedPLELookup.__init__:

136         mode = caps.quant_mode
137         if mode == "bf16":
138             lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.bfloat16), None, None
139         elif mode == "fp8_e4m3_per_tensor":
140             lookup_weight, lookup_scale, lookup_scale_2 = self.weights.view(torch.float8_e4m3fn), table.scale, None
141         else:
142             lookup_weight = self.weights
143             lookup_scale = self.scales.view(torch.float8_e4m3fn)
144             lookup_scale_2 = table.scale

Callee/enum resolution: mode is not an enum — I grepped the whole repository and quant_mode occurs in exactly two places in production code (both lines above) plus the test's SimpleNamespace; there is no central vocabulary, no Literal, no validation, and no raise ValueError anywhere. The three literals ("bf16", "fp8_e4m3_per_tensor", and the implicit "nvfp4_group16" catch-all) exist only as string comparisons. _ple_lookup_planes(mode, ...) — the explicit validator with ValueError on unsupported modes / mismatched planes that the PR description says it "extracts" — does not exist in this diff or in the file; the logic is duplicated inline in two functions instead.

Concrete counterexample (provable by reading): a single-plane FP8_E4M3_GLOBAL table (table.scales is None, line 132 sets self.scales = None) combined with any quant_mode other than the two hardcoded literals — e.g. a recipe emitting "mxfp8", "fp8_e4m3", "fp8", or a capitalization variant "BF16" — takes the else arm at line 113 and raises an unhelpful

AttributeError: 'NoneType' object has no attribute 'view'

instead of a diagnosable ValueError. The same crash exists at line 143 during plan construction, so it fails at build time as well as at run time.

Second, subtler consequence of the same structure: the branch decision is read from two different objects — caps.quant_mode at plan time (line 136) and state.query.quant_mode at run time (line 105). If those ever disagree, the plan is built from one dtype/scale interpretation and the run executes another. The dangerous case is not the crash case but caps="fp8_e4m3_per_tensor" / query="bf16": the plan's invocation_from_tensors(weight=self.weights.view(torch.float8_e4m3fn), ...) binds an E4M3 view, while the run reinterprets the same uint8 buffer as bfloat16 (self.weights.view(torch.bfloat16)) and drops the scale — a silent reinterpretation of 1-byte rows as 2-byte rows, i.e. wrong embeddings with no error. (I could not prove from this repo that the two objects can differ, so I state this as a hazard created by the two-source-of-truth structure, not as a demonstrated failure.)

Also: mode == "bf16" silently discards table.scale (line 138 sets the scale to None unconditionally) rather than validating it is absent. Today helios/src/core/schema.rs:506-509 rejects a BF16 table with a nonzero global_scale, so the core backstops it — but helios/src/runtime_core/engram.rs:151 only requires global_scale.to_bits() == 0 (bf16-only path, not reproduced in the Python layer), so the Python layer is relying on an upstream guard it does not itself enforce.

Concrete fix — make the dispatch total and explicit, in one place, with the contract checks the PR describes:

def _ple_lookup_planes(mode, weight, scales, scale):
    if mode == "nvfp4_group16":
        if scales is None:
            raise ValueError("nvfp4_group16 PLE table requires a scales plane")
        return weight, scales.view(torch.float8_e4m3fn), scale
    if mode == "bf16":
        if scales is not None or scale is not None:
            raise ValueError("bf16 PLE table must not carry scale planes")
        return weight.view(torch.bfloat16), None, None
    if mode == "fp8_e4m3_per_tensor":
        if scales is not None:
            raise ValueError("fp8_e4m3_per_tensor PLE table must not carry a scales plane")
        if scale is None:
            raise ValueError("fp8_e4m3_per_tensor PLE table requires a global scale")
        return weight.view(torch.float8_e4m3fn), scale, None
    raise ValueError(f"unsupported PLE quant mode {mode!r}")

then call it from both _lookup (line 105) and PreparedPLELookup.__init__ (line 136), so caps.quant_mode and state.query.quant_mode are validated by the same code and the None-deref is unreachable.

Supporting evidence that this path is untested: the new test only parametrizes the three supported modes (tests/components/test_ngram_delivery.py:31-35), so every case takes a matched branch; there is no test for an unsupported mode or a mismatched plane, despite the PR description claiming "invalid mode/plane rejection tests."


2. Minor — helios/src/runtime_core/engram.rs:190: the table.embedding_width != width conjunct is unconditionally false for the new arm (dead condition, no harm)

159             wire::engram_table::Encoding::Fp8E4m3Global
160                 if table.embedding_width > 0
161                     && table.global_scale.is_finite()
162                     && table.global_scale > 0.0 =>
163             {
164                 let row_bytes = usize::try_from(table.embedding_width)
165                     .map_err(|_| invalid("FP8 global embedding row width overflow"))?;
166                 (table.embedding_width, 0, row_bytes, None)
...
190             || table.embedding_width != width

The arm binds width = table.embedding_width (line 166), so line 190 compares the field to itself. This is intentional (any width is legal for this encoding, unlike Fp8E4m3E8m0's fixed 256 at line 140) and it is the pre-existing pattern for Nvfp4E4m3Global (line 147), so it is harmless dead code rather than a defect — noted only because it means the width is not range-checked beyond > 0 here; the real bounds come from validate_buffer (:310-327) against the declared buffer, which I confirmed is the enforcing check.


3. Minor — helios/src/runtime_core/engram.rs:157 / helios/src/core/schema.rs:565: inconsistent overflow treatment, cosmetically preserved BF16 message

schema.rs:561-571 guards the BF16 width with checked_mul(2) ("BF16 engram row width overflow") while the new FP8 arm is a plain u64::from(table.embedding_width) with no multiply — correct, since FP8 rows are exactly embedding_width bytes and no overflow is possible. The BF16-specific error string at schema.rs:565 was left un-renamed while its two sibling messages were generalized to "single-plane…" (:582, :584, :626, :628). Purely cosmetic; the arithmetic is sound.


4. Minor — helios/src/core/schema.rs:506-512: the final else is only sound because of the earlier engram_encoding_has_scales call

502         if has_scales {
503             bounded_name(&table.scale_buffer, 64, "engram scale buffer")?;
504         } else if !table.scale_buffer.is_empty() || table.scale_block != 0 {
505             return Err(invalid("single-plane engram table cannot carry scale metadata"));
506         } else if table.encoding == wire::engram_table::Encoding::Bf16 as i32 {
507             if table.global_scale.to_bits() != 0 {
508                 return Err(invalid("single-plane engram table cannot carry scale metadata"));
509             }
510         } else if !(table.global_scale.is_finite() && table.global_scale > 0.0) {
511             return Err(invalid("FP8 global engram table requires a finite positive global scale"));
512         }

I traced the domains: has_scales == false at line 502 can only be reached with encoding ∈ {Bf16, Fp8E4m3Global}, because &?/"unknown" and Unspecified already returned Err at line 497 via engram_encoding_has_scales (:445-457, whose catch-all _ => Err covers Unspecified and out-of-range i32). So the else at 510 provably means Fp8E4m3Global exclusively — the guard is not dead and not contradictory. Recorded as a verified invariant, not a bug. The to_bits() != 0 test correctly rejects -0.0 and NaN for BF16, matching engram.rs:151 and the existing neg_zero assertion (schema.rs:2020-2022).


Checks that came back clean (verified, not assumed)

Regenerated Python descriptor is correct — I verified this arithmetically rather than assuming. My first pass suspected ignition/preparation/runtime_core_pb2.py was regenerated with a newer protoc (7.35.1 → 7.36.2) but a stale enum. It is not. The enum's serialized span grew from 11543..11622 (79 bytes, at main) to 11543..11643 (100 bytes, pr/732, lines 182-183). The added EnumValueDescriptorProto for FP8_E4M3_GLOBAL costs exactly: name (tag 1 + len 1 + 15 chars = 17) + number (tag 2 + varint 1 = 2) + outer repeated tag/len (2) = +21 bytes. 79 + 21 = 100 ✓, and every downstream span shifted by exactly 21 (_ENGRAMTABLE._serialized_end 11622→11643, _ENGRAMHASH 11768→11789, _BUNDLEINDEX 12057→12078, …). The new value is present and the file is internally consistent.

Signed-core schema validation (helios/src/core/schema.rs:445-457, 560-637): single-plane row geometry rows * embedding_width is byte-exact for both shared and partitioned planes; checked_mul guards overflow; scale_block == 0, empty scale_buffer, and absent scales are all enforced; partitioned shards are validated per-shard against shard.rows and the union must equal table.rows (:635-637). No off-by-one, no unsigned underflow.

Runtime decode (helios/src/runtime_core/engram.rs:159-167): finite-positive global_scale, row_bytes == embedding_width, scale_block == 0, and plane() (:257-269) re-checks stored_rows * row_bytes == span.nbytes — double-validated against the schema layer, with no window where one accepts and the other silently disagrees.

Export/combination (heliopause/src/export/core.rs:96-142, 1676-1733): engram_scales returning None correctly yields scales: None / scales_idx: None for both shared (line 1684 scales_idx.map(...)) and partitioned (line 1694) tables, and global_scale is propagated verbatim at line 1729. weight_reuse.rs:472 compares global_scale.to_bits() — the right comparison for -0.0/NaN equality — so cached Engram weights cannot be reused across differing global scales. conversion.rs:2862-2863 includes both encoding and global_scale in combined-core semantic identity.

Modified export test arithmetic (heliopause/src/export/core.rs:4413-4415, 4560-4596, 4633-4643, 4660-4690): installed.len() == 12 is correct (2 + 4 + 1 + 2 + 1 + 2 planes); the even/odd bad_idx convention (bad_idx % 2 == 0 → shared weights, else shards[0].weights) maps correctly onto the fixture's table order (0 shared, 1 partitioned, 2 shared, 3 partitioned, 4 shared, 5 partitioned) for all of [2,3,4,5]; FP8 payload sizes match exactly (rows=2 × width=8 = 16 shared, rows=1 × 8 = 8 per shard).

Hot-path complexity: the changed Rust adds one match arm (engram_encoding_has_scales, O(1) on an i32) and two constant-time predicates in decode. No loop, no per-iteration allocation, no Vec/HashMap clone, and no O(N·span) scan was introduced anywhere in the diff; decode's existing per-table loops are unchanged in shape.

Test file (tests/components/test_ngram_delivery.py): the fixture geometry is self-consistent with the Rust contract — row_bytes=256 for bf16 halves to 128 bf16 columns on .view(torch.bfloat16), row_bytes=128 for fp8 stays 128, row_bytes//8 scales for nvfp4 — and the assertions distinguish is table.scale (identity) from dtype checks correctly. The functional() → __call__ re-entry reuses output_shape/output_dtype and the retained weights/scales consistently. The only gap is the missing negative-mode case called out in Finding 1.


Summary

# Severity Location Defect
1 Major ignition/components/ngram_delivery.py:112-114, :141-144 Non-exhaustive quant_mode dispatch: no validator exists (_ple_lookup_planes is absent), unknown modes fall into the NVFP4 branch and dereference the now-legitimately-None scales (AttributeError instead of ValueError); decision duplicated across two functions reading two different objects, risking plan/run dtype divergence
2 Minor helios/src/runtime_core/engram.rs:190 table.embedding_width != width is self-comparison for the new arm (harmless, pre-existing pattern)
3 Minor helios/src/core/schema.rs:565 vs :582,584,626,628 BF16-specific overflow message left un-generalized during the rename
4 Minor (verified sound, no action) helios/src/core/schema.rs:506-512 Final else is Fp8E4m3Global-only by virtue of the line-497 guard — confirmed not dead, not contradictory

No other correctness, ordering, boundary, or hot-path defect found in the changed code. The docs and manifest.md edits match the implemented semantics; I raise no documentation concerns (separate lens).

Full report Merge Risk: medium_high (100%): Medium or high merge risk (core runtime/scheduler/GPU/CUDA/VMM/RoCE/multi-rank/contracts/ABI, large multi-crate changes, or Blocker/Major findings) — route to Super Agent.

Re-review

Recommendation: Changes Requested

The underlying EngramTable.Encoding.FP8_E4M3_GLOBAL = 4 wire, schema, runtime-decode, and export additions remain sound, strictly additive, and wire-compatible (and independent end-to-end SM120/SM121 GSM8K-1319 verification from @nero- strengthens confidence in the contract). However, the follow-up code, test, and doc fixes described in the updated PR body are not present at head 02ba762 — the branch diff is still the original 10-file change (+565 / -145), leaving Round 1's ignition/components/ngram_delivery.py bare-else None-dereference defect and missing negative tests unfixed, while the PR summary and pytest count (10 passed) describe a local commit that appears not to have been pushed. In addition, Round 1's Layer-1 CPU verification blocker remains partially unresolved (helios still skips helios::engram::* and helios/tests/, and tests/preparation/ remains unrun).

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

  1. Pushed branch head 02ba762 is missing the follow-up changes and tests claimed in the PR description (docs/design-review.md:156-162):
    • Verified mismatch at 02ba762: Five concrete claims in the updated PR summary and verification section do not exist in the pushed tree (it appears the follow-up commit was tested locally and summarized in the PR body, but not pushed to feat/qwen4-fp8-ple):
      • ignition/components/ngram_delivery.py: _ple_lookup_planes does not exist anywhere in the repo (search_code returns zero matches); :105-114 and :136-144 still contain the duplicated if / elif / else dispatch with no ValueError validation (see Should Fix #1).
      • tests/components/test_ngram_delivery.py:29-37: Contains only 1 test function parametrized over 3 valid modes (3 test cases total, not 10 passed), with zero invalid mode/plane rejection tests.
      • heliopause/src/export/core.rs:3907-3971: reuse_engram_hardlinks_shared_and_partitioned_embedding_planes is unchanged from main and loops only over NVFP4 and BF16 (for (partitioned, bf16) at :3910); Fp8E4m3Global only appears in core_engram_preserves_shared_and_partitioned_plane_layouts (:4570, :4583, where cache = None).
      • helios/src/core/schema.rs:504-512, 561-571 and helios/src/runtime_core/engram.rs:150-167: Neither the single exhaustive Encoding match in validate_engram nor the consolidated single-plane geometry helper in runtime_core::engram is present.
      • docs/core-design.md: Not among the 10 changed files (:607 still reads "b12x NVFP4 PLE embedding").
    • Fix: Push the follow-up commit to feat/qwen4-fp8-ple (which should resolve both this mismatch and Should Fix #1), or update both the code and PR description so the pushed head matches the claimed changes and test results.
  2. Unresolved Round-1 Layer-1 CPU verification gap (docs/design-review.md:180-194, 247-251; AGENTS.md:309-321):
    • Verified gap: Since Round 1, heliopause --release --lib (234 passed) and flare --release --lib (247 passed) were upgraded to full release-mode lib suites, and helios was expanded to --release --lib core:: (527) and --lib runtime_core:: (204). However, two runnable Layer-1 obligations remain unrun — and existing counts must also be confirmed on the pushed head once Blocker #1 is resolved:
      • helios was still filtered to core:: and runtime_core::, skipping helios::engram::* (runtime table staging/reader/cache) and helios/tests/ integration/legacy-core targets (docs/verification.md:32 (not opened)), and run without --locked.
      • tests/preparation/ (which includes test_core_boundary.py:15 (not opened),18 covering engram/ngram_delivery, test_core_protection.py (not opened), and test_embedding_table_handoff.py) remains unrun.
    • Fix: On the pushed head commit, run and report:
      • cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server (if FLARE_TEST_TEMPLATE_DIR cannot be prepared offline, run the full unfiltered --lib plus non-template integration tests and note only the externally gated template fixtures),
      • cargo test --locked --release --manifest-path heliopause/Cargo.toml (not opened) --lib,
      • pytest tests/components/ tests/preparation/.

Should Fix

  1. Unfixed Round-1 defect: Non-exhaustive bare else: and missing None plane/scale validation in ignition/components/ngram_delivery.py:98-115, 132-145:
    • Verified behavior at 02ba762: Because scales and scale are now legitimately torch.Tensor | None (:99-100, :132), both _lookup (:105-114) and PreparedPLELookup.__init__ (:136-144) duplicate an if mode == "bf16" / elif mode == "fp8_e4m3_per_tensor" / else: dispatch where:
      • Any unrecognized quant_mode string silently falls into the two-plane NVFP4 else: branch and crashes with AttributeError: 'NoneType' object has no attribute 'view' whenever scales is None (which is now the normal state for single-plane FP8_E4M3_GLOBAL and BF16 tables).
      • "nvfp4_group16" does not validate scales is not None and scale is not None; "fp8_e4m3_per_tensor" does not reject scale is None or unexpected non-None scales; "bf16" silently drops unexpected scales/scale.
    • Fix: Extract the shared _ple_lookup_planes(mode, weight, scales, scale) helper (already described in the PR summary) called by both PreparedPLELookup.__init__ and _lookup that explicitly handles "nvfp4_group16", "fp8_e4m3_per_tensor", and "bf16", validates plane/scale presence per mode, raises ValueError on unsupported modes or mismatched planes, and add negative test cases in tests/components/test_ngram_delivery.py.

Subtract / Simplify

  1. Match the decoded Encoding enum once in helios/src/core/schema.rs:497-512, 561-571: Replace the three raw table.encoding == ... as i32 comparisons (:506, :561, :567) and duplicated "single-plane engram table cannot carry scale metadata" error return (:505, :508) with a single exhaustive match on decoded wire::engram_table::Encoding.
  2. Consolidate single-plane decode geometry in helios/src/runtime_core/engram.rs:150-167: Factor the shared single-plane width-to-row_bytes conversion between Encoding::Bf16 (* 2) and Encoding::Fp8E4m3Global (* 1) (or share a small helper with schema.rs) while keeping both global_scale guards explicit.
  3. Deduplicate single-plane schema validation test (helios/src/core/schema.rs:2068-2167 vs :1945-2065): Optional cleanup — validates_single_plane_fp8_global_engram_table mirrors bf16_identity_single_plane_engram_validation almost line-for-line and could share a small table-driven helper.

Nits

  1. docs/core-design.md:607 still reads "b12x NVFP4 PLE embedding" (stale since #664's BF16 and now also omitting FP8_E4M3_GLOBAL; already listed in the PR summary once the follow-up commit is pushed).
  2. helios/src/core/schema.rs:565 keeps "BF16 engram row width overflow" while sibling messages (:582, :584, :626, :628) were generalized to "single-plane..." (cosmetic only).
  3. Getting a brief maintainer sign-off (@lukealonso) on the new signed-core enum tag and pinned b12x (1441ce86 in pyproject.toml:47 (not opened)) "fp8_e4m3_per_tensor" vocabulary remains good hygiene (non-blocking).

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.