Architecture report · NVIDIA/hyperflare-inference #229

Raw Markdown for agents: https://autobot.eidonix.com/p/2d09e566-0637-45f3-9d18-633664111324.md

Architecture and scope review — PR #229 (Muse Glimmer 30B NVFP4)

Key findings

main has moved past this PR's base. On 2026-11-22, commits da037284 and 17bb3c4a ("Remove extracted hyperflare_recipes, qualification drivers, and model tests from core Flare") deleted ignition/recipes/, ignition/reference/, qualify/, tests/recipes/, tests/qualify/, and cut ignition/components/ down to 13 Helios-ABI modules. Roughly 4,000 of this PR's 5,503 added lines land in those locations, and tests/preparation/test_core_boundary.py now asserts they are absent. original-el8's triage comment of 2026-11-24 asked for exactly this split; the head commit does not implement it.

Independently, the PR does not meet the charter's own bar for a new model recipe: nothing has been exported or served from this branch, no CUDA test has run on this base, and the recipe serves one checkpoint while deliberately rejecting the only other published one.

The runtime-side changes that remain in scope are mostly sound — the proto addition is additive, valid_processed loses its wildcard arms, the ModelOpt parser move to ignition/preparation/ is the right direction, and the resize.rs Filter refactor is real cleanup. The findings below are the ones that should still be fixed or decided once the recipe portion moves to hyperflare-recipes.


Blocking

B1. The recipe, reference, and model-test portion belongs in hyperflare-recipes, and lands in directories main deleted

Where: ignition/recipes/muse_glimmer_nvfp4/** (14 files, +1,681/−31, including ignition/recipes/__init__.py, ignition/recipes/gemma4/config.py, ignition/recipes/muse_spark/{contract,frontend}.py), ignition/reference/muse_glimmer.py (not opened) (+166), qualify/speculative_benchmark.py (not opened) + qualify/results/glimmer-c16/summary.json (not opened) (+77), tests/recipes/muse_glimmer_nvfp4/** (10 files, +1,926), tests/recipes/test_vision_scratch.py, tests/qualify/test_speculative_benchmark.py (not opened), tests/frontend/test_muse_glimmer.py (not opened).

What is wrong: on main, list_files with ignition/recipes/*, tests/recipes/*, qualify/*, tests/qualify/*, ignition/reference/* returns no files; repo_overview shows ignition/ at 110 files against 494 at the PR head. tests/preparation/test_core_boundary.py on main encodes the new boundary:

This PR's tree would fail that test outright.

Rules:

Why it matters: the head commit is a rebase onto 66b473c3 (2026-11-19), three days before the split. Merging would resurrect deleted directories and break the boundary test; keeping the PR open in this shape absorbs upstream churn in files upstream no longer has (the description itself records three conflict resolutions, the last forced by the runtime package rename and image-preparation = 10 being taken by padded-grid).

Fix: split as triage asked. This repository keeps: helios/proto/runtime_core.proto, helios/src/model/contract.rs, helios/src/runtime_core/{protobuf,describe}.rs, helios/src/frontend/images/* (conditioned, packing, record, resize, muse_glimmer, patch_merge), ignition/preparation/{frontend,checkpoint,quantization,runtime_core_pb2}.py and their tests. A linked hyperflare-recipes PR carries the recipe, ignition/recipes/muse_spark touches, reference module, qualification driver, and the model/CLI test rows.

B2. The recipe imports modules that do not exist on main

Where:

What is wrong: list_files "ignition/components/*" at ref=main shows 13 modules (capacity, collectives, completion, engram, flashinfer_sampling, logprobs, ngram_delivery, readiness, sampling, state, state_transfer, vision_delivery, vision_state) — the same set pinned at tests/preparation/test_core_boundary.py:11-26. Every module the recipe imports for its decoder, attention, and drafter is gone.

Why it matters: together with B1 this means the branch as pushed cannot import its own recipe on main. The PR description states the branch has not been exported or served and no CUDA test ran on this base, so nothing establishes that the tree still builds. This is a mechanical consequence of the split, not a defect in the model work — which is why the fix is the move, not a rewrite.

B3. The charter's new-recipe bar (#74) is unmet: no export/serve from the branch, one checkpoint

Where: the PR's central claim; ignition/recipes/muse_glimmer_nvfp4/recipe.py:57-63; ignition/recipes/muse_glimmer_nvfp4/config.py:63-73.

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:

original-el8's own triage comment agrees: "Exact-branch GPU capture, export and native serving remain untested here; fork measurements with different deferred-copy lowering do not qualify this branch."

Why it matters: this is the project's stated gate for new recipes; it is not a reviewer-invented rule. The single-checkpoint argument is technically good (the two checkpoints have incompatible layouts — 416 NVFP4 W4A4 decoder projections and a BF16 lm_head versus 180 FP8 + 213 NVFP4 W4A16 including lm_head), but it is an argument for a maintainer exception, and no maintainer has granted one.

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

B4. Two open PRs claim one alias, and the selection is undecided

Where: ignition/recipes/muse_glimmer_nvfp4/recipe.py:57 (alias="muse-glimmer-30b-nvfp4"); tests/cli/test_models.py alias list (also edited by PR #212).

What is wrong: PR #192 (open) registers the same alias muse-glimmer-30b-nvfp4 for nvidia/Muse-Glimmer-30B-NVFP4 @ 47818374 on GB300. Both checkpoints share the architecture (52 layers: 39 sliding-window, 13 full; hidden 6656; 32 query / 2 KV heads; vocab 202048) but not the quantization layout, and each recipe's checkpoint check rejects the other. This PR proposes that it keeps the alias and #192 takes a mixed-precision name, but the proposal is unanswered on the PR, and original-el8's triage says: "A maintainer decision is needed on checkpoint selection, shared recipe/frontend ownership and the supported context contract before these overlapping definitions merge."

The alias registry is a maintainer call, and it is coupled to B1/B3: if the recipe moves to hyperflare-recipes, the alias decision moves with it and must be made once, not twice.

Fix: land the alias decision (one alias, one checkpoint, named once) before either PR is merged, and note it in both descriptions. Whichever of #212/#229 merges second also rebases the tests/cli/test_models.py alias row.


Should fix

S1. Image packing is dispatched on a per-model enum, not on a layout

Where: helios/src/frontend/images/packing.rs:98-105:

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

What is wrong: a match on ImageLayoutKind — the identifier whose documented job is to select input packing — is overridden by a guard on model identity. ImagePreparationKind::MuseGlimmer is a per-model enum, and the same value Bracketed now means two different upload shapes (window segments plus reverse index, versus the patch-merge tensors). The two arms differ in their layout contract, not in any model property.

Rules:

Fix: give the windowed layout its own ImageLayoutKind value (ClassToken = 10 is the last; there is room) so packing::prepare matches on layout alone and neither arm tests a model name — or make both layouts expressible through one shared packing driven by whether the prepared geometry carries window segments and a reverse index. Note that the PR description does not disclose this second per-model dispatch; it discusses only the proto addition.

Related and worth the same look: the new muse_glimmer.rs sets cu_window_seqlens/reverse_index, while the other image frontends (deepseek4, moonvit, radio, step, patches) pass vec![] for them; the layout, not the model, is what should determine that.

S2. The prepared-image record version is bumped with no reader for the old format

Where: helios/src/frontend/images/record.rs:73 (write(b"FLAREIMG\x02")) and :116 (if reader.take(9)? != b"FLAREIMG\x02" { return Err("invalid prepared image record version") }); encoded_len prefix at :58 becomes 9 + 8*8; the only test touching the version is conditioned.rs:845 (b"FLAREIMG\x02" in the malformed-record case).

What is wrong: every prepared-image record written by an earlier engine becomes undecodable. The path is PreparedImageInput::materialize_cached (conditioned.rs:155-167), which calls ProcessedImages::decode and, on failure, store.invalidate(self.identity) and re-materializes. So the practical effect is a silent cache drop, not a crash — but it is a disk/host state compatibility break that the description does not disclose. The description's compatibility paragraph covers only the core protobuf ("cores exported before it load and serve unchanged").

Rules: AGENTS.md:431-444 ("Every engine version must load models supported by previous engine versions… Retain readers and tests needed by existing cores"); docs/design-review.md:103-110 (principle 13) — the same principle, and prepared-image records live in the Selene input store (flare_selene::input::InputStore), which survives an engine upgrade.

Fix: the v1 layout is exactly the v2 layout minus the two trailing counts, so keep decoding FLAREIMG\x01 with the two new vectors empty, write only \x02, and extend the existing record test with a v1 payload. If dropping them is intended, say so in the description's compatibility paragraph; either way this should not be silent.

S3. The shared checkpoint index check now accepts two different quantities

Where: ignition/preparation/checkpoint.py:396-404:

# Transformers writes the tensor payload sum; the ModelOpt exporter writes the shard file-size sum.
payload = sum(tensor.nbytes for tensor in tensors.values())
files = sum(shard.file_size for shard in shards)
if (not isinstance(index.get("metadata"), dict)
        or index["metadata"].get("total_size") not in (payload, files)):
    raise CheckpointError("index total_size matches neither the tensor payload bytes ... nor the indexed shard file bytes ...")

What is wrong: before, the check compared total_size against the tensor payload only. It is a model-agnostic check run for every indexed checkpoint, so loosening it to "either of two numbers that are never equal" weakens an invariant for all models, on the strength of one exporter's behaviour. _read_header (:241-249) already walks every tensor range with no hole or overlap and asserts end == size, so files is already fully pinned by shard metadata and the accepted number carries no new information about whether weight_map covers it.

Rules: AGENTS.md:177-181 ("Reject weakened guarantees… Do not remove validation, suppress errors… or relax references"); docs/design-review.md:122-133 (principle 15, "Reject changes that bypass validation… weaken numerical or lifetime contracts") and :73-76 (principle 9).

Status of the test: tests/preparation/test_checkpoint_source.py does cover it — the new test_index_total_size_accepts_payload_or_shard_file_bytes checks the payload form, the file-byte form, and that payload + 1 raises with both numbers in the message. So the behaviour is pinned; the objection is architectural, not about test coverage.

Fix: narrow the arm to the exporter rather than accepting either number. Since the shard header is already parsed, the loader can require the ModelOpt form only when the index declares it (or compare against sum(shard.file_size) documented once as the ModelOpt form and reject cross-forms), so a genuinely wrong index is still caught. Keeping the test as written and adding a wrong-map case where total_size == files but the tensors do not cover a shard would show the difference.

S4. Fork-measured numbers are presented as this branch's measurements

Where: ignition/recipes/muse_glimmer_nvfp4/recipe.py:49-51 — _GRAPH_BYTES = 6_226_612_060 with the comment "Export VRAM inventory (gb202-tp1-202611080045 at --max-concurrency 16): graph scratch pools 2,870.81 MiB + capture pool 1,126.00 MiB + disposable vision arena 843.03 MiB + other owned tensors 1,008.16 MiB + graph I/O 90.16 MiB"; :59-62 (stored_bytes, device_bytes, expansion_bytes, draft_bytes with the "export inventory's 28,885.60 MiB" comment); :77-78 (RankCosts(62_914_560, 851_968, _GRAPH_BYTES)); and the matching sentences in docs/model-preparation.md's new Muse Glimmer section.

What is wrong: the description states these come from cores built from Raydius/flare-local-inference branch deploy, before the forwards moved to per-call metadata and with a different deferred-copy lowering; nothing on this branch was exported. The description is honest; the code comment and the docs page read as measurements of this tree. These numbers feed RankCosts, which shared memory planning consumes, so a stale graph_bytes silently changes the page budget the docs quote ("57.3 GiB / 9,076,736 tokens").

Rules: docs/design-review.md:94-102 (principle 12: "report evidence honestly… disclose unrun checks and material limitations"); docs/design-review.md:137-152 (principle 16, 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 re-export on the branch and regenerate. The recipe's own tests (tests/recipes/muse_glimmer_nvfp4/test_config.py (not opened), test_preparation.py (not opened)) only pin whatever is declared, so they cannot detect drift from a real export.

S5. A duplicated Muse Spark attention module, kept alive by an interface mismatch the PR could close

Where: ignition/recipes/muse_glimmer_nvfp4/attention.py (215 lines) against ignition/recipes/muse_spark/attention.py (194 lines). They differ in: per-call metadata versus construction-bound self.metadata (lines 165-204 versus spark 135-181); a separate weights.gate projection (:98-99) instead of splitting the fused qkv_gate; the gate multiplying the raw attended value (gated = attended * torch.sigmoid(...), :203) where Muse Spark applies head_norm first (spark :179); and forward-local torch.empty staging in _stage (:160) versus retained self.staged_key/value.

What is wrong: the PR's justification is real — Muse Spark's attention binds metadata and scratch at construction, so a per-call caller cannot use it, and ignition/recipes/muse_spark/attention.py is left unchanged. But the result is two copies of the same gated-attention mechanism in the tree, with docs/TODO.txt deferring the fold-back, and config.py:14 importing AttentionGeometry from muse_spark.config — a recipe importing another recipe's internals precisely because there is no shared component.

Rules: AGENTS.md:376-379 ("Shared… projections, collectives, and state transfers are examples of mechanisms that should not be copied between recipes"); AGENTS.md:183-188 ("Reject unsupported abstractions and churn… Refactoring must directly support the requested behavior"); AGENTS.md:359-366 ("When a potential… deficiency appears in one model, inspect the shared components and equivalent paths in every supported recipe before scoping the fix"); docs/design-review.md:31-37 ("replace the smallest coherent module needed").

Why it matters now: every other recipe has migrated to per-call metadata, so Muse Spark's construction-bound attention is the outlier, not the norm the new recipe must work around. Moving Muse Spark's attention to per-call metadata — which is what this PR says it wants — removes the duplicate, removes the cross-recipe import, and removes the TODO.

Fix: either fold the attention as part of this work, or state explicitly in the hyperflare-recipes PR that the duplication is accepted there with an owner and a removal condition. The same class, smaller: ignition/recipes/muse_glimmer_nvfp4/draft_config.py:16-77 re-derives what ignition/components/dflash2_geometry.py (not opened)'s DFlash2Config.from_dict already parses (the PR says so itself).


Nits

N1. The per-model docs section belongs in the hyperflare-recipes docs page. docs/model-preparation.md on main ("## Official model recipes") delegates every per-model export command and qualification note to local-inference-lab/hyperflare-recipes/docs/model-preparation.md. A new ~68-line Muse Glimmer section in the runtime guide contradicts that structure and AGENTS.md:263-266 ("Model-specific launch instructions live in hyperflare-recipes"), and it lists an alias that exists nowhere on main. The 1,048,576-token reasoning in it (39 sliding layers bounded at 2048; 13 full-context layers with no positional encoding, so the window is page-bound, native context 131,072) is a genuine architecture fact about the shared checkpoint family and worth keeping wherever the recipe lands — it is checkpoint-independent, as the PR correctly notes for #192. The docs/TODO.txt entry is a legitimate home for the deferred fold-back per AGENTS.md:511-517, but becomes moot if the recipe moves.

N2. modelopt_nvfp4_layers overstates what it validates. The moved shared parser (ignition/preparation/quantization.py) checks 4-bit group-16 weights only; Muse Glimmer separately checks 4-bit group-16 input activations (config.py:63-69). A W4A16 checkpoint would pass the shared parser and be rejected only by the recipe. Acceptable, but the shared function's name implies more than it enforces, and the description's claim that errors name "the ModelOpt configuration" is only loosely true of the bare ValueError strings.

N3. resize.rs Filter enum. Filter{Cubic, Linear, Lanczos} replacing the (pillow, linear) boolean pair is a genuine cleanup rather than a new mechanism, and the antialiased Lanczos weights match PyTorch's kernel. No action; recorded so a second reviewer does not re-open it.


Verified clean (so they are not re-reviewed)

  1. The proto/core-format addition is genuinely additive. helios/proto/runtime_core.proto appends MUSE_GLIMMER_IMAGE_PREPARATION = 11 after PADDED_GRID_IMAGE_PREPARATION = 10 and adds MuseGlimmerImageSettings muse_glimmer = 11 as a new oneof member with fresh field numbers; helios/src/model/contract.rs:68 appends MuseGlimmer = 11 consistently. No identifier removed or renumbered. An engine without the change refuses such a core with "missing protobuf image profile" via the new Profile::MuseGlimmer arms in runtime_core/protobuf.rs:174+ and describe.rs:285+. Satisfies AGENTS.md:431-444 and docs/design-review.md:103-110.
  2. conditioned.rs valid_processed is improved, not loosened. The wildcard _ => arms are replaced by exhaustive matches over every Profile, and the new settings() test builds one variant of each of the 11 ImageSettings and asserts full coverage. No default arm remains. (It does not address S1, which is in packing.rs.)
  3. ignition/preparation/frontend.py image_settings gains a muse_glimmer profile in the existing per-profile shape with explicit _expected validation (patch 14, merge 2, temporal 2, max_image_tokens 4096, mean/std, resample 1, token ids), no environment variables and no per-model booleans — consistent with docs/design-review.md:77-87 (principle 10).
  4. The ModelOpt parser move to ignition/preparation/quantization.py is the right direction: Gemma 4 now calls shared code and the error text no longer names Gemma 4 (see N2 for the residual naming).
  5. tests/preparation/test_frontend_metadata.py muse_spark top_p 0.95 → 1.0 is a correct fix — the recipe already declares SamplingDefaults(temperature=1., top_p=1., top_k=-1) (muse_spark/recipe.py:51); the expectation was wrong on main.
  6. qualify/speculative_benchmark.py (not opened)'s [124]→[0-9]+ and [1-8]→[0-9]+ are correct widenings, and tests/qualify/test_speculative_benchmark.py (not opened) pins batch 1 and batch 16. qualify/ does not exist on main (B1), so this belongs in the recipes repository.
  7. No CUDA/PTX/CuTe/Triton changes. The PR claims no kernel changes and the file list confirms it (no .cu, .ptx); docs/design-review.md:111-121 (principle 14) is therefore not engaged.
  8. tests/recipes/test_vision_scratch.py's disclosed gap — that it no longer checks pool reuse across capacities for any recipe on main — is stated in the description as a limitation, not hidden.

Coverage and open questions

Read in full or in context: the charter; AGENTS.md (contribution scope and rejection criteria, architecture and ownership, core compatibility, configuration, validation and evidence); docs/design-review.md (all 17 principles); docs/model-development.md:1-40; docs/model-preparation.md on main; the full PR discussion; the diff hunks for ignition/preparation/{quantization,checkpoint,frontend}.py, ignition/recipes/{__init__,gemma4/config,muse_spark/contract,muse_spark/frontend}.py, helios/proto/runtime_core.proto, helios/src/model/{contract,tests}.rs, helios/src/runtime_core/{describe,protobuf}.rs, helios/src/frontend/images/{conditioned,mod,record,packing,resize,patch_merge}.rs, tests/cli/*, tests/preparation/test_frontend_metadata.py, tests/preparation/test_checkpoint_source.py, docs/*, and the Muse Glimmer recipe files recipe.py, config.py, attention.py, contract.py, decoder.py, dflash.py, draft_config.py, frontend.py.

Not read (nothing above rests on them): ignition/recipes/muse_glimmer_nvfp4/{bootstrap.py (not opened), vision.py (not opened), vision_state.py (not opened), weights.py (not opened), model.py (not opened), assets/chat_template.patch.json (not opened)}; ignition/reference/muse_glimmer.py (not opened); tests/recipes/muse_glimmer_nvfp4/*; tests/frontend/test_muse_glimmer.py (not opened); tests/qualify/test_speculative_benchmark.py (not opened); tests/preparation/test_quantization.py (not opened); qualify/results/glimmer-c16/summary.json (not opened); and the interiors of helios/src/frontend/images/{deepseek4,moonvit,radio,step,patches}.rs (only their empty cu_window_seqlens/reverse_index additions were confirmed by search). Under B1 most of these move anyway.

Open questions for whoever takes this forward:

  1. Will a maintainer grant the #74 exception for a single supported checkpoint (the two published checkpoints have incompatible quantization layouts), or must a second checkpoint be supported? This determines whether B3 is fixable at all, and it overlaps #192.
  2. Which PR keeps the alias muse-glimmer-30b-nvfp4? (B4; coupled to question 1.)
  3. Is dropping cached FLAREIMG\x01 prepared-image records acceptable, or is a v1 reader required? (S2 — a cheap change either way, but it needs a decision, not silence.)
  4. Does the maintainer want the Muse Glimmer image profile and the packing change to land in this repository ahead of the recipe PR, so the runtime half is reviewable and landable on its own? That would make B1/B2 a split rather than a rejection.