Case file: PR #716 — helios: derive NVFP4 engram row and scale widths from embedding_width
Author lukealonso · open, ready for review · base main, head d061454 · 1 file, +57 / −2 · no labels, no reviews, CI pending · opened 2026-12-04.
Key findings
- The diff carries two undeclared edits. Besides the decode change and the new test, it adds
async_transfers: vec![]to thewire::Executionliteral andexternal_extents: vec![]to theCoreliteral in the test fixturedecode_fixture(helios/src/runtime_core/engram.rs:631and:634). Both fields come from merged #711 (commit45e1c1ad), which broke--libcompilation onmain. The description never mentions this: it only credits #714 with unblocking test execution. Consequence: this PR fixes its own file's fixtures; only other modules (cache_memory.rs) still need #714. Verified: at the PR head,helios/src/runtime_core/cache_memory.rs:1659-1670still lacks the field (only:1397has it), socargo test --libstill fails crate-wide until #714 lands. - The 16-element scale block stays hardcoded, narrowing the stated generality. Line 145 (
table.scale_block != block) still rejects any table whosescale_block != 16, so "any other 16-aligned NVFP4 table width" loads only for block-16 tables. The description does not say this. - The new rejection path is not diagnosable. A zero or unaligned
embedding_widthfalls through to the sameinvalid("invalid n-gram encoding or global scale")(line 130) used for a badglobal_scale; the message never names the width. - The reject half of the new test is weak. It calls
make(bad_width, 64, 8)for all of 0, 8 and 120 (:840-846), so it exercises only the new alignment guard and never a geometry mismatch; and since width 120 withrow_bytes=64would also fail, the assertions do not isolate which check fires. - No linked issue, no reproducing artifact, compile-only evidence. The motivating bug (Qwen4-35B-A3B cores rejected) is asserted, not linked to any issue or failing run; no 128-wide core is exported or served anywhere in the repo, and no replay of an existing 160-wide core is reported. Qwen4 is absent from the in-tree official recipe list (
docs/model-preparation.md:317-327), and its producer recipe lives outside the repo (local-inference-lab/hyperflare-recipes#154). - #664 (open, kbenkhaled) edits the same
match encodingblock and replaces[Plane; 2]with a single-planePlanestype across the engram path. Complementary in intent, but a textual conflict in exactly this function.
The change
One file: helios/src/runtime_core/engram.rs (+57/−2, confirmed by pr_files).
- Before:
wire::engram_table::Encoding::Nvfp4E4m3Global if table.global_scale.is_finite() && table.global_scale > 0.0 => (160, 16, 80, 10)athelios/src/runtime_core/engram.rs:119-129onmain. - After (
:119-131): the same arm, guarded additionally by&& table.embedding_width > 0 && table.embedding_width % 16 == 0, returninglet width = table.embedding_width; (width, 16, (width / 2) as usize, (width / 16) as usize). - The tuple is
(width, block, row_bytes, scale_bytes). NVFP4 is 4 bits/element →width/2weight bytes; 16-element blocks →width/16scale bytes. 160 → 80/10 (existing cores decode identically, as claimed); 128 → 64/8. - Side effects that follow from the code, not from the description:
headsare not derived from width.let heads = (order - 1) * 8;(line 141) is hash geometry, so the "16 heads" in the description is a property ofXorModulo/EosXorModuloorder, not of the width.2048/16 = 128and2560/16 = 160are consistent with the description's model numbers but are not what the code computes.- Line 144 (
table.embedding_width != width) becomes tautological for the NVFP4 arm; it still pins the untouched FP8 arm(256, 32, 256, 8)(line 120). - The block size 16 and the FP8 tuple remain the only hardcoded constants, so the "no model-specific runtime branches" claim holds literally.
- Test added at
:798-847,nvfp4_tables_accept_width_128_and_160_and_reject_unaligned_widths: accepts(128, 64 B, 8 B)and(160, 80 B, 10 B)and asserts the decoded planerow_bytesfor weights and scales (:833-838); rejects widths 0, 8, 120 (:840-846).
The why
- The runtime-core decoder was the only place the 160-wide geometry was hardcoded. The producer side is already generic: the exporter copies
embedding_widthverbatim (heliopause/src/export/core.rs:1674-1675), signed-core validation only requiresembedding_width != 0(helios/src/core/schema.rs:345), and the reader/staging/cache paths work offplane.row_bytes(helios/src/engram.rs:193-209). Searching\b160\bacrosshelios/srcfinds only test fixtures. - No issue or bug report is linked. The only linked item is #714, which is an unrelated compile fix.
search_itemsfor "Qwen4 engram" and "NVFP4 engram embedding_width" returns only #716 itself (plus #664 for the second query). So the "how long and how widely wanted" record is: one day old, single author, no known prior requests. This is not a long-standing ask.
Related work
- #664 (open, kbenkhaled) — helios,heliopause,ignition: single-plane BF16 and identity-indexed offloaded embedding tables (+366/−65, 23 files). Same file, same function: adds
Encoding.BF16 = 3andMethod.IDENTITY = 3, replaces[Plane; 2]withPlanes { weights, scales: Option<Plane> }and centralizes scale-plane validation intoschema::engram_scales. Its own review records two blockers (unapproved contract surface; no linked producer) and no CI. Overlapping, not competing: whichever lands second rebases this exactmatcharm. Notably, #664 also derives BF16 row bytes fromembedding_width— a second width-from-metadata derivation — and its review treats that as a contract extension needing owner sign-off, which is a useful contrast for how this repo treats width-derived layouts. - #711 (merged 2026-12-03, same author) added
Core.external_extentsandExecution.async_transfers; it is the source of this PR's undeclared fixture edits and of the crate-wide breakage. - #659 (merged) added the second
Coreliteral atcache_memory.rs:1659; #714 (open, jcartu) repairs it. #714's review is "Ready To Merge, 0 blockers" and states that every open helios PR rebasing onto post-#711maininherits the breakage until it lands. So this PR's stated dependence on #714 for running its test is accurate but transient, and both PRs would fix the same class of problem in different files. - #590 (merged, same author) — engram reader bug fixes plus PLE lookahead; the Qwen3.8 PLE path this builds on. #566 (merged, advisory lookahead prefetch), #580 (merged, row-cache insertion ordering), #583 (closed, disk I/O priority), #470 (merged, original-el8 — parallelized gathers), #539 (merged, zero-staging export blob reuse). Open: #696 (parallelize engram loading), #334 (read engram rows ahead of prefill), #511 (issue — disk-Engram prefill leaves 3 of 4 ranks idle).
- None of the above touches NVFP4 engram geometry; none is competed with, superseded, or undone by #716.
- Reader-side tests already cover two row geometries generically,
(256,8)and(80,10). No(64,8)case exists anywhere in the repo outside the new decode test.
Recent activity
- The file's commit history is not queryable:
search_historyfails repo-wide withgit: Could not read c513e46a…, which also explains the orientation packet's "recent activity in those areas: not available". History must be inferred from merged PRs: #711 two days before this PR, #664 the same week from a different author, and #590/#566/#580/#539 over the preceding weeks. - #716 builds on #711 (it must, to compile) and on #590's PLE work. It reverses nothing.
People
- Author: lukealonso, COLLABORATOR, and one of the three contributors the charter names as priority (
@voipmonitor,@original-el8,@lukealonso). 48 merged PRs in 180 days, 0 closed, 1 open (this one). Area concentration:helios/src(33),docs(29),ignition/preparation(19). Recent series: #711, #709, #708, #707, #695, #684, #683, #670, #668, #667, plus the engram series #590/#583/#580/#539. This is the owner-level contributor for the area this PR touches. - Others active in this code: kbenkhaled (#664, single-plane engram), original-el8 (engram gathering, #470), jcartu (#714 test compile). No one has engaged with #716 yet.
Community
Nothing to report. Zero comments, zero reviews, no labels, no reactions. Opened and last updated within a minute of each other (2026-12-04 02:23/02:24). Discord handle lukealonso is present as the description template expects.
Project fit
- Charter line: "Keep the runtime small and model-agnostic… shouldn't accumulate per-model branches (#267, #334)." The change deletes a hardcoded model-specific width from the runtime in favour of the protobuf field the producer already emits, with no new flag, alias, or proto field. This is the direction the charter asks for.
- Charter: "PR descriptions: Expect four parts" — why, what changed, claimed result, evidence are all present, plus explicit limitations.
docs/design-review.md:163-169(not opened) requires theDiscord:line; it is there. - Charter: "New model recipes, aliases, or formats… must list supported checkpoints… prove they export and serve cleanly from the PR branch, and support more than a single checkpoint (#74)." #716 is not itself a recipe, but it exists only to serve Qwen4-35B-A3B, whose recipe is external (
hyperflare-recipes#154) and whose model is not in the in-tree official list (docs/model-preparation.md:317-327lists Qwen3.8 only). No export-and-serve proof is offered from the PR branch. - Charter: "Bug fixes need to address the root cause" — satisfied: the root cause (hardcoded 160) is identified and removed rather than worked around.
- Charter: "Bring real evidence" — partially: evidence is a
cargo check, not a served workload, and no reproducer core is attached. - Roadmap: "Engram & shared Engram tables (#267): A broader design, scoped as its own project." #267 is closed; this change sits inside the existing engram path rather than the scoped broader design, so it neither advances nor pre-empts that roadmap item.
- Documentation: no doc states the 160-wide geometry, so no doc update is implied — and none is made.
docs/core-format-design.md:91-102covers engram payload files and partitioned shards without geometry;docs/runtime-core-design.md:272-274only covers payload appending;helios/manifest.md:506-531covers bindings, prefetch mailbox and staging frames, not widths.
Claims and evidence
| Claim | What backs it |
|---|---|
Decoder hardcoded 160/80/10 for Nvfp4E4m3Global |
Verified: old arm at engram.rs:119-129 on main |
Qwen4 needs 128/64/8; metadata already carries embedding_width |
Field exists in the wire format and the exporter copies it (heliopause/src/export/core.rs:1674-1675); the 2048/16 = 128 arithmetic is consistent. Not verified against an actual Qwen4 core — none in the repo |
| 160-wide cores decode identically | Verified by arithmetic and by the retained NVFP4 test coverage. No replay of an existing binary core is reported |
| "Any other 16-aligned NVFP4 width" loads | Only if scale_block == 16 (line 145). Not stated in the description |
cargo check --locked --release --features runtime-core,server succeeds |
Claimed; not independently run here |
| New test runs once #714 lands | Consistent with #714's review. But this PR also fixes its own file's fixtures, so the residual blocker is only cache_memory.rs and other modules — a distinction the description does not draw |
| Companion PRs flashinfer#215, hyperflare-recipes#154 | External, unverifiable from this repo. No in-repo producer emits a 128-wide NVFP4 table |
| "No model-specific runtime branches" | Verified: the only remaining constants are the NVFP4 block size 16 and the untouched FP8 tuple |
Reach
- Who is affected: only cores carrying
NVFP4_E4M3_GLOBALengram tables. All existing 160-wide cores behave exactly as before; 128-wide (and any 16-aligned, block-16) widths now decode where they previously were rejected. FP8 cores are untouched. - Implicit behaviour change: widths that already failed still fail, with the same undifferentiated message, so the operator-facing error surface neither improves nor tells the operator what is wrong. A table with a 16-aligned width but
scale_block != 16still fails at line 145. - No proto/wire change, no schema change, no exporter change, no CLI flag, no default, no metric, no dependency change. Compatibility is purely additive, and the charter's "verify existing artifacts still load" direction is met by construction for 160-wide cores.
- Verification dependency:
.github/workflows/native-serving.yml(not opened) runscargo test … --features runtime-core,server, so CI on this head inherits the #711/#659 breakage regardless of this PR's own correctness; #714 onmainis required before the new test can actually execute in-tree. - New model surface implied: a Qwen4-35B-A3B serving path depends on a recipe in an external repo and on flashinfer#215 (
H=2048), so this PR is the smallest in-repo piece of a three-repo change.
Process
Ready for review (not a draft), one commit-range head d061454, one file, no labels, no reviewers requested, no reviews, CI pending at the time of the packet. Age at packet time: under a day. Author is a priority contributor and has no open PRs besides this one, which makes it a candidate for fast turnaround but also means no independent second reader has looked at it yet.
Open questions and what could not be found
- Does any 128-wide NVFP4 engram core actually exist? Nothing in-tree exports or contains one; the producer recipe (
hyperflare-recipes#154) and the kernel support (flashinfer#215) are external. Without one, neither the accept path nor the "160-wide decodes identically" claim has been demonstrated end-to-end. - Why is
scale_blockstill pinned to 16 whilewidthbecame dynamic? Ifembedding_widthis trustworthy metadata,scale_blockplausibly is too; the asymmetry is unexplained and is what narrows the "any width" claim. - Is a more specific error message wanted? The new guard rejects a shape of malformed input that previously produced a confusing "invalid global scale"-flavoured error, and still does.
- Merge order with #664, and with #714: #664 rewrites the same
matcharm and thePlanetype; #714 fixescache_memory.rs:1659. Whichever of #664/#716 lands second rebases this function; #714 is a prerequisite for the test to run. - Not found: any issue, discussion, Discord thread, or prior request motivating 128-wide engram tables; any documentation stating the NVFP4 engram geometry (so no doc is contradicted); any commit history for the file (
search_historyfails repo-wide onc513e46a).