#1 [high] Verified diff facts: schema/engram/runtime contract changes
helios/src/core/schema.rs:319-329 engram_encoding_has_scales (Unspecified|FP8|NVFP4 => true, BF16 => false, unknown => Err).
helios/src/core/schema.rs:421-453 shared-table branch: BF16 size check rowswidth2, has_scales else table.scales.is_some() => "single-plane engram table cannot carry scales plane".
helios/src/core/schema.rs:454-504 partitioned branch NEW preconditions: table.weights.is_some() || table.scales.is_some() || table.request_buffer.is_empty() || table.shards.len() != ranks as usize => "invalid partitioned engram table"; then per-shard shard.rank as usize != rank || shard.first_row != end || shard.rows == 0 => "engram partitions must cover table rows in rank order"; final end != table.rows => "must cover all table rows".
main version (helios/src/core/schema.rs:392-418 on main) only checked: weights/scales absent, shard.rank >= ranks, shard.rows == 0 || shard.first_row < end, end > rows. No rank-count, no ordering, no full-coverage requirement => UNDECLARED tightening for pre-existing cores (fix is real, backwards-compat untested).
helios/src/runtime_core/engram.rs:80-117 validate_shards already required request_buffer non-empty and shards.len()==world pre-PR (context lines unchanged in diff) => schema now matches loader.
helios/src/runtime_core/engram.rs:175-184 method/heads table: XorModulo (Some(4),24), EosXorModulo (Some(3),16), Identity (None,1).
helios/src/runtime_core/engram.rs:219-244 identity geometry: empties + compressed_vocabulary as u64 == table.rows.
helios/src/runtime_core/engram.rs:423-433 Table { planes, partition: (!table.shards.is_empty()).then_some(rank), scales: has_scales.then_some(...) }.
helios/src/engram.rs:176-187 Table now holds planes: Planes and partition: Option<usize>.
grep: partition is NEVER read in production code — only engram.rs:179 (decl), prepared.rs:131 (None), threaded.rs test fixtures (1471/1613), runtime_core/engram.rs:425, test assert at 1076. Its effect is only via derived PartialEq + dedup at helios/src/runtime_core/model.rs:458.
helios/src/runtime_core/selection.rs:52-76 validate_embedding_resident_scales + embedding_resident_scales(has_scale_planes,...); called from model.rs:475-479.
helios/src/core/reader.rs:228-247 required_payloads skips scales when single plane.
helios/src/engram/reader.rs:60-101 Planes { weights, scales: Option } + row_bytes()/scale_row_bytes()/total_nbytes()/iter()/iter_mut().
helios/src/engram/reader.rs:792-902 DiskReader::gather iterates planes; ordinal==1 keeps resident_scales fast path (scales is always plane 2).
helios/src/engram/reader.rs:970-976, 1102-1104, 1156-1159, copy_cached_hits_slice/gather_into_output guarded with if scales > 0.
helios/src/engram/reader.rs:1421-1440 Ram path: if planes.scales.is_some() != scales.is_some() => "Engram scale plane differs from resident storage".
helios/src/engram/prepared.rs:71 source.scales_plane.is_some() != source.scales.is_some() => binding/plane metadata must agree; 182-190 descriptor count = 1 + scales.is_some() per table; 216-223 descriptors() emits same count.
heliopause/src/embedding_tables.rs:41-56 accepts 1..=2 planes and optional "scales" (missing key or null => None).
ignition/preparation/rank_group.py:44-60 _receive_embedding_tables; expected = sum(len(table["planes"]) for table in catalog["tables"]).
helios/proto/core.proto:254-300 and runtime_core.proto:657-703 append BF16=3 / IDENTITY=3 with comments; no existing tags changed.
helios/manifest.md:454-470 new paragraph on single-plane + IDENTITY mailbox semantics.
#2 [high] Research summary
Correctness, Contracts & System-Level Consequences — PR #664
I inspected the full diff for every changed Rust/Python/proto file plus the direct callers that matter (core::protection verify path, runtime_core::model, runtime_core::protection, engram reader/prepared/threaded, heliopause::export::{core,binding,weight_reuse}, ignition/components/engram.py, ignition/preparation/{rank_group,model}.py). Findings below; each is verified against the head commit.
1. Memory amplification: BF16 row width inflates per-table staging and miss workspace without a cap (Major)
The machinery was sized for fixed 256 B / 80 B rows. row_bytes is now embedding_width * 2, embedding_width is an unconstrained u32, and staging/workspace are per table, independent of prompt length and table count.
helios/src/engram.rs:195-201
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))
helios/src/engram.rs:679-684 (× STAGING_FRAMES = 2, per table)
for _ in 0..STAGING_FRAMES {
staging.push(Staging {
data: stream.mapped_host_buffer(staging_bytes)?,
plus a second full-size buffer in helios/src/engram/reader.rs:1049
let miss_output = allocated(max_rows * row_bytes, 0u8)?;
Using the PR's own width (8960, from its new schema test at helios/src/core/schema.rs:1776) and heads == 1 (IDENTITY), at 4096 packed tokens a single table needs 4096 × 17,920 B ≈ 73 MiB staging × 2 frames ≈ 146 MiB pinned, plus ≈73 MiB miss_output, per table. The motivating catalog is 35–42 tables ⇒ roughly 5 GiB of pinned host staging for a 4.38 GiB on-Disk table. All of it is charged to the host budget at helios/src/runtime_core/model.rs:489-491 and model.rs:762-777, so the VRAM headroom this PR is buying is partly paid back in host memory (and on integrated/unified-memory parts, in the same pool).
Impact: on DGX-Spark/Thor-class unified memory the feature can consume more host memory than it frees device memory; nothing rejects such a catalog, the failure surfaces only as "embedding staging exceeds the memory budget" or a memory-limit error.
Fix: bound embedding_width for Encoding::Bf16 in validate_engram (e.g. ≤ 8 KiB row), and/or scale STAGING_FRAMES/max_tokens down for wide-row tables, and document the per-table staging cost next to the new helios/manifest.md:455-470 paragraph.
2. The claimed end-to-end coverage does not exist for the two new properties (Major, claim accuracy)
The description's Result states: "Helios verifies, decodes, and gathers them across disk, row cache, advisory warm, and RAM paths." The only single-plane gather test exercises the RAM/Resident path:
helios/src/engram/prepared.rs:461-467
let mut reader = reader::Reader::resident(peer.data[0].0.clone(), None, Arc::default());
let mut output = vec![0xA5; 3 * row_bytes];
reader
.gather(&peer.index.tables[0].planes, &[15, -1, 0], &mut output)
Every test that touches DiskReader::gather / CachedReader (row cache) / warm() constructs two planes (Planes::two), e.g. helios/src/engram/reader.rs:1497+, reader.rs:1816+, reader.rs:2039. So the newly added if scales > 0 guards — reader.rs:970-976 (parallel hit copy), 1102-1104 (negative-ID fill), 1156-1159 (miss copy-out) — and the scale_base = ids.len() * weights arithmetic are untested for the single-plane case. Planes::single(...) exists (reader.rs:66-73) but appears in the diff only as an unused-in-tests constructor.
Second, the Validation section still carries the author's placeholder "(update this line once the Thor E2B export + benchmark completes)" while the Result paragraph above it is written in the completed tense. Third, no in-tree producer/consumer can emit or consume these tables: ignition/components/engram.py:36-49 still hardcodes col = tl.arange(0, 256) with weight.view(torch.float8_e4m3fn) and 8-byte E8M0 scales, and engram.py:121-122 allocates 256-byte weight rows.
Fix: add a single-plane Reader::open test through the disk and row-cache paths (the Reader::open helper already takes &Planes), and correct the Validation/Result wording.
3. engram_encoding_has_scales reports "has scales" for an invalid encoding (Minor, contract hygiene)
helios/src/core/schema.rs:319-329
pub fn engram_encoding_has_scales(encoding: i32) -> Result<bool> {
match wire::engram_table::Encoding::try_from(encoding) {
Ok(
wire::engram_table::Encoding::Unspecified
| wire::engram_table::Encoding::Fp8E4m3E8m0
| wire::engine_table::Encoding::Nvfp4E4m3Global,
(Unspecified ⇒ Ok(true).) This function is now the single authority for plane presence in eight places, including the exporter and payload accounting: heliopause/src/export/core.rs:98, core.rs:423, core.rs:1546, helios/src/core/reader.rs:229, helios/src/runtime_core/engram.rs:29. An encoding = 0 table therefore gets "needs a scales plane" from the helper rather than "no encoding", and the caller errors with a plane-shaped message ("embedding table lacks payload plane") instead of "engram table has no encoding". Correct today only because validate_engram happens to reject Unspecified first (schema.rs:357-359) and decode rejects it at runtime_core/engram.rs:165. Fix: return Err(invalid("engram table has no encoding")) for Unspecified and let the two callers that need the legacy two-plane default state it explicitly.
4. "Distinct partitioned delivery groups" rests on an unread field used as an implicit equality key (Minor, fragility)
helios/src/engram.rs:176-187 adds partition: Option<usize>, and helios/src/runtime_core/engram.rs:425 sets it. Grep over helios/src: partition on Table is never read outside tests (runtime_core/engram.rs:1076, execution/threaded.rs:1471,1613). Its only production effect is through derived PartialEq at the dedup key:
helios/src/runtime_core/model.rs:458
if let Some((_, ranks)) = engram.iter_mut().find(|(existing, _)| existing == &index)
Additionally helios/src/engram/prepared.rs:131 sets partition: None unconditionally for every RAM/peer-attached table, so the marker is present on one path and absent on the other. Impact: the invariant "byte-identical TP shards must not collapse into one shared gather group" is enforced by an invisible side effect of a derived trait; any later content-based dedup (or a move to HashMap with a planes-only key) silently re-introduces the bug, and it is untested on the prepared/RAM path. Fix: make it explicit — include partition in a dedicated delivery_key() used at model.rs:458, or assert the invariant in PreparedTables::index.
5. Undeclared relaxation and opaque diagnostics on the signing side (Minor)
heliopause/src/export/binding.rs:653-657
for name in ["weights", "scales"] {
if let Some(parts) = value.get_mut(name) {
if parts.is_null() {
continue;
}
This tolerates "weights": null as well as "scales": null, and nothing in the description mentions the change. A null weights plane now passes append_planes, is embedded into output.index.engram (binding.rs:515) and only fails later in core_engram (heliopause/src/export/core.rs:1540-1546). Fix: keep the early Err for weights and tolerate null only for scales, and state the relaxation in the description.
helios/src/core/schema.rs:455-461 collapses four previously distinct failure conditions into one message:
if table.weights.is_some()
|| table.scales.is_some()
|| table.request_buffer.is_empty()
|| table.shards.len() != ranks as usize
{
return Err(invalid("invalid partitioned engram table"));
}
On main these were separate errors ("partitioned table carries shared planes too", shard-count and mailbox conditions were not checked at all). Operators debugging a rejected core now cannot tell a shared-plane misuse from a missing mailbox. Fix: keep distinct messages.
Note on the tightening itself: helios/src/core/schema.rs:462-503 (rank-order + first_row == end + full-coverage) is a genuine fix — it now matches validate_shards at helios/src/runtime_core/engram.rs:80-117 — and the description does declare it. It is applied on the load path too (validate_deployment is called from helios/src/core/protection.rs:637 and :988), so previously signable gapped cores now fail verification rather than failing later in decode; the diff contains no test that an older gapped artifact still rejects cleanly (the new tests only assert rejection of freshly built ones, e.g. heliopause/src/export/core.rs:5347-5377).
6. New core-contract surface with no recorded owner approval (Major, process/charter)
helios/manifest.md:455-470 and helios/proto/{core,runtime_core}.proto:254-300/657-703 document Encoding.BF16 = 3 and Method.IDENTITY = 3 plus a new mailbox contract ("publishes one int64 row ID per token in [0, stored_rows) … or -1 … out-of-range row IDs fail gathering") as core contract. The charter requires owner approval before writing a new captured-graph op contract, and the PR body asserts the opposite without evidence: "no model allowlists, capability flags, or new captured-graph operation families". There is no approval note, issue or reviewer sign-off referenced — unlike #566, which carried an explicit maintainer-contract-approval note, and #535, which is the open approval thread for the neighbouring advisory mailbox. IDENTITY is not covered by #535.
Fix: request and record approval for the IDENTITY mailbox semantics (row-ID range, -1 inactive slots, partition-local row IDs when sharded) before merge; the enum append itself (= 3, no tag changes, verified in both .proto files) is clean and backwards compatible.
Verified sound (no finding)
- Wire compatibility: enum values appended only; FP8/NVFP4 tags, defaults and layout untouched.
- Staging/upload layout consistency: reader writes weights at
row * weightsand scales atids.len()*weights + row*scales(reader.rs:1093-1104);Transfers::enqueueuploads weights at offset 0 and scales atrows * table.planes.weights.row_bytes(engram.rs:999-1014) — consistent for single and two-plane. - Resident-scales fast path:
DiskReader::gatherkeys it onordinal == 1(reader.rs:803-809), which cannot mis-fire becausePlanes::iter()yields scales second only when present. - Mixed catalogs:
--embedding-table-resident-scalesstill works when some tables have scales (has_scale_planes = any(...),model.rs:475-478), andReader::from_filesskips silently for the single-plane table (reader.rs:1362-1368); resident-bytes accounting atmodel.rs:733-745chains the optional plane correctly. - Metric/rate span check: no metric's measured window changed.
resident_scale_bytesis incremented only when a scale plane exists (reader.rs:1363-1368);cache_bytes/capacity_rowsremain allocated-byte gauges; the start-up phase label changes from "disk weights, RAM scales" to "disk" for single-plane catalogs (model.rs:891-897), which is accurate;estimated_export_fdsstill counts planes generically and its new single-plane test asserts(14, 14, 0)(export/core.rs:4924-4936). validate_bufferrobustness: the rewrite atruntime_core/engram.rs:315-332removes an out-of-boundsbuffer.shape[0]read thatmainperformed before checkingshape.len() == 2— a latent panic on malformed cores is fixed, not introduced.- Descriptor handoff:
PreparedTablesdescriptor count1 + scales.is_some()(prepared.rs:182-190) matchesdescriptors()(prepared.rs:216-223) andignition/preparation/rank_group.py:47, and the mismatched-metadata case returns an error (prepared.rs:71,163-167).
#3 [high] Finding 1: BF16 row width inflates staging/miss workspace per table
Severity: Major (system-level memory amplification).
Citations (verified at head c769355):
- helios/src/engram.rs:195-201 staging_payload_bytes: planes.iter().fold(row_bytes sum) * heads * max_tokens.
- helios/src/engram.rs:679-684: two frames per table -> stream.mapped_host_buffer(staging_bytes)? (STAGING_FRAMES = 2 at engram.rs:339).
- helios/src/engram/reader.rs:1049:
let miss_output = allocated(max_rows * row_bytes, 0u8)?;(max_rows = max_tokens * heads). - row_bytes for BF16 = embedding_width * 2, unbounded: helios/src/runtime_core/engram.rs:156-164; helios/src/core/schema.rs:421-429.
- Charged to host budget: helios/src/runtime_core/model.rs:489-491 (staging_bytes) and 762-777 (embedding_host_bytes -> check_memory_limit).
- PR's own width 8960 (helios/src/core/schema.rs:1776 in new test bf16_identity_single_plane_engram_validation).
Arithmetic: 4096 tokens x 1 head x 17,920 B = ~73.4 MiB per table per frame; x2 frames = ~147 MiB pinned + ~73 MiB miss_output => ~220 MiB per table. Gemma-4 E2B 35 tables / E4B 42 tables => ~7.5-9.2 GiB host staging for a 4.38-5.25 GiB on-disk table. On unified memory (DGX Spark / Thor) this re-spends the headroom the feature buys.
Fix: bound embedding_width for Encoding::Bf16 in validate_engram (e.g. <= 8 KiB row) and/or reduce STAGING_FRAMES / max_tokens for wide rows; document per-table staging in helios/manifest.md:455-470.
#4 [high] Finding 2: single-plane disk/row-cache/warm gather paths untested; description tense wrong
Severity: Major (tests & claim accuracy).
Citations:
- Only single-plane gather test is the resident/RAM path: helios/src/engram/prepared.rs:461-467
reader::Reader::resident(peer.data[0].0.clone(), None, Arc::default())thenreader.gather(&peer.index.tables[0].planes, &[15, -1, 0], &mut output). - All DiskReader/CachedReader/warm tests use Planes::two: helios/src/engram/reader.rs:1497+, 1816+, 2039+, and helios/src/engram/reader/windows.rs test fixtures.
- Newly added
if scales > 0guards are therefore unexercised for one plane: helios/src/engram/reader.rs:970-976 (copy_cached_hits_slice), 1102-1104 (negative-id fill), 1156-1159 (miss copy-out); scale_base at reader.rs:1095. - Planes::single() (reader.rs:66-73) is cfg(test) and appears unused for gather tests.
- Description Result says "Helios verifies, decodes, and gathers them across disk, row cache, advisory warm, and RAM paths" but Validation section still has the placeholder "(update this line once the Thor E2B export + benchmark completes)".
- No in-tree producer/consumer for these tables: ignition/components/engram.py:36-49 hardcodes col = tl.arange(0,256), weight.view(torch.float8_e4m3fn), 8-byte E8M0 scales; engram.py:121-122 allocates 256-byte weight rows and 8-byte scale rows.
Fix: add a Planes::single Reader::open test through disk and CachedReader (incl. warm) paths; correct description tense.