Subtractive report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/0e498547-4721-473e-a3f0-171873bafd5b.md

Subtraction review — PR #533 "Cap the per-request context target"

Key findings


Findings, ranked by lines saved

1. Blocking — the flag re-implements a runtime setting, and 28 of the 35 added lines exist only to feed one datum (~28 lines)

Where: ignition/cli/__init__.py:167-170 (4), ignition/cli/preparation.py:56,68 (2), ignition/cli/bench.py:176-177 (2), ignition/cli/serve.py:289,472 (2), ignition/planning.py:176,368-373,453,459-460,535,591,674 (~18), docs (3+); the only load-bearing survivor is ignition/preparation/bootstrap.py:58.

What goes: the whole --request-context flag, the Plan.context_target field, the context= keyword on plan()/fit()/derive(), the positive-value check, the prepared_context property, and the chunk-branch rewrite.

Replaced by: nothing. The pool cap is already served by --kv-cache-limit concurrency (docs/cli-design.md:828-833), applied at core load without another export — which is what the PR's own measurement uses.

Why nothing is lost: the PR's charter hook is AGENTS.md:165-169, which requires "a demonstrated defect, a measured performance or memory problem". The memory problem demonstrated is already solved by the runtime flag; the only residual behaviour is that max_sequence_tokens (ignition/direct/scheduler.py:110 (not opened)) matches the cap. If a maintainer decides that residual is wanted, the smallest shape is one Plan field + one plan()/fit() keyword + bootstrap.py:58 + one docs row (~7 lines instead of 35 — see finding 2-5 for the remainder of that shape).

Lines saved: about 28 of the 35 added.


2. Should fix — Plan.prepared_context duplicates Plan.context (~4 lines)

Where: ignition/planning.py:368-373, and its second consumer at ignition/planning.py:694.

Plan.context (planning.py:363-366) is min(self.recipe.context, self.tokens). The new property returns min(self.recipe.context, self.context_target, self.tokens) — exactly min(self.context, N). The five-line body collapses:

@property
def prepared_context(self) -> int:
    """The context the prepared core serves per request."""
    return self.context if self.context_target is None else min(self.context, self.context_target)

and the call site at :694 (effective_context = min(result.context, result.prepared_context)) becomes redundant, since prepared_context <= context always. Why nothing is lost: identical value for every input, including the omitted-flag case (returns recipe.context). Lines saved: 2 in the property (4 with its extra min), 2 at the call site.


3. Should fix — the two-message chunk branch adds 6 lines to say what the 3-line error says (~6 lines)

Where: ignition/planning.py:692-701 (+7/−3).

Stock was:

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

The PR turns it into a 9-line block with a nested if prefill_chunk is None branch and a second error string, only because a recipe default chunk can now exceed a small --request-context. The generic message already names both numbers, which is what a user needs to pick either remedy. Smaller, one message:

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

Why nothing is lost: same condition, same numbers, same remedies. No test asserts either new string (grep of tests/ for request-context, prepared_context, context_target → no matches). Lines saved: 6.


4. Should fix — the docs state the cap three times, and advertise out-of-scope multi-model hosting (~3 lines)

Where: docs/cli-design.md:446 (one very long new row) and the PR's other two edits at :1443 and :1493.

:446 repeats (a) the reject behaviour, already written at :1443 and :1493 by this same PR; (b) "the per-request cache allocation is sized from the prepared context", already documented for every core at :828-833; (c) "Command line only; … requires re-export", already carried by --mixed-prefill (:447) and by the --kv-cache-limit note (:874-876). One row suffices:

| `--request-context N` | Cap the prepared per-request context and `max_sequence_tokens` at `N` tokens. Command line only; changing it requires re-export. | The recipe's maximum context |

and the :1443/:1493 rewords can be dropped (the flag then appears once, in the flag table). The removed prose also carries "a memory-constrained multi-model deployment", which AGENTS.md:171-174 rejects as scope expansion. Lines saved: ~2 doc lines plus roughly half of row :446.


5. Nit — derive()'s new parameter is a pure pass-through; the setting is invisible in the plan report (~2 lines, plus a consistency gap)

Where: ignition/cli/preparation.py:56 (added keyword) and :68 (context=context forward).

All three callers pass args.request_context or nothing (bench.py:177, serve.py:289, serve.py:472) — there is no per-command variation to justify the extra hop; pass it where it is used or drop it with the flag (finding 1). Lines saved: 2.

Separately, Plan.to_dict() (ignition/planning.py:389-442) records every other plan setting (context, checkpoint_context, prefill_chunk, mixed_prefill, …) but not context_target/prepared_context, even though AGENTS.md:452-456 requires the plan, its printed report and recorded measurements to describe what was prepared, and bench.py:237 publishes plan.to_dict() as details["configuration"]. As a subtraction this reinforces finding 1: the field has no reporting consumer, only bootstrap.py:58.


Left behind (dead or inconsistent after the change)

File-by-file confirmation that nothing else can be cut

Already minimal: the flag's help text and the bootstrap.py swap are as short as they can be; the change is not padded with tests or comments, and adds no new helper, type or constant that duplicates a repository one.

Open questions / not found