Pre-Test Report — PR #533 "Cap the per-request context target" (head e623985)
Recommendation: DO NOT refer to hardware testing yet. Return to the author for five small fixes, then run one targeted ~1–2 GPU-hour job on cn5.
PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · open · base main · head e623985 · 8 files, +79/−10 · no CI checks on the head, no human review on this head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen all clear; I found no prompt-injection or agent-directed content in the description, diff, docs or comments (the Design-Signed-Off-By/design-review=1af4 trailers, the "Discord: rzr2020" line and the @flare-autobot boilerplate are ordinary process metadata).
I verified every claim below against the tree at this head rather than trusting the review summaries. Four of the five blockers I raised at the previous head (9118add) are genuinely fixed and must not be re-raised. What is left is one test that is environment-dependent and does not test the feature, plus four one-line reporting/validation items. None of them touch the design, which is right.
1. What the change is (verified)
After the rebase onto merged #545 the feature is one declarative parameter plus one consumer line:
ignition/parameters.py:1309-1320—context_target: int | Noneon the universalRecipeParametersbase:--request-context N, group "capacity and compression",min_value=1,manifest_key="context_target",DEPLOYMENTscope,status_label. Nomax_fn— so a target above the recipe maximum is not rejected, it clamps.ignition/planning.py:357-363—Plan.prepared_context:recipe.contextwhen unset, elsemin(recipe.context, target).Plan.context(:352-355,min(recipe.context, tokens)) is untouched.ignition/planning.py:186-190— page-multiple rejection, correctly gated ontarget <= self.recipe.context, so an oversized unaligned target is the documented no-op rather than an error.ignition/planning.py:212— the bench pre-check now comparesrequired_context > self.prepared_context.ignition/preparation/bootstrap.py:132—"context": plan.prepared_contextincommon_preparation_kwargs(wasplan.recipe.context). This is the only line that reaches the core:BasePreparationConfig.context(bootstrap.py:33) → Heliosprepared_sequence_tokens(helios/src/server/config.rs:131) →limits.max_sequence_tokens(:148), advertised asmax_model_len(helios/src/server/models.rs:81(not opened)), enforced at admission (helios/src/server/request.rs:350(not opened)), pool-clamped at load (helios/src/model.rs:268-272).ignition/parameters.py:1484-1485—--request-contexthand-emitted inreproduction_argsahead of the base-class skip at:1492-1495;ignition/preparation/rebuild_manifest.py:327,331therefore carry it into the manifest andflare inspect.ignition/cli/serve.py:67-70—max_body_bytesfromprepared_context;context_hintnames the cap only when it binds.tests/cli/test_planning.py:295-329(new test),docs/cli-design.md:449 (not opened),468,1436,docs/preparation-development.md:17-19,ignition/cli/help.py:46(not opened).
No Rust change, no per-model branch, no new mechanism, and the flag reaches all four entry points (serve.py:180→193-201 multi-host, serve.py:263 / :455-459 single-host, bench.py:186-189). Omitting the flag returns recipe.context, exactly what bootstrap.py:132 passed before.
2. Why testing this head now is still not the efficient move
Blocking A — the PR's own test will fail on any host without FlashInfer, and it does not test the feature
tests/cli/test_planning.py:295-329 calls rebuild_manifest.from_plan(...) at :323 but — unlike its three siblings at :159, :223, :333 (and tests/cli/test_parameters.py:296 (not opened)) — never patches ignition.preparation.source_identity.source_identity. from_plan calls it (rebuild_manifest.py:290,327), and that function imports flare_heliopause and raises RuntimeError("the preparation environment requires FlashInfer") when find_spec("flashinfer") is None (ignition/preparation/source_identity.py:35-41), or "FlashInfer native source directory is unavailable" when data/include/data/csrc are missing (:76-81). The test takes monkeypatch and never uses it — the tell that the stub was dropped. Even where FlashInfer is present the test hashes the ignition, FlashInfer and native source trees on every run.
Worse for our purposes: the test asserts nothing about the line that makes the cap real. Revert bootstrap.py:132 to plan.recipe.context and every assertion at :301-329 still passes — the accessor, the errors, the manifest and the reproduction args are all still correct while the exported core is built for the wrong context. Per AGENTS.md:194-199 ("Tests must exercise the affected behavior or contract") that is the missing coverage, not a nit.
Fix (small): add the one-line monkeypatch.setattr(...), and replace the arithmetic assertions with two seam assertions in the existing house pattern (tests/cli/test_commands.py:150-153):
assert BasePreparationConfig(**common_preparation_kwargs(capped, compile_forwards=True,
kernel_cache=None, retain_graphs=False)).context == 131072
assert BasePreparationConfig(**common_preparation_kwargs(stock_plan, ...)).context == recipe.context
plus one pytest.raises(UsageError, match="prefill-chunk-size") for context_target=2048 with the fixture's 4096 chunk — the new safety check at planning.py:594-597 is currently untested.
Blocking B — the printed plan reports a context the core does not serve
status_label is invoked with the raw field value (parameters.py:1558), so --request-context 500000 on a 262,144-token recipe prints request context 500,000 tokens in the "Select GPUs" line (serve.py:260-274) while PreparedContext clamps to 262,144. AGENTS.md:452-456 requires the plan, its printed report and its recorded measurements to describe what was prepared. status_parts (parameters.py:1541-1563) has the ParameterContext, so the clamp is available there. One-line fix; keep the raw request visible in the manifest.
Blocking C — the served extent is absent from the plan JSON
Plan.to_dict (planning.py:379-416) emits context (pool-bound), checkpoint_context and context_target (via param_dict) but never prepared_context. That dict is printed by export (serve.py:206) and bench (bench.py:194) and folded into the bench record (bench.py:263-266). Without it, a test engineer cannot tell from the artifact whether the cap took effect — which is precisely the question a hardware run is supposed to answer.
Blocking D — the bench bound got looser on the uncapped path
planning.py:212 changed from selection.required_context > self.context to > self.prepared_context. Uncapped, prepared_context == recipe.context while context == min(recipe.context, tokens) (:352-355), so on any memory-constrained host (tokens < recipe.context) the check now admits bench selections the prepared core cannot serve, and they fail only after model download, autotuning and graph capture at ignition/bench/runner.py:388. Fix: min(self.context, self.prepared_context), the same shape as planning.py:594.
Together A–D mean a GPU run now would be spent on an artifact whose own suite is not green and whose output cannot demonstrate the feature. That is exactly the hardware time we should not spend. Fixes are ~10 lines.
Should fix while the author is in the file (not test-blocking)
planning.py:320-321—demand_pagesstill usesrecipe.context, so the printed/JSON KV demand overstates the number this flag exists to lower.parameters.py:1319— the help says the value "must be a multiple of the page token count" unconditionally, butplanning.py:187deliberately skips the check above the recipe maximum. One clause ("ignored above the recipe maximum") closes it.docs/cli-design.md:468(not opened) — should say a cap also lowers the default output allowance (max_new_tokensdefaults tomax_sequence_tokens,helios/src/server/config.rs:210-213) and must be at least the prefill chunk.- Description: state that the VRAM result holds under
--kv-cache-limit context|concurrency(see §3), and thatfit_contextclamps the prepared extent to the physical pool (helios/src/model.rs:261-273) — the description currently attributes theminto Helios.
3. Expected value of a hardware test: low now, moderate-to-good after A–D
The capability is real and is not duplicated by any runtime flag. --kv-cache-limit context|concurrency and --memory-limit shape the KV pool at load (helios/src/runtime_core/memory.rs:238-331); neither can lower max_sequence_tokens or the advertised max_model_len, both baked from prepared_sequence_tokens at load (config.rs:131-148, server/models.rs:81 (not opened)). Prepared-and-honestly-advertised shorter context is an export-time decision and this is the smallest seam for it. I disagree with the subtractive lens's "drop the flag, --kv-cache-limit already does this": the overlap objection is about the evidence, not the capability.
But the evidence does not isolate this PR. page_ceiling returns Ok(None) for the default KvCacheLimit::Memory (memory.rs:290-292; default memory per docs/cli-design.md:740 (not opened)), and export-side page sizing is untouched (planning.py:471-479 fits pages from host free memory; demand_pages still uses recipe.context). So the author's 16 GB table, measured with --kv-cache-limit concurrency, largely re-measures the existing runtime flag. What only this flag buys must be measured, not re-confirmed, and that is what the plan below does.
Not testable on our fleet regardless: --ranks > 1 needs a second host (cn5 is four GPUs on one host, cn7 a single GB10). It must be pinned GPU-free. Reachability also depends on the external hyperflare-recipes mapping BasePreparationConfig.context → max_sequence_tokens; the author states recipe updates are still pending, so any hardware run should confirm the model under test actually honours it (step 1 below does).
4. Test plan — adopt only after A–D are fixed and the GPU-free suite is green
Deliberately minimal: this is a memory-sizing and admission-ceiling knob with no throughput claim, so no A/B perf sweep.
Phase 0 — GPU-free, no hardware time
pytest tests/cli/test_planning.py tests/cli/test_commands.py tests/cli/test_parameters.py (not opened), with:
- seam assertions:
common_preparation_kwargs(...)["context"] == 131072capped,== recipe.contextunset; context_target=0rejected (exists),100rejected as non-multiple (exists),500000clamps (exists),2048+ 4096 chunk rejected (missing);to_dict()carriesprepared_context;reproduction_argscontains--request-context 131072; manifestcontext_targetpresent withDEPLOYMENTscope;- parser: flag present on
export,bench,debug-serve, absent fromflare run; --ranks 2plan carries the cap (the only pin available for multi-host);source_identitystubbed so the file needs no FlashInfer.
Phase 1 — the cap reaches the core (1 GPU of cn5; SM120 matches the author's card)
Model: nvidia/GLM-5.3-Flash-NVFP4. Two exports from the same command, differing only in the flag; one GPU, not four (the change is orthogonal to parallelism except through page size).
- A:
ignition export … --request-context 131072· B: unset.
/v1/models→max_model_lenis 131072 on A, the recipe maximum on B. The one assertion only the export-side value can satisfy.- A prompt just over 131k tokens is rejected at admission on A; a prompt just under is accepted and generates.
flare inspect Ashows the cap and its reproduction command re-exports a 131072 core (validates the recording path).- Falsification control:
--request-context 100000(not page-aligned) fails at planning with an actionable message, not at core load with Helios's opaque "invalid prepared model configuration" (helios/src/model/catalog.rs:50-57,70).
Phase 2 — the isolating VRAM comparison the PR owes
At concurrency 1 and 4, record total VRAM for A and B under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency. The pair separates this PR from the runtime flag. Expect ~0 delta under memory — that is the honest result and must be reported as such, not as a failure.
Phase 3 — regression (cheap, same job)
A pre-PR core still loads and serves unchanged; a no-flag export at this head produces the same preparation config as main (the no-op path); --request-context is still absent from flare run.
Budget / efficiency
~2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one model, one host. Skip cn7 (no ARM64-specific question). Skip multi-host (no second host — pinned GPU-free in Phase 0). No throughput A/B.
5. Bottom line for the referral decision
- Substantive problems that must be fixed before testing: yes, four (A–D) — a test that cannot run here and never exercises the feature; a printed plan that names a context the core does not serve; a plan JSON that omits the served extent; a loosened bench bound that defers failure past full GPU preparation. All are ~10 lines.
- Fixed since my last report — do not re-raise: the
max_fnthat made the clamp unreachable is gone; the page check is correctly gated totarget <= recipe.context;--request-contextis emitted inreproduction_argsand the manifest; the prefill-chunk guard usesmin(result.context, result.prepared_context);status_label,max_body_bytes, the conditionalcontext_hint,help.py:46(not opened) and both docs enumerations are in place; multi-host export forwards the flag. - Expected value: low at this head, moderate-to-good after A–D. The export-time admission ceiling is genuinely unique to this flag and worth one short GPU run; the VRAM headline is an existing runtime flag's behaviour and should be measured with the default
memorymode reported honestly alongside. - Order of operations: fix (~10 lines) → GPU-free suite green → one targeted 1–2 GPU-hour job on a single cn5 GPU.