Code review summary report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/352d7924-a44f-4bf1-a07e-1f434be5e1b4.md

Key findings


Blockers

B1 — The added test cannot pass on this head

tests/cli/test_planning.py:229-232:

oversized = planning.plan(recipe, recipe.checkpoints[0], gpus, context=500000, **base)
assert oversized.context_target == 500000
assert oversized.prepared_context == min(recipe.context, oversized.tokens)

The fixture declares context=262144, page_tokens=64 (:37-38), and its RankCosts (:43) leaves page_tokens unset (ignition/declaration.py, default None), so Plan.page_tokens == recipe.page_tokens == 64 (planning.py:329-332). 500000 % 64 == 32 and the PR adds the rejection at planning.py:289-290, which runs in __post_init__ for every Plan(...) — including the one fit builds at planning.py:528-537, since page_tokens depends only on recipe/costs/context-parallel width. planning.plan(...) therefore raises UsageError("--request-context 500,000 is not a multiple of the 64-token page size") before the assertions run. The head has no CI checks, so it was never executed; no pytest run happened in this review either.

Requested change: fix B2 and this case passes unchanged, becoming the proof of the clamp; alternatively use a page-aligned over-size target such as 524288 (64 × 8192) and keep 100 for the rejection case at :241-242. Why: the new test and the new validation contradict each other; the head cannot be green as written.

B2 — The page-multiple check validates the request, not the served value

planning.py:289-290:

if self.context_target is not None and self.context_target % self.page_tokens:
    raise UsageError(f"--request-context {self.context_target:,} is not a multiple of the {self.page_tokens:,}-token page size")

The core receives prepared_context = min(recipe.context, context_target, tokens) (:371-375, consumed at bootstrap.py:58), so an oversized, unaligned target resolves to a perfectly aligned value yet is rejected: --request-context 262145 on a 256K recipe fails outright though it changes nothing. That contradicts docs/cli-design.md:446 ("below the recipe's maximum"; default "the recipe's maximum context"), the description's "a cap above the pool resolves to the pool capacity, as stock", and the way the rest of plan treats capacity (:370-375 and :538-544 clamp rather than reject). Helios requires both prepared_sequence_tokens and limits.max_sequence_tokens to be multiples of page_tokens and refuses a misaligned core at load (helios/src/model/catalog.rs:43-70) — long after export — so an export-time check is right, on the right quantity.

Requested change (one expression): validate min(self.recipe.context, self.context_target) % self.page_tokens (or prepared_context where available). 100 % 64 = 36 is still rejected, so the existing match="multiple of the" case keeps working. State the settled rule (accept / floor / reject an unaligned oversized target) in docs/cli-design.md:446 and the helptext.


Should Fix

S1 — The cap appears in no printed plan and no recorded measurement (AGENTS.md:452-456)

A plan-carried setting is one whose "plan, printed report, and recorded measurements describe what was prepared". The plan JSON and the manifest now satisfy this (planning.py:432, rebuild_manifest.py:264-265, :390); the other two surfaces do not.

(a) Plan.to_dict (planning.py:432) emits context (pool-bound, :365-368), context_target and checkpoint_context, but not prepared_context, so a pool clamp is silent and the report names a ceiling the prepared core will reject. (b) The printed "Select GPUs" line (serve.py:302-316) enumerates every sibling preparation choice — row-shard-prefill is a one-token addition at :316 — and has no context field. ignition export M --gpus 0 --request-context 131072 prints a byte-identical plan line to stock while preparing graphs and KV pages at a different context: the one number the PR's own VRAM table is a function of is invisible in the terminal. (c) The benchmark record (bench.py:243-248) builds details["configuration"]["preparation"] from a whitelist of 17 to_dict() keys containing no context key at all, so two runs at different caps write identical configurations.

Requested change (three one-liners, each next to existing precedent): add "prepared_context": self.prepared_context beside context_target in to_dict; add a guarded · request context {plan.prepared_context:,} to the serve f-string beside row-shard-prefill; add "context_target", "prepared_context" to the bench tuple beside "row_shard_prefill". Why: five lenses reached this same gap by different routes (silent under-delivery, unrecorded measurement, unstated served value); one implementation closes all of them, and it also makes the pool clamp visible instead of arguing about it.

S2 — Two evidence claims in the description are wrong or unscoped

(a) The VRAM headline is unconditional, but the pool only follows the prepared context under a non-default --kv-cache-limit. helios/src/runtime_core/memory.rs:290-292: page_ceiling returns Ok(None) under KvCacheLimit::Memory, the default mode (docs/cli-design.md:738, :828); only Context and Concurrency size a ceiling from the prepared context (:298-320). The author's own reproduction commands use --kv-cache-limit concurrency and the shipped docs row says so (docs/cli-design.md:446) — the description does not. (b) "a cap above the pool resolves to the pool capacity, as stock" is false. Stock passed plan.recipe.context unclipped (bootstrap.py:58 before this PR); with a target the value is min(recipe.context, target, tokens) (planning.py:373-375), so a cap above the pool can prepare a lower max_sequence_tokens than the same export without the flag — the opposite of "as stock", and a material compatibility change (AGENTS.md:92-94, :103-109). The new test asserts this behaviour (tests/cli/test_planning.py:229-232).

Requested change: add the --kv-cache-limit context|concurrency condition to the headline and to the Result line; state that a cap above the KV pool resolves to the pool capacity and can therefore prepare a lower max_sequence_tokens than no flag. Why: a reader who exports with a cap and runs with defaults will see none of the claimed 16 GB, and the sentence as written reassures the reader exactly where the largest behaviour change occurs. Prefer stating this to changing the clamp: the clamp is correct and keeps the bench check honest (planning.py:248).

S3 — Description mechanics (one bullet)

The four required questions are out of order: measurements and the headline result lead, and the "why" appears only as a Workload line inside Evidence (AGENTS.md:74-80, docs/design-review.md:140-150 (not opened), :172-177). "Verified on one RTX PRO 6000 Blackwell … at main c36a6a02" reads as if the capped numbers were taken at main, though --request-context exists only on this branch (ignition/cli/__init__.py:167, planning.py:176); c36a6a02 is the baseline for the no-flag comparison. "the thirteen recipes' prepare() read context=plan.prepared_context" names a count a reviewer cannot check (recipes live externally, AGENTS.md:9-13) and misplaces the seam, which is ignition/preparation/bootstrap.py:58.

Requested change: lead with the single-model why (a 256K recipe maximum over-provisions per-request KV for the requests a deployment actually serves), then what changed, then the claimed result with its --kv-cache-limit condition, then the measurements; say which side each number came from and drop the recipe count.


Subtract / Simplify

Could remove ~17 of the +98 added lines (≈9 of the +57 test hunk, ≈8 of the +41 code/docs), plus about half the new docs row.

  1. Duplicated test cases — tests/cli/test_planning.py:235-238, :247, :259-265 (~9 lines). context=0 and context=-1 both hit the single context <= 0 check (planning.py:461-462) — keep one (~2). assert d["context"] == capped.context restates :227 (~1). The 7-line "no context_target when unset" block re-proves from_plan's generic add() early return on None (rebuild_manifest.py:350-352), already exercised by the sibling manifest test at :92-106 (~6). Keep the clamp case: after B2 it becomes the proof of the documented no-op — more valuable than deleting it.
  2. Two-arm chunk error — planning.py:697-700 (~5 lines). The stock three-line message already names both numbers, which is all a user needs to pick a remedy; the pass --prefill-chunk-size below N clause restates the constraint. One message against the effective bound with a (default chunk is 4096) clause suffices — the default-chunk arm is reachable only through an explicit target below 4096, since the pool floor is 8192 tokens (MINIMUM_REQUEST_TOKENS at :32, minimum_pages at :336). No test asserts either string.
  3. Three-line help — ignition/cli/__init__.py:167-170 (~2 lines). One clause plus a default, matching --prefill-chunk-size at :163-166, e.g. "cap the prepared per-request context at N tokens, a multiple of the page size; longer requests are rejected (default: the recipe's maximum)".
  4. Docs row — docs/cli-design.md:446 (~half the line). "since the per-request cache allocation is sized from the prepared context" is already at :828-833; "a request that would exceed N is rejected" is restated by this PR's own :1443/:1490 edits; "Command line only; … requires re-export" is the clause --mixed-prefill already carries at :447.
  5. Do not cut — verified load-bearing, previously mis-claimed dead. prepared_context's context_target is None early return (planning.py:373-374): with no target it returns recipe.context, which can exceed the pool-bound context (:365-368) on a memory-constrained host — folding it to self.context would lower the declared max_sequence_tokens with no flag and break the PR's own no-op claim (tests/cli/test_planning.py:220). effective_context = min(result.context, result.prepared_context) (:696) is the clamp that keeps the no-flag path stock, and derive(context=...) (preparation.py:56 (not opened),68) is the funnel all four entry points use. Keep all three.
  6. Not asked: dropping the flag in favour of --kv-cache-limit. Considered and rejected. The runtime flag sizes loaded KV at serve time; it cannot lower the exported max_sequence_tokens, which is the residual datum this PR adds and what closed #454 asked for. The flag stays; only the scaffolding above is subtracted.

Nits

  1. One flag, two validation homes — planning.py:461-462 vs :289-290. The context <= 0 check lives in fit, which plan() re-enters per candidate world size and per shortfall probe (:686-704), while its sibling sits in __post_init__. Move it beside the alignment check, or move both into plan() next to the --prefill-chunk-size block (:622-625). The new tests drive both through planning.plan(...), so moving them drops no coverage.
  2. serve.py:68-69 still describe the pre-cap world. max_body_bytes is sized from recipe.context and context_hint reads "context is limited by the checkpoint and available cache capacity"; with a cap, both misdescribe the served ceiling. Harmless (admission rejects with the documented error) but the last place that treats the recipe maximum as the served context.
  3. ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the effective prepared context once capped.
  4. docs/cli-design.md:1443 says "The checkpoint maximum" where the new flag row and neighbouring rows say "the recipe's maximum" — one term.
  5. Test comments use "stock" as an undefined referent (tests/cli/test_planning.py:217, :227, :247); say "the behaviour without the flag".

Verified clean — do not re-raise

Open questions / could not be found

  1. Did the blockers reproduce? Not run here — both follow from arithmetic (500000 % 64 = 32) and the declared protobuf schema; pytest tests/cli/test_planning.py settles them, and the head has no CI checks.
  2. What is the intended rule for an unaligned target above the recipe maximum — accepted, floored to a page, or rejected? A decision, not a measurement; state it in the docs row.
  3. Should to_dict()["context"] stay pool-bound? The new test pins the current meaning (tests/cli/test_planning.py:247); only a maintainer can say whether external consumers depend on it. Adding prepared_context (S1) makes the question non-urgent.
  4. Do external recipes re-round config.context? Recipes live in hyperflare_recipes (AGENTS.md:381), outside this diff; nothing in this tree rounds, and alignment is enforced in Helios at load — an argument for keeping an export-time check, on the right quantity.
  5. The VRAM table (RTX PRO 6000 Blackwell, Qwen3.8-27B, concurrency 1-4) is the description's claim; nothing in this tree pins the relationship. Only its --kv-cache-limit scoping (S2a) is verifiable.
  6. The commit message body was not checked (git log -1 --format=%B de1b5b5); whether it follows the four-part scheme cannot be settled from this environment.