Architecture scratchpad · NVIDIA/hyperflare-inference #229

Raw Markdown for agents: https://autobot.eidonix.com/p/b4eb04f5-4569-40b5-987b-811b9ddeba57.md

#1 [high] Blocking: recipe/model-test portion belongs in hyperflare-recipes; main deleted ignition/recipes

Base main = 66b473c3 (2026-11-18). MAIN HAS MOVED: commits da037284 + 17bb3c4a (Luke Alonso, 2026-11-22, "Remove extracted hyperflare_recipes, qualification drivers, and model tests from core Flare") deleted:

Verified by list_files ref=main: ignition/recipes/*, tests/recipes/*, qualify/*, tests/qualify/*, ignition/reference/* → "No files match". repo_overview ref=main: ignition/ has 110 files vs 494 at PR head; tests/ 399 vs 798.

Rules that make this blocking:

PR files that violate it (out of 65 files, +5503 lines):

original-el8 already made this call in the 2026-11-24 triage comment on the PR: "Repository-split triage: this PR spans both repositories... hyperflare-recipes: the Muse Glimmer recipe, model components, and model qualification tests. This runtime repository: the native image frontend, runtime protocol, and shared checkpoint/preparation changes. The recipe portion needs a linked PR against the hyperflare_recipes/ package." The head commit is dated 2026-11-07 (rebased 2026-11-19 onto 66b473c3) and does not contain the split. So the PR is stale against main and its majority is out-of-tree.

#2 [high] Blocking: recipe imports modules that no longer exist on main (ignition/components/*)

ignition/components/ on main keeps only: capacity, collectives, completion, engram, flashinfer_sampling, logprobs, ngram_delivery, readiness, sampling, state, state_transfer, vision_delivery, vision_state (tests/preparation/test_core_boundary.py:11-26 RETAINED_IGNITION_COMPONENTS).

The new recipe imports modules that no longer exist there:

Confirmed by list_files pattern "ignition/components/*" ref=pr/229 (full 100+ modules at PR head) vs ref=main (13 modules). So even the runtime-side leftovers cannot import on main.

The PR description already records that the branch has not been exported or served and no CUDA test ran on this base, so nothing here establishes that the tree still builds on main.

Also worth noting for the reviewer: the PR description's "Overlaps and follow-ups" and docs/TODO.txt entries about folding attention/draft_config back are follow-ups that assume the recipe stays in this repository.

#9 [high] Blocking: new-recipe bar (charter #74) unmet — no export/serve from branch, single checkpoint

Finding (evidence, should fix): the PR description's central claim is unqualified on this branch, and it is the charter's stated bar for a new model recipe.

Charter (read_charter, "What gets merged"): "New model recipes, aliases, or formats: Must list supported checkpoints from an official or widely used source, prove they export and serve cleanly from the PR branch, and support more than a single checkpoint (#74)."

Against that bar:

What would settle it: one ignition export muse-glimmer-30b-nvfp4 --gpus 0 on an SM120 host at the PR head, flare run on that core with a text request and an image request, the printed Allocate cache line, and the four CUDA tests with FLARE_RUN_CUDA_TESTS=1. Also state whether a second supported checkpoint (or a declared rejection reason accepted by a maintainer under #74) exists.

Note this is not the reviewer inventing a rule: original-el8's triage comment on the PR itself says "Exact-branch GPU capture, export and native serving remain untested here; fork measurements with different deferred-copy lowering do not qualify this branch."

#11 [high] Research summary

Reviewed PR #229 through the architecture-and-scope lens, against the charter, AGENTS.md, docs/design-review.md (17 principles) and docs/model-development.md. Ten findings recorded in the scratchpad; three are blocking.

The decisive finding is structural: main has moved past this PR's base (66b473c3). Commits da037284 and 17bb3c4a ("Remove extracted hyperflare_recipes, qualification drivers, and model tests from core Flare") deleted ignition/recipes/, ignition/reference/, qualify/, tests/recipes/ and tests/qualify/, and cut ignition/components/ to the 13 Helios-ABI modules — which tests/preparation/test_core_boundary.py now asserts. About 4,000 of this PR's 5,503 added lines land in those deleted locations, and the recipe imports ignition.components.linear/paged_attention/window_attention/mlp/vocabulary/dflash2_preparation, none of which exist on main. original-el8's 2026-11-24 triage comment already asked for exactly this split, and the head commit does not implement it. The second blocking item is the charter's own new-recipe bar (#74): export and serving from the branch have not been done, no CUDA test has run on this base, and the recipe serves one checkpoint while deliberately rejecting the other published one.

Beyond scope, the runtime-side changes reviewed are mostly sound: the proto addition is properly additive, valid_processed drops its wildcard arms and gains an exhaustive-coverage test, the ModelOpt parser move into ignition/preparation/ is the right direction, and the resize.rs Filter refactor is a real cleanup. I recorded the clean items so they need not be re-reviewed. The remaining findings are a per-model dispatch in packing.rs gated on ImagePreparationKind::MuseGlimmer rather than on layout, a FLAREIMG\x01→\x02 record bump with no reader for old records, a loosened total_size check, fork-measured memory numbers presented as this branch's, the duplicated Muse Spark attention module, and the per-model docs section's placement. Two items need follow-up reading before the review is finalised: the tests/preparation/test_checkpoint_source.py (not opened) hunk and whether any test covers the record-version question.

#13 [high] Review coverage: what was read, what was not, and the two open questions

Honest coverage statement for the report. Time ran out before every changed file was read in full; this is what was actually inspected, so the report does not overclaim "every changed file read in context".

READ in full or in context through this lens:

NOT read (so nothing in the report rests on them; if a maintainer wants them covered, they remain open):

Two questions a follow-up reviewer can settle quickly:

  1. Does tests/preparation/test_checkpoint_source.py pin both accepted total_size forms (finding 3)?
  2. Does anything test that an old FLAREIMG\x01 prepared-image record is handled (finding 5)? The PR only shows the version string being bumped in the malformed-record test (conditioned.rs:845).

#3 [medium] Should fix: checkpoint index total_size accepts two different quantities

Finding (architecture/scope, should fix): ignition/preparation/checkpoint.py:396-404 (PR diff of _inspect_indexed_checkpoint).

Before: total = sum(tensor.nbytes for tensor in tensors.values()) and index["metadata"]["total_size"] != total → CheckpointError. After: appears in coordinates out of place in _inspect_indexed_checkpoint.

Verification done in code:

Rules cited:

Fix: if the ModelOpt exporter really writes the shard file-byte sum, say so at the acceptance point with a value the shard metadata already proves, e.g. compare against sum(shard.file_size) documented once and add the checkpoint/source test that pins both accepted forms; or narrow the arm to the one exporter by a property the loader can verify rather than accepting either number. Note: tests/preparation/test_checkpoint_source.py is modified by this PR (+16/-3) but I ran out of time to read that hunk — whoever finalises this review should read it before asserting the test covers the relaxation.

#4 [medium] Should fix: packing.rs selects Muse Glimmer packing by a per-model enum, not by layout

Finding (architecture/scope, should fix): helios/src/frontend/images/packing.rs:98-113 (PR diff) adds a dispatch arm keyed on model identity, not on layout:

ImageLayoutKind::Bracketed
    if config.contract.frontend.image_preparation == Some(ImagePreparationKind::MuseGlimmer) =>
{ muse_glimmer(...) }
ImageLayoutKind::Bracketed => bracketed(...)

Rules:

The two arms differ in what tensors they upload (window segments + reverse index vs the patch-merge tensors), i.e. in the layout contract, not in a model property. The gating enum is ImagePreparationKind::MuseGlimmer, exactly a per-model identifier, and the same file at line 105 keeps ImageLayoutKind::Bracketed meaning temporal patch-merge. So Bracketed now means two different things and the discriminator is the model enum.

Fix consistent with the rules: either give the windowed layout its own ImageLayoutKind value (the enum has room after ClassToken = 10, and ImageLayoutKind is the identifier whose documented job is to select input packing), or make the two layouts expressible through one shared packing driven by whether the prepared geometry carries window segments/reverse index. Then packing::prepare matches on layout alone and neither arm tests a model name.

Note the PR description does not disclose this second per-model dispatch; it only discusses the proto addition.

#5 [medium] Should fix: prepared-image record version bump drops old cached records without a reader

Finding (compatibility, should fix / needs decision): helios/src/frontend/images/record.rs bumps the prepared-image record version FLAREIMG\x01 → FLAREIMG\x02 (lines 73, 116) and adds two fields. decode rejects any other version:

if reader.take(9)? != b"FLAREIMG\x02" { return Err("invalid prepared image record version".into()); }

Consequence: every prepared-image record written by an older engine is unreadable by this engine. Path: PreparedImageInput::materialize_cached (conditioned.rs:155-167) calls ProcessedImages::decode; on failure it calls store.invalidate(self.identity) and re-materializes. So the cache entry is silently dropped and recomputed rather than served.

Relevant rules:

This may be acceptable (a cached decode is a cache miss, not a correctness break), but it must be stated, and a reader for version 1 is cheap: the v1 layout is exactly the v2 layout minus the two trailing counts. Fix: keep FLAREIMG\x01 decoding (zero the two new vectors) and only write \x02, with the existing malformed-record test extended to a v1 payload; and add one line to the description's compatibility paragraph.

Related, in the same file: encoded_len bumps the fixed prefix from 9 + 6*8 to 9 + 8*8 (line 58) — correct for the two new counts, but worth a glance that nothing else sized records from the constant.

#6 [medium] Should fix: recipe/docs cite fork-measured memory numbers as if measured on this branch

Finding (evidence/scope, should fix): ignition/recipes/muse_glimmer_nvfp4/recipe.py:49-51, 62, 77-78 and docs/model-preparation.md (Muse Glimmer section) declare measured-looking numbers whose provenance does not qualify this branch.

Rules: docs/design-review.md principle 12 "Validate the real path and report evidence honestly… disclose unrun checks and material limitations" (97-105); principle 16 (137-152) reject unexplained references/unsupported claims in changed prose; AGENTS.md:55-60 "State support as present qualification: what is implemented, the hardware and configurations on which it is qualified, and what is not qualified. Record unresolved defects, unrun checks, and pending measurements in docs/TODO.txt".

Fix: qualify the comment and the docs sentence ("measured on a fork core before the per-call forwards; not re-measured here"), or export the core on the branch and regenerate both. These numbers feed RankCosts, which shared memory planning consumes (Recipe.costs, declaration.py:310-317), so a stale graph_bytes silently changes the page budget the docs quote ("57.3 GiB / 9,076,736 tokens").

Also: tests/recipes/muse_glimmer_nvfp4/test_config.py / test_preparation.py are the only checks that pin these; they pin whatever the recipe declares, so they cannot detect drift from a real export.

#7 [medium] Nit/Should fix: duplicated Muse Spark attention module and cross-recipe imports

Finding (scope/duplication, nit → should fix given the split): ignition/recipes/muse_glimmer_nvfp4/attention.py is a 215-line near-copy of ignition/recipes/muse_spark/attention.py (194 lines), differing only in:

The PR's own justification is that Muse Spark's attention binds metadata/scratch at construction, so a per-call caller cannot use it (docs/TODO.txt new entry; PR description "The recipe carries its own attention module instead of widening Muse Spark's"). That is a real interface mismatch, but it means the repository now carries two copies of the same gated-attention mechanism, and docs/TODO.txt records the fold-back as deferred.

Rules: AGENTS.md:188-193 "Reject unsupported abstractions and churn… Refactoring must directly support the requested behavior"; docs/design-review.md principle 3 "Preserve canonical model semantics and shared mechanisms… replace the smallest coherent module needed"; AGENTS.md:365-372 "When a potential … deficiency appears in one model, inspect the shared components and equivalent paths in every supported recipe before scoping the fix. Track follow-up work across all affected models".

Given main's per-call-metadata migration (commits "Let Inductor plan model temporary storage" etc. moved every other recipe to per-call metadata), Muse Spark's construction-bound attention is now the outlier, and the coherent fix is to move Muse Spark's attention to per-call metadata and have both recipes use it — which is also what the PR says it wants. Deferring it leaves a duplicated implementation in the tree with no owner.

Same class, smaller: ignition/recipes/muse_glimmer_nvfp4/draft_config.py:16-77 re-derives what ignition.components.dflash2_geometry.DFlash2Config.from_dict already parses (the PR says so itself); ignition/recipes/muse_glimmer_nvfp4/config.py:14 imports AttentionGeometry from muse_spark.config, i.e. a recipe importing another recipe's internals rather than a shared component — the cross-recipe import is exactly what extracting the duplicate would remove.

Under the repository split (findings 1-2) these files move to hyperflare-recipes anyway, so the reviewer's concrete ask is: fold the attention before the move, or state in the hyperflare-recipes PR that the duplication is accepted there.

#8 [medium] Verified-clean / acceptable items so they are not re-reviewed

Verified-clean or acceptable-on-scope items, so the next reviewer does not redo them.

  1. Proto/core format addition is genuinely additive and matches the claimed reasoning.

    • helios/proto/runtime_core.proto: MUSE_GLIMMER_IMAGE_PREPARATION = 11 appended after PADDED_GRID_IMAGE_PREPARATION = 10; ImageSettings.muse_glimmer = 11 new oneof member; new MuseGlimmerImageSettings message with fresh field numbers. No field or enum value removed or renumbered.
    • helios/src/model/contract.rs:68: contract_enum!(ImagePreparationKind { … PaddedGrid = 10, MuseGlimmer = 11 }) — appended, consistent.
    • An engine without the change refuses such a core with "missing protobuf image profile" (matches new Profile::MuseGlimmer arm in runtime_core/protobuf.rs:174+ and describe.rs:285+). Satisfies AGENTS.md "Model core compatibility" (431-444) and design-review principle 13.
  2. helios/src/frontend/images/conditioned.rs valid_processed (PR diff, lines 183-240): the wildcard _ => arms are replaced with exhaustive matches listing every Profile, and the new test settings() builds one of every ImageSettings variant and asserts all 11 are covered (covered = [false; 11]). This is a genuine improvement in the direction the rules ask for (a wildcard previously sized PatchMerge at 588 and rejected every materialization). No default arm remains at those two matches. Note it does not remove the identity coupling in packing.rs (see finding 4).

  3. ignition/preparation/frontend.py image_settings gains a muse_glimmer profile with explicit _expected field validation (patch 14, merge 2, temporal 2, max_image_tokens 4096, mean/std, resample 1, model_type, image_token_id 200092, video_token_id 200091, vision_config geometry). Matches the existing per-profile shape of the shared parser; no environment variables, no per-model boolean flags. Consistent with design-review principle 10 (explicit configuration; persist only consumed structural frontend settings).

  4. ignition/preparation/quantization.py matches_pattern / modelopt_nvfp4_layers moved out of ignition/recipes/gemma4/config.py into shared ignition/preparation/. This is the right direction (shared parser, Gemma 4 calls it, errors no longer name Gemma 4). Two notes: (a) the moved function raises bare ValueError messages that mention neither the recipe nor the checkpoint — Gemma 4 previously said "Gemma 4 NVFP4 …"; the PR description claims errors now name "the ModelOpt configuration", which the code does only loosely ("expected modelopt NVFP4 quantization_config"); (b) Muse Glimmer checks its 4-bit group-16 input activations itself before calling the parser (config.py:63-69) — the shared parser never validates input_activations, so a checkpoint with W4A16 would be accepted by the shared parser and only rejected by the recipe. Acceptable, but it means the shared parser's name ("modelopt_nvfp4_layers") overstates what it validates.

  5. qualify/speculative_benchmark.py [124] → [0-9]+ and heuristically the widened classes are correct, but qualify/ does not exist on main, so this change has no home here (see finding 1).

  6. tests/preparation/test_frontend_metadata.py muse_spark top_p 0.95 → 1.0: the recipe already declares SamplingDefaults(temperature=1., top_p=1., top_k=-1) (muse_spark/recipe.py:51), so the expectation was wrong on main. Correct fix.

  7. helios/src/frontend/images/resize.rs: Filter enum replaces the (pillow, linear) boolean pair, with Cubic, Linear, Lanczos. This is a cleanup of existing call sites, not a new mechanism; the lanczos3 support and weight functions match PyTorch's antialiased kernel. The PR claims no CUDA/PTX/CuTe/Triton change, which holds for the diff I read (git-level: no .cu/.ptx files in pr_files).

  8. tests/recipes/test_vision_scratch.py adds one row. The PR's own "Limitation" says the test no longer checks pool reuse across capacities for any recipe on main — stated, so it is a disclosed gap rather than a hidden one.

#12 [medium] PR state, alias collision with #192/#212, and contributor-respect framing

Context for the report's framing (from the orientation packet and pr_comments):

Alias collision (scope-relevant, alongside finding 9):

Rebase history the report should not have to rediscover: conflicts were resolved three times (91cfb369, d2b5c5f3, then 66b473c3 where the runtime package was renamed to runtime core and image-preparation number 10 was taken by padded-grid, forcing the profile to 11). That is the direct consequence of the repository split in finding 1: this PR keeps absorbing upstream churn in files that upstream has since deleted.

#10 [low] Nit: per-model docs section belongs in hyperflare-recipes docs

Finding (docs/rules consistency, nit): docs/model-preparation.md new "Muse Glimmer 30B" section (PR diff, ~+68 lines) puts a per-model recipe section in the runtime repository's preparation guide, and lists an alias that exists nowhere on main.

Fix: leave the alias list and export commands to the hyperflare-recipes docs page; in this repository keep only the parts that belong to the runtime (nothing here changes runtime behaviour except the image profile and the proto field).