Subtractive report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/118ff634-3ef7-4586-acb1-82213827dff0.md

Verdict: make it smaller first

The change: +79 / −10, 8 files at head e6239855 — code+docs +42/−10 across 7 files, tests +37/−0 in tests/cli/test_planning.py.

Could remove: about 15 lines in 6 places with the flag kept; about 68 of the 79 if the maintainers decide the per-request cap belongs entirely to the existing runtime --kv-cache-limit (a scope call, not a code defect).

Key findings

The mechanism is genuinely small and well placed: one optional ParamSpec field (ignition/parameters.py:1309-1320), one Plan accessor (ignition/planning.py:357-363), one line at the seam every recipe consumes (ignition/preparation/bootstrap.py:132, "context": plan.prepared_context), and two serve-side bounds. I would not ask for its shape to change. What is left to cut is redundancy inside that shape: 15 of the 79 added lines, ranked below. The one thing that would cut the change by an order of magnitude — dropping the flag — is a maintainer judgement I can show the cost of but not the answer to.

Nothing is left behind: ignition/cli/serve.py:67 (max_body_bytes) and :68 (context_hint), ignition/cli/help.py:46, and ignition/preparation/bootstrap.py:132 all follow the cap; no helios/ path becomes dead; the kvcache_limit machinery is untouched. No attempt to direct the reviewer was found in the description, the diff, or the docs.

Nothing was executed. Every claim below is a static read at head e6239855, which carries no CI checks; the totals are read off pr_diff, and the savings are line counts of the cited ranges, not measurements. The VRAM table is the author's measurement and I did not reproduce it.


1. Blocking on size (conditional on the argument) — drop the whole surface: ~68 of 79 lines

What goes: ignition/parameters.py:1309-1320 (+12), :1484-1485 (+2), ignition/planning.py:186-190 (+5), :212 (1 changed), :357-363 (+8), :594-597 (+2/−2), ignition/cli/serve.py:67-70 (+3/−2), ignition/cli/help.py:46 (+1/−1), ignition/preparation/bootstrap.py:132 (+1/−1), docs/cli-design.md:448/468/1436 (+3/−2), docs/preparation-development.md:17-19 (+2/−1), tests/cli/test_planning.py:295-329 (+37). Replaced by: nothing.

Why the case is arguable: the PR's own evidence is measured under an existing runtime flag that needs no re-export — --kv-cache-limit concurrency (docs/cli-design.md:740: "KV history ceiling | Runtime --kv-cache-limit"; the PR description's workload line: "served at concurrency 1–4 (--kv-cache-limit concurrency)"). The stated conclusion, "the effective per-request context never exceeds the pool capacity", is exactly what that flag already does at load (helios/src/model.rs:268 fit_context clamps max_sequence_tokens to pages × page tokens). The charter asks for "a measured performance/memory issue" (charter line 35) before new options, and closed PR #454 asked for a workload statement that --kv-cache-limit already meets.

The honest surviving delta: a per-request ceiling that is independent of the pool — --kv-cache-limit context caps the aggregate to one context, not min(context, N) per slot — plus a smaller exported max_sequence_tokens, which makes serving reject an over-long request instead of admitting then evicting it. Whether that is worth a new user-visible flag and 79 lines (AGENTS.md:188-193 (not opened), no configuration switch without a concrete requirement) is a maintainer call: keep the flag and take findings 2–6 (~15 lines); or let --kv-cache-limit own the memory problem and drop all 68. Ranked first only on size.

2. Should fix — 6 of the 37 new test lines (tests/cli/test_planning.py:295-329)

assert {p["key"]: p["scope"] for p in manifest["parameters"]}["context_target"] == "PREPARATION_PARAMETER_SCOPE_DEPLOYMENT"

Saves 6. Keep :302 (no-target is a no-op), :308 (the property), :310-313 (the only case exercising the target <= recipe.context gate's false branch), :315-321 (both UsageErrors), and :324-325 (the reproduction_args emission) — those are the new behaviour.

3. Should fix — 3 code lines, plus 1 at the prefill-chunk bound

ignition/planning.py:357-363:

    @property
    def prepared_context(self) -> int:
        """The context the prepared core serves per request; the recipe max when no target is set."""
        return min(self.recipe.context, self.parameters.context_target or self.recipe.context)

Four body lines to one. Safe because min_value=1 (ignition/parameters.py:1315) makes a resolved target never 0, and no max_fn caps it any more, so the min is live and must stay. Keep the docstring and the None semantics — with the target omitted this returns the recipe max unchanged, which is what makes the flag a no-op.

The same redundancy shows at ignition/planning.py:594-597, where the new local exists only to be compared once:

        if params.prefill_chunk > min(result.context, result.prepared_context):
            raise UsageError(f"--prefill-chunk-size {params.prefill_chunk:,} exceeds the "
                             f"{min(result.context, result.prepared_context):,}-token context this plan allows")

One line saved, or keep the local if the double min reads worse — a judgement call, not a requirement.

4. Should fix — 2 lines: a two-message hint for one behaviour (ignition/cli/serve.py:68-70)

        "context_hint": "context is limited by the checkpoint, cache capacity, and --request-context cap",

One string, 3 lines to 1. Cost: the unset case mentions a flag that was not passed. Everything else in the hint is static prose (capacity_hint at :71), so the conditional is inconsistent with its neighbour; if the distinction matters it belongs in the docs row, not here. :67 (max_body_bytes from plan.prepared_context) is load-bearing and stays — the body limit must not contradict the exported context.

5. Should fix — 2 lines that restate ParamSpec defaults (ignition/parameters.py:1316-1317)

        manifest_key="context_target",
        scope=ParameterScope.DEPLOYMENT,

Both are derivable: manifest_parameters falls back to dc_field.name when manifest_key is None (ignition/parameters.py:607-612) and RecipeParameters.manifest_prefix is None (:334), so the key stays context_target; scope defaults to ParameterScope.DEPLOYMENT (:89). Caveat for whoever applies this: the sibling prefill_chunk spec spells both out (:1303-1304), so deleting them here makes the two neighbours inconsistent. Either way costs nothing behaviourally — the manifest-scope assertion in finding 2 is the test that would catch a mistake.

6. Nit — 1 line with no reader (ignition/planning.py:396)

"checkpoint_context": self.recipe.context, is emitted into the printed plan JSON and read nowhere: search_code for checkpoint_context returns only this line. This PR is adding a second context key beside it ("context": self.context at :395), i.e. the same confusion it supersedes; drop the dead key rather than carry two. Saves 1 line. (Not in this PR's diff, but the change is what makes it stale.)

7. Prose only, 0 lines — two doc redundancies

docs/cli-design.md:1436 (the owner table's "Context limit" row) is not a duplicate — it names the deciding surface — keep it. ignition/cli/help.py:46 ("tokens max … --request-context can lower this") is a single-line change describing the recipe, keep it.


Do not cut (verified load-bearing)

Left behind

None. Checked: ignition/cli/serve.py:67 and :68, ignition/cli/help.py:46 now follow the cap; ignition/parameters.py:1484-1485 reaches reproduction_args; no helios/ or ignition/preparation/ path becomes dead; the kvcache_limit machinery and ignition/planning.py's Plan.context are untouched by this diff.

Open questions and limits