PR #518 architecture & scope review — "Add recipe-declared --target-head-quantization preparation flag"
Head: f54928b (rebased onto origin/main 2771618) · 10 files, +126/−10 · open, ready for review, no human reviews, no CI checks on head. Re-verified across three passes at this identical head commit; nothing was withdrawn or added between passes.
Verdict: no blocking architectural violation. Three should-fix issues, four nits, two observations. The plumbing that matters most — the PreparationManifest/SCOPE_TARGET_WEIGHT path — is correct and follows docs/runtime-core-design.md (not opened) exactly.
Rules the review is judged against: the charter ("Solve the right problem in the right place… Look for the smallest footprint in shared code"; "Standard model extensions… implemented once via a single general mechanism"; "Bring real evidence"), AGENTS.md:155-207 (not opened) (rejection of unsupported abstractions/churn), AGENTS.md:194-199 (not opened) (no scaffolding presented as supported), AGENTS.md:446-456 (not opened) (advanced flags carried through the plan so "the plan, its printed report, and its recorded measurements describe what was prepared"), docs/design-review.md (not opened) P3, P9, P10, P12, P13, P16, and docs/runtime-core-design.md:345-401 (not opened).
Key findings
- Should fix — the flag's stated purpose never reaches memory planning.
Recipe.weights_bytestakes no target-head argument, andfit/plando not accept one, so the plan still reserves the checkpoint-precisionlm_headand the PR's ~600 MiB saving cannot be seen byfits,fixed_bytes, the printed plan, or theCapacityErroroption search. - Should fix — plumbing bypasses
planning.plan/fit. The setting is patched onto the finishedPlanwithdataclasses.replace(...), so its only validation runs after GPUs and capacity are already reasoned about; an unsupported format can surface asCapacityErrorinstead of the intendedUsageError. Sibling recipe-gated settings are realfit/planparameters. - Should fix — the one changed doc line claims a model and a conversion effect this repository cannot provide.
docs/cli-design.md:454names Qwen3.8 Flash Next and "freeing the temporary BF16 vocabulary weight after conversion", but no in-tree recipe declarestarget_head_quantizations; recipes live inlocal-inference-lab/hyperflare-recipes, whose companion PR #40 is unmerged. - Four nits (discoverability in
MODEL --help, an un-updated design-doc enumeration, gratuitous dict-splat churn inbench, inconsistent defensivegetattrin the manifest). - What is right: the manifest entry is an Ignition-only
PreparationParameterunderSCOPE_TARGET_WEIGHT, emitted only when set, soruntime_core.proto(not opened),core.proto(not opened) andhelios/are untouched and default-precision cores remain byte-compatible forflare combineand--reuse-weights; the declaration mirrors the existingdraft_head_quantizationsprecedent and is an explicit CLI opt-in, not an environment switch (P10) and not silent requantization (P9).
Should fix 1 — the flag's stated purpose never reaches memory planning
Files: ignition/declaration.py:363-374 (Recipe.weights_bytes), ignition/planning.py:445-453 (fit signature), :524-533 (Plan construction), :581-589 (plan signature), :325 (fixed_bytes), :383-385 (Plan.fits), :431 (to_dict weights_bytes), :551-563 (_shortfall), :697-725 (CapacityError option search).
What is wrong. The planner's only weight estimate is:
def weights_bytes(self, checkpoint: Checkpoint, world_size: int, speculation: Speculation | None,
expert_scale_compression: str | None = None) -> int:
It picks checkpoint.device_bytes or checkpoint.scale_compressed_device_bytes[expert_scale_compression] and takes no other argument. target_head_quantization lives on the Plan (planning.py:199) but is never threaded into weights_bytes, fit (:445-453) or plan (:581-589), and the Plan is constructed at :524-533 without it. Consequently plan.fits (:383-385), fixed_bytes (:325), the derived page count, the printed plan, _shortfall (:551-563) and the capacity-error option list (:697-725) all continue to reserve the full checkpoint-precision lm_head (the PR itself sizes that head at 1.21 GiB for 248,320 × 2,560 BF16).
Why it matters. The PR's motivation is fitting and decoding on bandwidth/memory constrained DGX Spark GB10, and its claimed benefit includes "~600 MiB saved on TP1". With no plan-side estimate, a host that the flag would make fit still raises CapacityError and never offers the flag as a remedy — the plan is precisely the artifact AGENTS.md:446-456 (not opened) requires to describe what was prepared ("the plan, its printed report, and its recorded measurements describe what was prepared"), and docs/cli-design.md:454 asserts a memory effect the planner does not model.
Qualification (important for fairness). This is not a brand-new architectural violation: --online-mxfp8 is equally absent from weights_bytes, and docs/cli-design.md:36-41 and :1667 state the estimate is deliberately rough ("Estimate roughly, allocate from the device"; "The estimate is rough"). It remains a should-fix because of the PR's own memory claim, the memory sentence added at docs/cli-design.md:454, and AGENTS.md:452-456 (not opened).
Fix. Declare the quantized head's resident bytes on the Checkpoint — the mechanism Checkpoint.scale_compressed_device_bytes (declaration.py:85-86) already provides for an optional encoding — or subtract them inside Recipe.weights_bytes; then pass the setting through fit/plan. What would settle it: a planning test asserting fit(..., target_head_quantization="mxfp8").weights_bytes < fit(...) for a recipe that declares the capability.
Should fix 2 — plumbing bypasses planning.plan/fit, so validation runs after capacity reasoning
Files: ignition/cli/preparation.py:57 (new keyword), :60-69 (planning.plan(...)), :70-75 (replace(..., target_head_quantization=target_head_quantization)); ignition/cli/serve.py:192-205 + :206-211 (_export_hosts), :461-474 + :475-480 (debug_serve); ignition/cli/bench.py:162-177 (derive call), :178 (replace).
What is wrong. derive builds a complete plan first and then repairs it:
result = planning.plan(... ) # preparation.py:60-69 — no target head argument
result = replace(result, compile_workers=..., ..., target_head_quantization=target_head_quantization, ...) # :70-75
_export_hosts (serve.py:206-211) and debug_serve (serve.py:475-480) do the same. Every sibling recipe-gated setting is instead a real fit/plan parameter validated before GPUs are chosen: row_shard_prefill (planning.py:627-632), online_mxfp8/scope (:603-608), language_model_only (:609-610), draft head/body formats (:487-497), expert_scale_compression (:498-500). The new flag's only validation is Plan.__post_init__ (:289-293):
if self.target_head_quantization is not None and self.target_head_quantization not in self.recipe.target_head_quantizations:
raise UsageError(f"--target-head-quantization {self.target_head_quantization}: {self.checkpoint.alias}"
" does not prepare this target head format")
On the CLI path the Plan is built with None, so this can fire only on the post-planning replace.
Why it matters. On a memory-constrained host an unsupported format surfaces as a CapacityError from planning.py:697-725 instead of the intended UsageError naming checkpoint.alias — the error a user sees depends on free memory. And no other plan/fit caller, including replicas via tuning_replicas.py:155 (not opened), can express the setting at all, so it is not really "carried through the plan" as AGENTS.md:452-456 (not opened) intends.
Fix. Add target_head_quantization: str | None = None to fit and plan, validate it beside the draft-head loop (planning.py:487-495) raising the same UsageError, keep Plan.__post_init__ as the invariant, and delete the replace(...) argument together with the getattr(args, "target_head_quantization", None) guards that exist only because bench/join share parsers (bench.py:170, serve.py:210, :278, :479). What would settle it: a test that an undeclared format raises UsageError from planning.plan/fit on a host too small for the default plan.
Should fix 3 — the doc row claims a model and an effect this repository cannot provide
File: docs/cli-design.md:454 (the only changed doc line).
Added text: "--target-head-quantization {mxfp8} | Prepare the target vocabulary head as MXFP8 for recipes that declare target_head_quantizations (such as Qwen3.8 Flash Next with a BF16 checkpoint head), freeing the temporary BF16 vocabulary weight after conversion. Recipes that do not declare the requested format reject it. Command line only; changing it requires re-export. | Checkpoint precision"
What is wrong. A repository-wide grep for target_head_quantization returns only: the Recipe field and its validator (declaration.py:278, :328-329), the Plan field/validation/to_dict (planning.py:199, :289-293, :411-412), the CLI wiring (cli/__init__.py:212-214; preparation.py:57, :73; serve.py:210, :278, :314, :479; bench.py:170, :250-251), the manifest (rebuild_manifest.py:302-303, :363-364), and the two test files. No in-tree recipe declares the capability — recipes live in local-inference-lab/hyperflare-recipes (AGENTS.md:9-13 (not opened), docs/design-review.md:33-34 (not opened), docs/model-development.md:4-7 (not opened)) and the companion PR (local-inference-lab/hyperflare-recipes#40) is unmerged. Nothing in this PR verifies the conversion or the "freeing the temporary BF16 vocabulary weight" behaviour, so in this repository the flag is reachable but inert.
Why it matters. AGENTS.md:52-60 (not opened) (state support as present qualification; put pending measurements in docs/TODO.txt), AGENTS.md:194-199 (not opened) ("Do not present scaffolding or partially wired features as supported"), and design-review P16 (no unsupported claims in changed prose, docs/design-review.md:137-150 (not opened)). The row must also not read as contradicting docs/cli-design.md:474, where --online-mxfp8 leaves "target vocabulary weights" at checkpoint precision.
Not this PR's fault: the stale ignition/recipes/ references at docs/cli-design.md:19 and :1063 are pre-existing and outside the diff.
Fix. State only that the flag takes effect for a recipe that declares the capability (external recipe repositories); drop the named checkpoint and the unmeasured conversion detail, or land it together with the recipe and cite the measurement there. What would settle it: landing the companion recipe PR, which reduces this to a cross-repo link plus a measured citation.
Nits (all verified at the cited lines)
- Discoverability.
ignition/cli/help.py:76-91builds "Optional features for this recipe:" from--expert-scale-compression,--mixed-prefill,--no-context-parallel,--no-stream-overlap. The new capability is absent, soignition export MODEL --helpgives no hint the flag applies to that recipe. The draft/Markov head flags share the gap, so this is a consistency improvement rather than a regression. - Design doc not updated.
docs/runtime-core-design.md:374-377(not opened) enumerates the parameters inPREPARATION_PARAMETER_SCOPE_TARGET_WEIGHT(online_mxfp8, resolvedonline_mxfp8_scope,expert_scale_compression); the new key belongs in that list. - Churn in bench.
ignition/cli/bench.py:243-252rewrites a flat dict comprehension into nested**{...}splats for one optional key, even thoughplan.to_dict()(planning.py:411-412) already omits it when unset. A conditional add after the comprehension is shorter (AGENTS.md:188-193(not opened) on unsolicited restructuring). - Access-style inconsistency.
ignition/preparation/rebuild_manifest.py:302-303guards withgetattr(plan, 'target_head_quantization', None)while:363-364readsplan.target_head_quantizationdirectly. The field is a real Plan field (planning.py:199), so the defensive form is dead weight.
Observations, not requests
- Mechanism drift.
--target-head-quantizationis the fourth parallel projection-precision flag (target head, draft head, draft body, Markov head), each with its own declaration tuple, validator,to_dictentry,reproduction_argumentspair and manifest parameter. The charter's "implemented once via a single general mechanism" is drifting for projection precision; a maintainer decision on one override-declaration mechanism is worth having before a fifth arrives. - Coverage.
tests/cli/test_commands.py:102-138covers parser/help andderiveforwarding plus rejection;tests/cli/test_planning.py:212-253covers Recipe/Plan validation and the manifest Protobuf round-trip. Untested: multi-host_export_hostsforwarding (serve.py:210),debug_serve(serve.py:479), and the bench configuration output (bench.py:250-251). Only a GPU export with a declaring recipe can show the conversion and the memory saving. The PR honestly discloses its unrun Rust checks, and since no Rust or Protobuf file changed,cargo testdoes not apply.
What is right (no action)
- Manifest plumbing follows
docs/runtime-core-design.md:345-401(not opened) exactly. The key is added as an Ignition-onlyPreparationParameterunderSCOPE_TARGET_WEIGHT(rebuild_manifest.py:363-364), omitted when unset. Rust compares scopes generically (helios/src/runtime_core/preparation.rs:286-347(not opened)), soruntime_core.proto(not opened),core.proto(not opened) andhelios/are untouched and default-precision cores still combine and reuse weights (AGENTS.md:431-444(not opened), design-review P13). - Opt-in shape mirrors precedent.
target_head_quantizations: tuple[str, ...] = ()(declaration.py:278), format validation inRecipe.__post_init__(declaration.py:328-329), rejection namingcheckpoint.alias(planning.py:289-293) — the same pattern asdraft_head_quantizations/draft_body_quantizations(planning.py:487-495). It is a CLI flag, not an environment switch (AGENTS.md:446-451(not opened), design-review P10), and not silent requantization (P9). The--helptext added incli/__init__.pyis model-agnostic: "prepare the target vocabulary head as MXFP8 for recipes that declare it (default: checkpoint precision)". - Recording is conditional.
Plan.to_dict()(planning.py:411-412),reproduction_arguments(rebuild_manifest.py:302-303) and the startup status line (serve.py:314) mention the setting only when it is set, preserving the "omitting the flag changes nothing" contract. - PR description quality. The four required parts appear in order, and the description distinguishes the combined core+recipe numbers (
+7.5–9.0%C1 decode,~600 MiB,44/44quality gate; TP2 RoCEabbench) from this PR's own contribution (AGENTS.md:95-109(not opened), design-review P12), ending with the requiredDiscord: neroline (P17).
Open questions / what could not be established
- Should the quantized head's resident bytes be declared on
Checkpoint(likescale_compressed_device_bytes) or computed inRecipe.weights_bytes? Either fixes finding 1; a maintainer decision plus a declaring recipe settles which. - Will the companion recipe PR (local-inference-lab/hyperflare-recipes#40) land alongside this one? If it merges with a Qwen3.8 Flash Next declaration, finding 3 reduces to a cross-repo documentation link plus a measured citation.
- The end-to-end serving and quality-gate claims cannot be checked from this repository — there is no declaring recipe, and per design-review P12 /
docs/performance-work.md:9-13(not opened) comparative claims needignition export+flare runon the paired stack, notdebug-servetimings. They are correctly attributed to the paired stack in the description, so they are not a finding, only unverifiable here.