Conventions scratchpad · NVIDIA/hyperflare-inference #229

Raw Markdown for agents: https://autobot.eidonix.com/p/2b2f1c37-f326-4d5c-ab6e-73120ef5e58e.md

#1 [high] Research summary

Conventions-and-duplication review of PR #229 (all changed files read in context against their closest precedents: muse_spark, nemotron_h, qwen38_dense, gemma4, patch_merge, and the shared ignition/components/*). Findings, in severity order.

Should fix

  1. helios/src/frontend/images/packing.rs:98-105 — graph input packing is now selected by ImageLayoutKind::Bracketed and ImagePreparationKind::MuseGlimmer. Every other arm dispatches on image_layout alone, and AGENTS.md ("Architecture and ownership") states image-preparation/layout identifiers "cannot select scheduling, cache policy, text-graph input packing, or completion behavior". ImageLayoutKind exists precisely to select the staged tensor set (tensor_layout, packing.rs:16-83); adding arm (Bracketed, "vision_cu_window_seqlens") at :69 also makes two different checksum sets share one layout id. Fix: give Muse Glimmer its own additive ImageLayoutKind value and dispatch on layout only, as PatchMerge/ClassToken do.

  2. ignition/recipes/muse_glimmer_nvfp4/recipe.py:72 — the recipe ships a real z-lab DFlash2 drafter through DFlash2Preparation but leaves Speculation.method unset. The established precedent for exactly this drafter (ignition/recipes/qwen38_dense/recipe.py:68 (not opened), method="dflash2") sets it, and the field is load-bearing: ignition/planning.py:451-475 gates --speculative-method and --draft-body-quantization, :574 gates mixed prefill on method == "dflash2", helios/src/runtime_core/protobuf.rs:22-30 (effective_draft_body_quantization) does nothing for a method-less DFlash2 spec, and ignition/cli/serve.py:314 (not opened) drops the "DFlash2 proposals" label. Muse Spark has the same defect; this PR should not replicate it. Fix: declare method="dflash2" (or state in docs/TODO.txt why both Muse recipes leave it unset).

  3. qualify/results/glimmer-c16/summary.json (new, 76 lines) — a one-off run artifact committed to the tree. main has no results/ directory at all, no other recipe carries such a file, and its fields (admitted_delta, rounds_batch16_width16, accepted_per_request_round) appear nowhere else in the repository, so no in-repo harness produces or consumes it; the schema does not match qualify/speculative_benchmark.py's measurements.json (not opened) (run() at :486-540). It also records a core built from the fork, which this branch cannot reproduce (the PR description says so). AGENTS.md asks for raw measurements "with their configuration" but also forbids development audit artifacts; the numbers are already in the description. Fix: drop the file, or land it as output of a documented harness with the configuration alongside.

  4. ignition/recipes/muse_glimmer_nvfp4/draft_config.py:16-77 re-derives DFlash2Config (identical layers, target_layers, block_size, noise_token, attention, validate_shard, same DraftAttentionGeometry import) from ignition/components/dflash2_geometry.py:27-101. The current precedent for a pinned drafter is ignition/recipes/qwen38_dense/draft_config.py:1-25, a 25-line file that delegates via DFlash2Config.from_dict(..., expected=PROFILE); the shared reader already performs the pinned-geometry, tap-ordering and mask-range checks this copy spells out. The PR records the attention fold-back in docs/TODO.txt but not this one, contrary to the AGENTS.md "Task tracking" rule. Fix: delegate to the shared reader, or add the matching TODO entry.

Nits

  1. ignition/recipes/muse_glimmer_nvfp4/attention.py:61-63 copies muse_spark/attention.py:57-59 verbatim while ignition/components/head_norm_rope.py:38 (not opened) already exposes a prepared head-norm; attention.py as a whole (215 lines) and model.py:9-40 duplicate Spark's modules. Both are recorded in the new docs/TODO.txt entry, so the convention is met — noting so the duplication is not lost.

  2. ignition/recipes/muse_glimmer_nvfp4/decoder.py:69-70 is a third tanh(x·mult/softcap)·softcap: gemma4/decoder.py:21-23 (not opened), muse_spark/decoder.py:195-202 (SoftcappedProjection), and inline at ignition/components/dflash2.py:379 (not opened),551. A single shared helper would cover all four.

  3. ignition/recipes/muse_spark/config.py:18-31 AttentionGeometry and ignition/components/dflash2_geometry.py:11-24 DraftAttentionGeometry are field-for-field identical, including local(shard); Muse Glimmer imports the former (config.py:14) and uses the latter for its drafter (draft_config.py:10). Pre-existing duplication, extended here.

  4. ignition/recipes/muse_glimmer_nvfp4/recipe.py:44-46 is gemma4/recipe.py:118-120 copied character-for-character (third copy of usage(); nemotron_h/recipe.py:41-42 uses the single-rank form).

  5. ignition/recipes/muse_glimmer_nvfp4/frontend.py:25-29 calls Muse Spark's prepare_frontend only to obtain its EOS list, which parses the tokenizer and re-runs Spark's <|start|>/<|message|>/<|eom|> ID assertions, then parses again via _prepare_frontend. Extracting Spark's EOS augmentation in muse_spark/frontend.py:31-42 as its own helper would avoid the double parse.

  6. ignition/recipes/muse_glimmer_nvfp4/bootstrap.py:75 defaults stream_overlap=True and :188 builds ScratchArena(overlap=config.stream_overlap), but the recipe does not declare stream_overlap, does not forward plan.stream_overlap, and so no --no-stream-overlap flag exists while the plan reports False (ignition/planning.py:503). Identical shape to muse_spark/bootstrap.py:66; still a plan/behaviour mismatch.

  7. ignition/recipes/muse_glimmer_nvfp4/attention.py:36 keeps max_verify_width=8 from Spark although this recipe's widths reach 16 (bootstrap.py:52 MAX_WIDTH = 16, and decoder.py:38 passes config.draft.block_size); the default is misleading rather than wrong.

  8. ignition/preparation/checkpoint.py:396-404 widens the shared index check to accept total_size as either the tensor payload sum or the shard-file sum, for every recipe, on the strength of one exporter. Documented and deliberate, but it removes a cross-check previously applied uniformly; a warning or a note in docs/model-preparation.md would keep the two meanings distinguishable.

Positive conventions worth recording: ignition/preparation/quantization.py:12-43 is the charter-preferred consolidation (shared parser, gemma4/config.py:524 now calls it, matches_pattern reused at :555,558); helios/src/frontend/images/conditioned.rs:183-241 replaces the wildcard arms with exhaustive per-profile matches plus the covered array at :389-408, which is exactly the anti-drift pattern the reviewer wants for new profiles; patch_merge.rs:70-111 extracts bracketed_prompt instead of copying; muse_spark/frontend.py:45 parameterizes runtime_assets(patch=...) rather than duplicating it; docs/TODO.txt and docs/model-preparation.md entries follow the required form, and the localized subdirectory tests/recipes/muse_glimmer_nvfp4/ matches the muse_spark/nemotron_h precedent.

Not verified by test: whether declaring method="dflash2" changes any captured graph (it should not — speculative_proposal_source in Helios only accepts mtp|copy), and whether a new ImageLayoutKind value would require re-exporting existing Muse Glimmer cores (it would not, since none exist yet, but the padded-grid core reader test in conditioned.rs:842-856 should be extended).

#2 [high] Should fix: packing dispatch on image_preparation violates AGENTS.md enum rule

PR #229, file: helios/src/frontend/images/packing.rs (PR head eebbf1d).

prepare() at :98-112 matches:

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

Every other arm dispatches on image_layout alone (Qwen|Glm, Mimo, Deepseek|RowMajor, Moonvit|Radio, Step, ClassToken).

Rule: AGENTS.md "Architecture and ownership" bullet 3 — "Tool/reasoning parsers and image preparation/layout implementations use independent typed enum identifiers; those identifiers cannot select scheduling, cache policy, text-graph input packing, or completion behavior." docs/design-review.md principle 3 repeats it.

Also tensor_layout at :69-70 adds (ImageLayoutKind::Bracketed, "vision_cu_window_seqlens") and (..., "vision_reverse_index"), so one layout id now names two different staged-tensor sets, while :30 (Bracketed, "vision_pixel_values") is shared.

Fix: give Muse Glimmer its own additive ImageLayoutKind value (contract.rs enum is additive-safe; ImagePreparationKind::MuseGlimmer = 11 already done at helios/src/model/contract.rs:68) and dispatch on layout only, as PatchMerge/ClassToken do. Existing cores unaffected (no Muse Glimmer cores exist).

#3 [high] Should fix: Muse Glimmer DFlash2 recipe leaves Speculation.method unset

PR #229, ignition/recipes/muse_glimmer_nvfp4/recipe.py:72: speculation=Speculation(draft_tokens=15, token_capacity=128, packed_verification=True, graph_budget=64) — no method=.

The recipe ships z-lab DFlash2 through the shared DFlash2Preparation (ignition/recipes/muse_glimmer_nvfp4/dflash.py:14-37), exactly the case that ignition/recipes/qwen38_dense/recipe.py:68 declares as method="dflash2".

Consequences of the omitted field, all checked in code:

muse_spark/recipe.py:58 has the same omission (pre-existing). Fix: declare method="dflash2" here, or add a docs/TODO.txt entry explaining why both Muse recipes leave it unset.