Pre-Test Report — PR #533 "Cap the per-request context target" (head de1b5b5)
Recommendation: DO NOT refer to hardware testing yet. Return to the author for fixes.
PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · head de1b5b5 · base main · 9 files, +98/−18 · no reviews, no CI checks on 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 and the "Discord:" line are ordinary PR metadata.
I re-verified every review claim against the tree. The reviews disagree about how much is wrong but agree the feature's seam is right; where they disagreed I went to the code, and on two points I side with the newer reviews against the older ones (see "Corrections" at the end).
1. Why testing now would be wasted hardware time
Blocking A — the PR's own added test cannot pass, for two independent verified reasons
This is decisive on its own: the head is not green, so any GPU time would be spent on an artifact the author must change.
(a) tests/cli/test_planning.py:230-232 plans with context=500000 and expects a clamp. The fixture (tests/cli/test_planning.py:37-38) declares context=262144, page_tokens=64, and its RankCosts (:43) leaves page_tokens unset (ignition/declaration.py:174), so Plan.page_tokens == 64 (ignition/planning.py:329-332). 500000 % 64 == 32, and this PR adds at ignition/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")
Plan.__post_init__ therefore raises UsageError and the test errors before its assertion.
(b) tests/cli/test_planning.py:257 asserts by_key["context_target"].value.int64_value. helios/proto/runtime_core.proto:124-133 declares int_value = 2 and uint_value = 3 — there is no int64_value, so this is an AttributeError. Even renamed to int_value it would read 0, because rebuild_manifest._preparation_value (ignition/preparation/rebuild_manifest.py:333) writes non-negative ints as uint_value.
Neither defect is judgement: they are arithmetic and the declared protobuf schema. pytest tests/cli/test_planning.py settles both. The bigger gap behind them: the test never asserts the one line that makes the cap real — common_preparation_kwargs(plan)["context"] == plan.prepared_context (ignition/preparation/bootstrap.py:58) — so it would pass even if the cap stopped reaching the core.
Blocking B — alignment is validated on the request rather than the resolved context, and that needs a decision before testing
planning.py:289-290 checks the raw target, while the value the core receives is prepared_context (planning.py:371-375, consumed at bootstrap.py:58). So --request-context 500000 (or 262145, or any unaligned value above the recipe max) is rejected outright even though it would clamp away to a no-op. That contradicts the PR's own docs row (docs/cli-design.md:446, "below the recipe's maximum") and its description ("a cap above the pool resolves to the pool capacity"). Whether the fix validates the resolved value, floors to a page, or keeps rejecting is a semantics decision, and it changes exactly the behaviour a hardware test would exercise. Testing before it is settled risks testing a behaviour that gets reversed.
Blocking C — the exported ceiling depends on the export host's free VRAM
prepared_context is clamped by self.tokens (planning.py:375), and tokens = pages * page_tokens with pages sized from the exporting host's free supply (planning.py:538-544). Two exports with byte-identical reproduction_args — now including --request-context (rebuild_manifest.py:264-265) — can declare different max_sequence_tokens. It is also a duplicated clamp: Helios already narrows at load (helios/src/model.rs:268-272 fit_context; catalog.rs:49 only requires max_sequence_tokens <= prepared_sequence_tokens). And to_dict() prints the target, never the served value (planning.py:432), so a run cannot be read back to prove what was prepared — which is also the reason a hardware run against this head could not conclude anything.
Blocking D — the evidence still does not isolate what this PR adds
helios/src/runtime_core/memory.rs:284-292: page_ceiling returns Ok(None) for KvCacheLimit::Memory — the default (docs/cli-design.md:738) — and only Context/Concurrency size the pool from ceil(context/page_tokens) × histories. The author's VRAM table was measured with --kv-cache-limit concurrency, so it demonstrates the existing runtime flag, not this PR. What only an export-time cap can do is lower the admission ceiling and advertise a smaller max_model_len (helios/src/server/config.rs:131,148; helios/src/server/request.rs:350 (not opened); helios/src/server/models.rs:81 (not opened)). Without one row showing that difference, our GPUs would mostly re-measure --kv-cache-limit.
Also blocking for a useful test — reachability depends on code outside this repo
BasePreparationConfig.context (ignition/preparation/bootstrap.py:33) must be written by each recipe into the core's max_sequence_tokens. The recipes live in the external local-inference-lab/hyperflare-recipes (AGENTS.md:12, 380-392), and the author has previously described the recipe updates as pending. A test could not confirm the end-to-end claim from this repository alone.
2. Should fix before merge (not test-blocking, but cheap while the author is in the file)
- The cap is missing from the printed plan line and the benchmark record.
ignition/cli/serve.py:302-316enumerates every preparation choice but adds no context field, soignition export M --gpus 0 --request-context 131072prints a byte-identical plan line to stock.ignition/cli/bench.py:243-248buildsconfiguration.preparationfrom a 17-key whitelist with no context key at all, so two bench runs at different caps record identical configurations. Both are one-liners next torow_shard_prefill(serve.py:316,bench.py:247). - Add
prepared_contexttoPlan.to_dict()(planning.py:432) rather than onlycontext_target— it is the value Helios is told to serve, and it removes the "read three keys and combine them" step. - Stale derivations after a cap:
serve.py:68max_body_bytesstill usesrecipe.contextandserve.py:69context_hintstill says "context is limited by the checkpoint and available cache capacity" (the string a user sees on a context rejection);planning.py:325-326demand_pagesisconcurrency × (recipe.context // page_tokens)— printed at:440— so it overstates KV demand for a capped core;ignition/cli/help.py:38(not opened) still advertises--prefill-chunk-size: 64..{recipe.context}. - One flag, two validation homes: positivity in
fit(planning.py:461-462, re-run per candidate world size and per option probe) and the page multiple inPlan.__post_init__(:289-290), against the--prefill-chunk-sizeprecedent that keeps form and range in one block inplan()(:622-625). - Redundant reduction:
effective_context = min(result.context, result.prepared_context)(planning.py:696). With no targetprepared_contextisrecipe.context(≥context), with a target it is ≤context; the min is a no-op. Collapsingprepared_contexttoself.context if self.context_target is None else min(self.context, self.context_target)keeps behaviour and removes both. - Docs/help: the page-multiple requirement (
planning.py:289-290) appears in neither the docs row nor the help, and the required multiple isrecipe.page_tokens × context_parallel_size(planning.py:329-332), not always 64. The docs row also states the VRAM benefit unconditionally, though it holds only with--kv-cache-limit context|concurrency.
These are minor and I would not hold a hardware run for any of them alone — but A–D mean the run should not happen yet anyway.
3. Expected value of a hardware test at this head: LOW
- The artifact is not what would ship: two broken assertions plus an unresolved alignment semantics (B).
- The output cannot prove the cap took effect: the served value is neither printed nor recorded (
planning.py:432,bench.py:243-248). - The headline benefit is an existing runtime flag's behaviour under
--kv-cache-limit concurrency(D). - End-to-end reachability depends on unpublished recipe code.
Genuinely worth validating once fixed: the export-time admission ceiling and the advertised max_model_len, plus an honest default-mode VRAM delta (which may be ~0 and must be reported as such).
4. Conditional test plan (adopt after A–D are addressed)
Phase 0 — GPU-free, must pass first (no hardware time)
pytest tests/cli/test_planning.py tests/cli/test_commands.py, with these cases added or repaired:
prepared_context == recipe.contextwhen the flag is omitted;== min(recipe.context, N)when set.context <= 0rejected; a non-page-alignedNbehaves as the decided semantics say, and the resolved value is asserted% page_tokens == 0.- Both arms of the chunk-vs-context error (
planning.py:696-700). - The seam:
assert common_preparation_kwargs(capped, ...)["context"] == 131072and== recipe.contextfor the unflagged plan (pattern:tests/cli/test_commands.py:88-91withBasePreparationConfig). This is the assertion the current test lacks. to_dict()carriescontext_targetandprepared_context;reproduction_argscontains--request-context; the manifest parameter present withSCOPE_DEPLOYMENT— assertinguint_value, notint64_value.- Parser:
--request-contextexists onexport,bench,debug-serveand not onflare run; the multi-host path forwards it (a--ranks 2plan assertsprepared_context == N) — the only pin available for the_export_hostspath, since we have no second host.
Phase 1 — the cap reaches the core (1 GPU of cn5, SM120; matches the author's hardware)
Model: nvidia/GLM-5.3-Flash-NVFP4. Two exports from the same command, differing only in the flag: A --request-context 131072, B unset. Use one GPU, not four — the change is orthogonal to parallelism except through page size.
/v1/models→max_model_lenis 131072 on A and the recipe maximum on B. This is the one assertion only the export-side value can satisfy.- A prompt of ~132k tokens is rejected at admission on A; a prompt just under the cap is accepted.
flare inspect Ashows the cap and its reproduction command re-exports a 131072 core (validates the recording).- Falsification control: an unaligned
--request-contextfails at planning with an actionable message, not at core load (helios/src/model/catalog.rs:50-57yields the opaque "invalid prepared model configuration").
Phase 2 — VRAM, the isolating comparison the PR owes
Under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency, at concurrency 1 and 4, record total VRAM for A and B. The pair separates this PR from the runtime flag. Expect ~0 delta under memory mode; report that as the result.
Phase 3 — regression (cheap, same job)
A pre-PR core still loads and serves; a no-flag export produces the same preparation config as main (bootstrap.py:58 previously received plan.recipe.context, and prepared_context returns exactly that when unset); --request-context 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 multi-host (no second host available — cn5 is four GPUs on one host, cn7 is a single GB10). Skip cn7 (no ARM64-specific question). Do not run a throughput A/B sweep — the PR makes no speed claim, only a memory and admission-ceiling claim.
5. Bottom line for the referral decision
- Substantive problems that must be fixed first: yes, four — the PR's own test cannot pass (two verified defects), the alignment check validates the wrong quantity, the exported ceiling is export-host-dependent and unprintable, and the evidence does not isolate this PR from
--kv-cache-limit. - Expected value of testing
de1b5b5: low — wrong artifact, unprovable output, dependence on unpublished recipes. - Fix effort is small (two assertions, one alignment decision,
prepared_contextinto_dict, two reporting one-liners, one seam test), so the efficient order is: fix → GPU-free suite green → one targeted 1–2 GPU-hour run on cn5. - Fixed since my previous report, do not re-raise:
_export_hostsnow forwards the flag (serve.py:206); page-multiple validation exists;to_dict/reproduction_arguments/from_planrecord the cap (planning.py:432,rebuild_manifest.py:264-265,:390); bench compares againstprepared_context(planning.py:248); a test exists.
Corrections to the reviews, from reading the code:
- The Subtractive lens's first recommendation — drop
effective_contextatplanning.py:696as a deadmin— is right that theminnever selectscontext, but deleting the comparison would be wrong: the chunk check must still run against the served ceiling. Collapse the property, keep the check. - The Subtractive lens's claim that the whole flag duplicates
--kv-cache-limitoverreaches:memory.rs:284-292/config.rs:131-148show the runtime cannot lowermax_sequence_tokensormax_model_len. The overlap objection is about the evidence, not the capability. - The "multi-model hosting is a charter non-goal" objection is withdrawn: the description and the docs row now justify the cap by same-model concurrency.
Full detail with citations is in scratchpad entries #5 (verified blocker state at de1b5b5), #6 (blocking defects with file:line), and #7 (decision, plan and budget).