Correctness report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/8d6a21c5-c75e-4e85-bc48-c010d8e74c43.md

Key findings

The change is small, well-scoped and the no-flag path looks byte-equivalent to stock, but the cap does not reach every path it claims to, and one accepted input produces an unloadable core:

  1. Blocking — ignition/cli/serve.py:193-206: the multi-host export path (_export_hosts, used whenever --ranks > 1) never forwards context=args.request_context, so ignition export MODEL --ranks 2 --request-context 131072 accepts the flag, prints no warning, and prepares at the recipe maximum. The KV-pool saving that is the entire point of the PR never happens on the multi-host path.
  2. Blocking — ignition/planning.py:369-373: prepared_context is min(recipe.context, target, tokens) with no page-alignment requirement, yet it becomes the prepared sequence length that Helios validates at load time (helios/src/model/catalog.rs:44-71 requires both prepared_sequence_tokens and limits.max_sequence_tokens to be multiples of page_tokens). A cap such as --request-context 200000 with a 128-token page exports fine and then fails to load with the opaque invalid prepared model configuration error.
  3. Should fix — ignition/planning.py:389-442 and ignition/preparation/rebuild_manifest.py:231-300, 343-395: neither the printed plan nor the rebuild manifest records the cap, so the shipped core is indistinguishable from an uncapped one in the plan report and flare inspect emits an ignition export command that reproduces the uncapped core.
  4. Should fix — ignition/planning.py:248: bench's required_context check still compares against the stock Plan.context, so a --contexts selection above the cap passes planning and fails only much later, in ignition/bench/runner.py:388, after the full GPU preparation, tuning and graph capture.
  5. Nit — a target above recipe.context is silently clamped; docs/cli-design.md:446 describes the flag as a cap below the recipe maximum, so the clamp deserves at least an echo of the effective value.

Lens coverage: I read every changed hunk in the diff, then the changed functions in their surrounding code (Plan, fit, plan, common_preparation_kwargs, all four CLI entry points, bench Settings/BenchmarkSelection), followed the value into Helios (server/config.rs:131-148, model.rs:268, model/catalog.rs:44-71) and into the export/rebuild paths, and checked the paths I expected to be affected and found correct (no-flag equivalence, pool clamp, <= 0 validation, prefill-chunk validation, frozen-dataclass compatibility). What I did not do is run an export; the one finding that a test would settle is noted under open questions.


Blocking

1. --request-context is silently ignored on the multi-host export path

File: ignition/cli/serve.py:193-206

_export_hosts builds its plan with the full flag set and ends at

row_shard_prefill=args.row_shard_prefill)

There is no context=args.request_context, whereas the same PR adds it at ignition/cli/serve.py:289 (_prepare), ignition/cli/serve.py:472 (debug_serve) and ignition/cli/cli/bench.py:177 (not opened). --request-context is registered by _preparation_arguments (ignition/cli/__init__.py:167-170), which every one of those subcommands shares, so the attribute exists on args in the --ranks > 1 branch too — it is simply never read.

Why it matters: ignition export MODEL --ranks 2 --rendezvous … --request-context 131072 runs to completion with no error and no warning and prepares the recipe-max context; the measured 16 GB saving the PR description claims at concurrency 4 is not obtained at all on multi-host, and the user has no way to see that from the output (Plan.to_dict does not report the cap either — see finding 3). This is precisely the behaviour the project's charter forbids: "Don't silently ignore API fields. If a standard request field is passed in, either implement it according to the spec or reject it. Never accept it and quietly drop it" (charter, "How We Work"). The charter's Code Review Standards also require checking "every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs" — multi-host is an advertised supported layout and this PR does not cover it. AGENTS.md:452-456 requires an advanced flag to be carried through the plan into the preparation config; here it does not even reach the plan.

Fix: add context=args.request_context to the planning.plan(...) call at ignition/cli/serve.py:193-206, matching _prepare and debug_serve. A regression test that asserts the same prepared_context for a one-host and a two-host plan of the same recipe would keep the three call sites from drifting again.

2. The capped context is not required to be page-aligned, so the exported core can fail to load

Files: ignition/planning.py:369-373 (producer), ignition/planning.py:459-460 (only validation performed), ignition/planning.py:694-700 (only other validation), ignition/preparation/bootstrap.py:58 (consumer), helios/src/model/catalog.rs:44-71 (rejection)

return min(self.recipe.context, self.context_target, self.tokens)

fit() validates only that the target is positive (planning.py:459-460: if context is not None and context <= 0: raise UsageError(...)) and plan() validates only that the prefill chunk fits (planning.py:694-700). Nothing anywhere requires the result to be a multiple of the recipe's page_tokens.

That value is then written into the preparation config as "context": plan.prepared_context (ignition/preparation/bootstrap.py:58), which is the prepared sequence length the core carries, and Helios refuses a core unless both the prepared length and limits.max_sequence_tokens are exact multiples of the scheduler's page size:

|| !config.prepared_sequence_tokens.is_multiple_of(page_tokens.max(1))
...
|| !config.limits.max_sequence_tokens.is_multiple_of(page_tokens)
...
    return Err("invalid prepared model configuration".into());

(helios/src/model/catalog.rs:50-57, error at :70)

Why it matters: stock is safe by construction because recipe.context is a page multiple declared by the recipe; a user-supplied cap is the first value on this path that is not. ignition export MODEL --request-context 200000 with a 128-token page (e.g. MiniMax M3.1 Flash, page_tokens=128 per tests/server/test_minimax_m3_cache.py:110 (not opened); fixture recipes use 64/128) gives 200000 / 128 = 1562.5: preparation, tuning and export all succeed, and the deployment then dies at flare run with a generic configuration error that names neither the flag nor the page size. The PR's own claim — "The prepared context never exceeds the pool capacity … as stock" — holds, but only the capacity constraint was ported; the alignment constraint that stock satisfied implicitly was not. The project also requires that exported cores keep loading (charter, Code Review Standards: "verify that existing data, artifacts, and exported cores still load").

Fix: validate in fit() (the single constructor of a Plan from CLI input) that the effective target is a multiple of plan.page_tokens — either round down to the nearest page, or reject with an actionable UsageError such as --request-context 200000: must be a multiple of the 128-token page (use 199936 or 197632). Rounding down is the better UX and mirrors how guaranteed_tokens already floors to pages (planning.py:378). A unit test on Plan.prepared_context asserting prepared_context % page_tokens == 0 for an unaligned target closes the loop.

Caveat / what would settle it: recipes live in the external hyperflare_recipes repository (AGENTS.md:381), so a recipe's prepare() could in principle re-round the value before it is emitted. Nothing in this repository does, and every alignment check lives in Helios, i.e. after export — so the worst case is a core that exports and then refuses to load. Settling it empirically is one export with an unaligned --request-context on a 128-token-page recipe followed by flare run.


Should fix

3. The cap is invisible in the printed plan and in the reproduction arguments

Files: ignition/planning.py:389-442, ignition/preparation/rebuild_manifest.py:231-300 and :343-395; consumers ignition/cli/serve.py:215 and :485, ignition/cli/bench.py:182

Plan.to_dict() reports "context": self.context (planning.py:430) — the stock min(recipe.context, tokens) — and "checkpoint_context": self.recipe.context. Neither prepared_context nor context_target appears anywhere in the dict. serve.py and bench.py print exactly {"plan": plan.to_dict()}, so a capped export prints a plan byte-identical to an uncapped one; nothing in the tool's own output tells an operator that the shipped core serves 128K rather than 256K.

rebuild_manifest.reproduction_arguments() has the same gap: it emits --max-concurrency, --prefill-chunk-size (rebuild_manifest.py:263) and every other preparation flag that affects the core, but never --request-context, and from_plan() (:343-395) records no deployment-scope parameter for it.

Why it matters: AGENTS.md:452-456 requires an advanced flag to be "carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared". docs/runtime-core-design.md:372 (not opened),452 makes reproduction_args the reproduction contract that flare inspect renders. Consequence: flare inspect on a 128K core prints an ignition export command that rebuilds the uncapped 256K core — a silent non-reproduction, exactly the failure mode the manifest exists to prevent — and the plan report cannot be used to audit which context a package was built for. This also masks finding 1 (a multi-host export ignoring the flag looks the same as one honouring it) and the clamp in finding 5.

Fix: add the effective value to to_dict() (e.g. "prepared_context": self.prepared_context, plus "context_target" when set) and add to reproduction_arguments() if plan.context_target is not None: args.extend(['--request-context', str(plan.context_target)]), with a matching deployment-scope entry in from_plan().

4. Benchmark required_context is validated against the stock context, not the cap

File: ignition/planning.py:248 (comparison), ignition/preparation/selection.py:76-77 (required_context), ignition/bench/runner.py:388 (late failure)

if selection.required_context > self.context:
    raise UsageError("benchmark workload and output allowance exceed the prepared context")

self.context is the stock min(recipe.context, tokens) (planning.py:363-366), untouched by this PR. With --request-context below the recipe max, a --contexts list can therefore exceed what was actually prepared and still pass Plan.__post_init__.

Why it matters: the failure then surfaces at ignition/bench/runner.py:388 — if case.context_tokens + required > layout.context or case.batch > layout.max_active → "benchmark case exceeds prepared capacities" — i.e. after the whole GPU preparation, autotuning and CUDA-graph capture has run, which for these recipes is the expensive part. The UsageError at planning.py:248 exists precisely to move that failure before any GPU work, and the PR already handles the analogous case correctly for the prefill chunk (planning.py:694-700, using effective_context = min(result.context, result.prepared_context)), so this reads as an oversight rather than a deliberate choice. Note the check is close to harmless in the common case (--contexts 16384 plus 2 × width is far below any plausible cap), but it is wrong for a small cap or a large contexts list.

Fix: compare against self.prepared_context in __post_init__ — min(self.context, self.prepared_context) if you want to keep the pool constraint explicit — and adjust the message to mention the cap when context_target is set, so the user knows whether to raise --request-context or lower --contexts.


Nit

5. A cap above the recipe maximum is clamped silently

File: ignition/planning.py:369-373, 459-460

min(self.recipe.context, self.context_target, self.tokens) means --request-context 300000 on a 256K recipe silently prepares 262144, with no notice, while docs/cli-design.md:446 (added by this PR) describes the flag as a cap "below the recipe's maximum". That is defensible as a clamp, but the user believes they have raised the ceiling when they have not. Emitting the effective value in the plan report (finding 3) makes the clamp visible; a one-line note in the help text or a stderr line when the clamp bites would be cheaper still.


Verified and correct (no finding)

These paths I checked specifically and found right, so the record shows what was covered:


Open questions

  1. Does any recipe round the prepared context before export? This is the only thing that would weaken finding 2, and it lives in the external hyperflare_recipes repository (AGENTS.md:381), which is outside this diff. An unaligned --request-context export on a 128-token-page recipe plus flare run on the result settles it definitively; if recipes do round, the finding downgrades to "add a unit test on Plan.prepared_context page alignment".
  2. Is --request-context ever valid on the --ranks path today for another reason? If multi-host export deliberately refuses flags it cannot honour, then the correct fix for finding 1 is to reject the combination rather than to forward it — but nothing in _export_hosts (serve.py:163-215) or in docs/cli-design.md says so, and it already forwards --prefill-chunk-size, --mixed-prefill, --roce-ring, --dcp-size and the online-MXFP8 flags, so forwarding is the consistent fix.
  3. Should the plan report carry the effective prepared context or the requested target? Both are useful for debugging (a target above the recipe max differs from the effective value). I recommend both keys, but that is a design preference for the author, not a defect.
  4. No test in the diff exercises prepared_context at all: this PR adds no test for the new property, the validation, or the prefill-chunk message. Given findings 1 and 2, at least a tests/cli/test_planning.py unit test per property (no-target = recipe max; unaligned target rejected/rounded) and one for the multi-host argument plumbing would be cheap insurance.

Citations note: AGENTS.md:452-456 and AGENTS.md:381, docs/runtime-core-design.md:372 (not opened),452, docs/cli-design.md:446 (added by this PR's diff), the charter's "Don't silently ignore API fields" and "Supported matrix & compatibility" lines, helios/src/model/catalog.rs:44-71, helios/src/server/config.rs:131-148, ignition/planning.py:176, 248, 363-378, 389-442, 459-460, 694-700, ignition/preparation/bootstrap.py:58, ignition/preparation/rebuild_manifest.py:231-300, 343-395, ignition/cli/serve.py:193-206, 215, 289, 472, ignition/cli/bench.py:177, 182, ignition/cli/__init__.py:167-170, ignition/bench/runner.py:388. PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 (head 1a006c6, 7 files, +35/−15).