Correctness report · NVIDIA/hyperflare-inference #229

Raw Markdown for agents: https://autobot.eidonix.com/p/808717f9-b890-4828-9c6b-24bf17390680.md

Correctness review of PR #229 — Muse Glimmer 30B NVFP4 (head eebbf1d)

Key findings

Rules applied: docs/design-review.md principles 12 (validate the real path and report evidence honestly), 13 (preserve model core compatibility), 15 (reject scope expansion and weakened constraints); AGENTS.md "Contribution scope and rejection criteria" — "Reject weakened guarantees" (lines 177-182) and "Require focused, meaningful validation" (lines 189-194); the charter's merge criteria (line 37).


Blocking

1. No export/serve evidence from this branch, and exactly one supported checkpoint

docs/design-review.md:94-102 requires exercising the real path and disclosing unrun checks; the charter (line 37) is stricter for new recipes: "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)."

Both halves are unmet:

Consequence specific to this lens: the graph catalog, page budget (145 graphs / 57.3 GiB pages at the 16-request ceiling), the 128-row packed catalog and the 1,048,576-token context arithmetic are all unexecuted code paths on this head; a wrong capacity or catalogue derivation would surface only after merge.

Fix: land the public alias only after one export + serve run from this head (one text request and one image request passing is enough to satisfy the rule), or merge the recipe without a public alias, documented as unqualified. Whether it exports and serves cannot be settled from code — it needs a GPU run.


Should fix

2. total_size check relaxed for every recipe

ignition/preparation/checkpoint.py:396-405 (diff in this PR):

# 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(...)

_inspect_indexed_checkpoint is the single entry point behind inspect_indexed_checkpoint, used by every recipe's preparation. Previously a checkpoint whose index total_size disagreed with the tensor payload the index actually maps was rejected. file_size includes the safetensors header and any trailing/unrequested bytes (the new test at tests/preparation/test_checkpoint_source.py:41-50 proves exactly this: header_bytes + payload is accepted), so:

AGENTS.md:177-182 ("Reject weakened guarantees … do not remove validation, suppress errors … or relax references") applies to shared preparation code, not just to the new recipe.

Fix: keep the payload comparison authoritative; accept the file-sum arm only when it is provably the ModelOpt shape (payload <= files and the surplus equals the known extra shard, or gate on exporter identity in metadata), and pin a rejecting case for a file-sum index whose surplus is wrong. The PR currently adds only the accepting case plus the pre-existing payload + 1 rejection (tests/preparation/test_checkpoint_source.py:48-50), which would pass under the old check too.

3. Cached Muse Glimmer image records are validated by length, not content

helios/src/frontend/images/conditioned.rs:209-212 and :237-239:

let (windows, reverse) = match self.processor.profile {
    Profile::MuseGlimmer(_) => (super::muse_glimmer::windows(&self.geometry) + 1, patches),
    _ => (0, 0),
};
...
&& images.cu_seqlens == sequences              // compared by value
&& images.cu_window_seqlens.len() == windows   // length only
&& images.reverse_index.len() == reverse       // length only

materialize_cached (conditioned.rs:149-166) treats a valid_processed failure as a stale record: it invalidates the store entry and re-prepares. A persisted record with correct lengths but wrong window boundaries or a wrong reverse index now passes this gate and is handed to helios/src/frontend/images/packing.rs, which rejects it at request time with "vision window segments differ from the image extent" (packing.rs:581) or "vision reverse index leaves the image extent" (packing.rs:591). So the failure moves from silent re-preparation to a user-visible request error — the opposite of the intent of validation. cu_seqlens is compared by value two lines above, which shows the intended standard.

Fix: check cheap invariants cheaply in valid_processed: first() == Some(&0), last() == Some(&(patches as i32)), monotone non-decreasing for cu_window_seqlens, and reverse_index a permutation of 0..patches (or compare against a re-derived vector as cu_seqlens is compared).

4. Image geometry depends on a hand-replicated CPython hash

helios/src/frontend/images/muse_glimmer.rs:240-277 reproduces CPython 3.12's set iterating order — tuplehash constants (PRIME_1/2/5), the eight-slot probe slot * 5 + 1 + (perturb >>= 5), and the acc == u64::MAX → 1_546_275_796 fix-up — solely so that min(list(set(itertools.product(...)))) in the reference resolves aspect-ratio ties the same way. geometry_matches_transformers_smart_resize (muse_glimmer.rs:367-417) pins 20 tie sizes and 40 plain sizes; the fallback path best.unwrap_or(...) (muse_glimmer.rs:99-102) silently uses ideal dimensions whenever the filtered set is empty, and every untested size follows the replicated hash. CPython 3.13 changes set sizing/resizing (and therefore probe order), so a tester on a different interpreter, or a change in the reference holder, changes the chosen grid — with no failing test. A wrong grid changes patches, tokens, the bracketed prompt expansion and the vision metadata together, i.e. it changes token counts, not just pixels.

Fix: record the interpreter and Transformers version that produced TIES beside the table (as lanczos_matches_torchvision_antialiased_uint8_resize already does for torchvision/PIL), or drop the hash replication and sort candidates by (distance, grid) with the reference's choice pinned explicitly per tie size.

5. bootstrap default contradicts the recipe's declaration

ignition/recipes/muse_glimmer_nvfp4/bootstrap.py:69: max_active: int = 4, while ignition/recipes/muse_glimmer_nvfp4/recipe.py:69 declares concurrency=8, max_concurrency=16, and commit 3's entire argument is the eight-request default. max_active drives request_capacity (bootstrap.py:96), image capacity (:108), the speculative shapes (:115-116), page budgets (:159), prefill/batch capacities (:222) and the runtime max_active (:367). Driving it through recipe.prepare is safe (recipe.py:36 passes max_active=plan.concurrency), but a direct PreparationConfig(...) run — the form the recipe's own tests use — builds a four-slot catalog that does not match the declaration. tests/recipes/muse_glimmer_nvfp4/test_preparation.py:15 pins the stale value, so the inconsistency is currently enforced.

Fix: default max_active to 8 (matching recipe.py), or make it required, and update the test row.

6. PreparedDecoder declares an auxiliary buffer it never writes

ignition/recipes/muse_glimmer_nvfp4/decoder.py:104-106 allocates self.auxiliary via declaration_tensor(...), but __call__ (decoder.py:123-128) builds auxiliary = torch.cat(taps, -1) as a forward-local value and returns it (decoder.py:140); the declared tensor is only cleared in release_outputs (decoder.py:114-115). That is one live BF16 (rows, len(target_layers) × 6656) allocation per prepared decoder (five taps × 6656 columns) with no reader and no writer. Harmless numerically but it is dead allocated VRAM in a recipe whose whole budget argument is graph inventory plus pages.

Fix: delete the declaration, or write the concatenation into it and return the buffer if the drafter path expects a stable address.


Nits

7. Record version bumped, store metadata tag not

helios/src/frontend/images/record.rs:73 writes FLAREIMG\x02 and decode (record.rs:116) rejects \x01, while helios/src/frontend/images/conditioned.rs:169 still labels the payload flare-prepared-image-v1. Effect is correct — an old record fails decode, is invalidated and re-prepared (conditioned.rs:154-166) — but records written by a previous engine are silently re-preprocessed and the metadata tag no longer identifies the payload version. Bump both together.

8. qualify/speculative_benchmark.py:32 widened the metric classes to [0-9]+

Accepting width 16 and batches 8/16 is the intended fix and is pinned by tests/qualify/test_speculative_benchmark.py, but batch="0" or an unexpected batch="32" row now silently produces a shape row instead of being ignored. Prefer a bounded class (([0-9]{1,2})) plus dropping rows whose batch/width exceed the served configuration.

9. Pooled vision scratch coverage

The description's limitation stands: on main, tests/recipes/test_vision_scratch.py (not opened) no longer checks pool reuse across capacities for any recipe, so Muse Glimmer's pooled vision scratch is covered only by test_attention_cuda/test_vision_cuda, none of which ran on this base. Not a defect in this diff (it is a pre-existing gap), but it means the recipe's scratch aliasing is unverified — worth a follow-up test rather than a change here.


Verified as correct (checked, not findings)

Open questions / could not be settled from code

  1. Whether the recipe exports and serves from eebbf1d — needs a GPU run; this is blocking finding 1.
  2. Whether the checkpoint's NVFP4 gate scale really differs from q/k/v (the reason gate is a separate projection) — needs the b47e1e9f snapshot.
  3. Whether the vision tower's window/full layer split (muse_glimmer_nvfp4/vision.py:220-224) matches the checkpoint's layer_types — needs the snapshot / a CUDA test.
  4. Alias collision with PR #192, which registers the same muse-glimmer-30b-nvfp4 alias for a different checkpoint. Out of this lens (naming), but it interacts with blocking finding 1: two recipes cannot both claim the alias, and the proposed resolution (this PR keeps it, #192 renames) should be agreed with a maintainer before either merges.
  5. ignition/recipes/muse_glimmer_nvfp4/attention.py duplicates Muse Spark's attention; docs/TODO.txt records folding them together once Muse Spark accepts per-call metadata. Recorded as a follow-up, not a finding — the duplication is justified in the description by Muse Spark's construction-bound metadata.