Correctness report · NVIDIA/hyperflare-inference #518

Raw Markdown for agents: https://autobot.eidonix.com/p/8f21945a-87a3-4b78-941f-85e8b8a88b2f.md

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

Scope: correctness lens. Every changed file was read in its surrounding code, together with the callers/consumers of Plan that the new field can reach: derive, _export_hosts, _prepare, debug_serve, bench, planning.plan/fit/automatic, rebuild_manifest.reproduction_arguments/from_plan, and the Helios-side scope comparison that consumes the manifest generic parameters.

Key findings

Verified-correct behaviour

Recipe declaration (ignition/declaration.py:273-329)

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

Forwarding (ignition/cli/preparation.py:53-74, ignition/cli/serve.py:207-210, 275-278, 476-479, ignition/cli/bench.py:167-170)

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

Reporting (ignition/planning.py:411-412, ignition/cli/bench.py:240-252)

Manifest (ignition/preparation/rebuild_manifest.py:300-303, 357-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 in fit), with ignition/declaration.py:363-374 (Recipe.weights_bytes).

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

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

and weights_bytes(checkpoint, world_size, speculation, expert_scale_compression=None) computes device_bytes + expansion_bytes - draft_bytes (+ draft_bytes) divided by the world size — the stored, full-precision weight total. It has no head-quantization parameter, and fit has no target_head_quantization parameter either (signature at planning.py:445-453).

Why it matters: the flag's whole point, 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 on TP1. Using the pre-conversion estimate:

This is precisely the memory-constrained configuration the PR cites (DGX Spark GB10, 273 GB/s LPDDR5X, TP1), so the misestimate lands on the target hardware rather than an exotic one.

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 target_head_quantization through fit/fitted/automatic/attempt/candidates in plan. If the estimate is deliberately kept conservative, 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 which fails fits under BF16 passes under MXFP8) would fail today; a per-format saving constant requires the companion recipe to state the actual reduction, so the building blocks are in local-inference-lab/hyperflare-recipes#40.

2. Should fix/verify — draft-head and target-head flags can be combined against documented semantics

Where: docs/cli-design.md:453 and the new row at docs/cli-design.md:454; validation sites ignition/planning.py:212-293 (Plan.__post_init__) and ignition/planning.py:487-491 (fit).

What is wrong: --draft-head-quantization is documented as preparing "a separate proposal vocabulary head while retaining target-head precision", and the draft row explicitly says "Flash Next supports both with --speculative-method dflash2 and a BF16 target vocabulary head" — the same Flash Next recipe the new row names. Nothing rejects the combination: Plan.__post_init__ checks heads individually, fit checks draft/markov membership in the recipe's declared tuples (planning.py:487-491), and the draft-head path in ignition/cli/preparation.py:209-220 builds Speculation without consulting the target-head flag. Because the CLI accepts both on the same command line and both are recorded (draft under SCOPE_DRAFT_WEIGHT at rebuild_manifest.py:418-419, target under SCOPE_TARGET_WEIGHT at rebuild_manifest.py:363-364), a user can prepare a core whose draft head and target head are both MXFP8 while the documentation they read says the draft option preserves target precision.

Why it matters: correctness of the documented contract, and of the two distinct weight scopes that flare combine compares. If combining is legal and intended (a Flash Next core with both heads quantized), the draft row's "retaining target-head precision" sentence is now wrong and should be qualified; if it is not intended, Plan.__post_init__ should reject the pair with a UsageError, as it already does for --row-shard-prefill + --joint-tuning (planning.py:282-283) and --force-moe-decode-a16 + --mixed-prefill (planning.py:262-263).

How to settle: the recipe declaration in local-inference-lab/hyperflare-recipes#40 settles whether Flash Next declares both draft_head_quantizations and target_head_quantizations; the code here settles that no validation exists.

3. Nit — duplicated validation wording 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 worded check in Plan.__post_init__ ("does not prepare this target head format"). Behaviour is fine — both raise UsageError naming the alias — but the same rule now lives in two places with two phrasings, which invites drift when a second target-head format is added (the "mxfp8" literal appears in three places: declaration.py:328, planning.py:289 via the recipe tuple, and the CLI choices at __init__.py:212). Consider deriving the choices tuple from a single module-level constant, as AUTOTUNE_EFFORTS is imported for --autotune-effort (__init__.py:224-226).

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

docs/cli-design.md:454 says "such as Qwen3.8 Flash Next with a BF16 checkpoint head". The neighbouring draft-head row is explicit that "the packed NVIDIA head cannot be converted through this option" (:453). Stating the same precondition for the target head row (a non-convertible packed head must be rejected, not silently left in its packed precision) would make the rejection contract unambiguous — and would be the natural place to record that rejection, 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, plan field, CLI, bench, rebuild-manifest and tests. This 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. If the companion recipe declares target_head_quantizations=("mxfp8",) without its loader consuming the plan field, then: 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 — a silently accepted no-op whose manifest now claims a different weight layout from any genuinely MXFP8-prepared core, so the two would be treated as non-combinable by flare combine and as non-reusable under --reuse-weights. That direction of error is at least safe (refused rather than wrong bytes mixed), but the failure is silent at export time. Only a test in the recipes repository — prepare with the flag and assert the target head's resident dtype/bytes — settles it.

Open questions

What I could not verify from this repository