Correctness report · NVIDIA/hyperflare-inference #518

Raw Markdown for agents: https://autobot.eidonix.com/p/af0cb7f5-95c9-4cf9-8bd1-202adfbcf1d8.md

Correctness review — PR #518, "Add recipe-declared --target-head-quantization preparation flag"

Head reviewed: f54928b (base main; open, ready for review, no reviews yet, no CI checks on this commit). Lens: correctness. Every changed file was read in its surrounding code, together with the callers and consumers the new Plan field can reach: derive, _export_hosts, _prepare, debug_serve, bench, planning.plan/fit/automatic/attempt/candidates, rebuild_manifest.reproduction_arguments/from_plan, and the Helios-side scope comparison that reads the manifest.

Key findings

Verified-correct behaviour

Recipe declaration (ignition/declaration.py:276-278, 328-329)

CLI surface (ignition/cli/__init__.py:212-214)

Forwarding (ignition/cli/preparation.py:50-76, serve.py:210, 278, 479, bench.py:170)

Validation (ignition/planning.py:289-293)

Reporting (ignition/planning.py:411-412, ignition/cli/bench.py:250-251)

Manifest (ignition/preparation/rebuild_manifest.py:302-303, 363-364)

Documentation (docs/cli-design.md:454)

Findings

1. Should fix — plan sizing and capacity errors ignore target_head_quantization

Where: ignition/planning.py:526 (the only weights_bytes call), with ignition/declaration.py:363-374 (Recipe.weights_bytes).

What is wrong. Plan gains target_head_quantization (planning.py:199) and validates it (:289-293), but the value never reaches sizing:

recipe.weights_bytes(checkpoint, len(gpus), speculation, expert_scale_compression), costs.graph_bytes,   # planning.py:526

weights_bytes(checkpoint, world_size, speculation, expert_scale_compression=None) returns (device_bytes + expansion_bytes - draft_bytes + (draft_bytes if learned else 0)) // world_size — the stored, full-precision total. It has no head-quantization parameter, and fit has no such parameter either.

Why it matters. The flag's whole purpose, per the PR description and the docs row, is to free the BF16 target head: 1.21 GiB for a 248,320 × 2,560 head, ~600 MiB resident at TP1. Using the pre-conversion estimate:

This lands on precisely the hardware the PR cites (DGX Spark GB10, TP1), not an exotic configuration.

Fix. Give weights_bytes (or a wrapper used by fit) the target-head format and subtract the target vocabulary head's BF16 bytes — or add a per-format resident-bytes contribution — when target_head_quantization is not None, and thread the value through fit/fitted/automatic/attempt/candidates. If conservative sizing is deliberate, the flag must at least be documented as not affecting fit, because otherwise an advertised-fitting configuration can fail planning.

How to settle. A test asserting replace(plan, target_head_quantization="mxfp8").weights_bytes < plan.weights_bytes, or that a plan failing fits under BF16 passes under MXFP8. The numeric saving itself lives in the companion recipe's declared costs, not in this diff.

2. Should fix — draft-head and target-head quantization can be combined, contradicting the documented contract

Where: docs/cli-design.md:453 versus ignition/planning.py:212-293 and :487-491.

What is wrong. Plan.__post_init__ rejects several conflicting pairs explicitly — --row-shard-prefill + --joint-tuning (planning.py:282-283), --force-moe-decode-a16 + --mixed-prefill (planning.py:262-263) — but nothing rejects --draft-head-quantization mxfp8 together with --target-head-quantization mxfp8. The draft row (cli-design.md:453) documents the draft-head option as preparing "a separate proposal vocabulary head while retaining target-head precision", and names Flash Next with "a BF16 target vocabulary head" as a supported case; the new target row (:454) also names Flash Next. Both flags are therefore individually documented as applying to the same recipe, with no statement about their combination.

Why it matters. Either the pair is legal (both heads quantized, two distinct weight scopes in the manifest) — in which case the draft row's "retaining target-head precision" sentence is now wrong and should be qualified — or it is not intended, in which case export should fail fast instead of silently producing a core whose two head scopes were never designed to coexist. As written, a user following the docs can reach a state the docs say is impossible.

Fix. Qualify the draft row to say the target-head sentence applies only when --target-head-quantization is omitted, or add a UsageError in Plan.__post_init__ next to the existing pair checks.

How to settle. The recipe declaration in local-inference-lab/hyperflare-recipes#40 settles intent; the code here settles that no validation exists.

3. Nit — duplicated and differently worded validation for the target head

Where: ignition/planning.py:289-293 versus ignition/planning.py:487-491.

fit already validates draft and markov heads against recipe.<head>_head_quantizations with the message --{head}-head-quantization {value}: {alias} does not prepare this proposal head format. The target head gets an equally correct but separately phrased check in Plan.__post_init__ ("does not prepare this target head format"). Behaviour is fine — both raise UsageError naming the alias — but one rule now lives in two places with two phrasings, inviting drift when a second target-head format is added. The "mxfp8" literal appears in three places: declaration.py:328, the CLI choices at cli/__init__.py:212, and implicitly the plan check. Consider a single module-level constant, as AUTOTUNE_EFFORTS is imported for --autotune-effort (cli/__init__.py:224-226).

4. Nit — docs row could name the BF16-source-checkpoint precondition

Where: docs/cli-design.md:454.

The new row says "such as Qwen3.8 Flash Next with a BF16 checkpoint head", but the neighbouring draft row is explicit that "the packed NVIDIA head cannot be converted through this option" (:453). Stating the same precondition for the target head — a packed/non-convertible head must be rejected rather than silently left in its packed precision — would make the rejection contract unambiguous, and is the natural place to record it since the code here relies entirely on the recipe not declaring the format.

Cross-repo residual risk (not a defect in this diff)

Nothing in NVIDIA/hyperflare-inference consumes plan.target_head_quantization beyond to_dict (planning.py:411-412), the startup status string (serve.py:314) and the manifest entry (rebuild_manifest.py:363-364) — verified by searching the whole repository, where the only hits are the declaration, the plan field, the CLI, bench, the rebuild manifest and the tests. That is by design ("core ignition stays strictly recipe-free"), but it means the flag's effect is entirely owned by local-inference-lab/hyperflare-recipes#40.

Two ways that ownership can go wrong:

  1. Declared but not acted on. If the companion recipe declares target_head_quantizations=("mxfp8",) without its loader reading the plan field, export accepts the flag, records target_head_quantization under SCOPE_TARGET_WEIGHT, prints "target head mxfp8", and produces a core whose head is still BF16. That is a silently accepted no-op, and its manifest now claims a weight layout different from a genuinely MXFP8-prepared core, so the two would be refused by flare combine and --reuse-weights. The direction of error is safe (refused rather than mixing wrong bytes), but the failure is silent at export time.
  2. Multi-host peer propagation. In multi-host export (--ranks > 1) the plan object stays on rank zero: HostRendezvous.prepare sends peers only the recipe-supplied preparation config plus the prepare callable (ignition/preparation/host_ranks.py:348-353, peers consume it at :633-656). plan.target_head_quantization therefore reaches peer ranks only if the companion recipe copies it into that config. If it does not, rank zero and peers prepare different target-head precision while the manifest records MXFP8 under SCOPE_TARGET_WEIGHT (rebuild_manifest.py:363-364) — a divergence that is invisible to the manifest and that no test in this repository can cover. The TP2 RoCE validation the PR reports depends entirely on the recipe PR doing that translation.

Only a test in the recipes repository — prepare with the flag, then assert the target head's resident dtype/bytes on both rank zero and a peer — settles either case.

Open questions

What I could not verify

Note on review material

Nothing in the pull request description, its diff or its comments attempted to direct my behaviour; the description's statements about scope and validation were treated as claims to verify, and each was checked against the code above.