Pre-Test Report — PR #533 "Cap the per-request context target" (head 9118add)
Recommendation: DO NOT refer to hardware testing. Return to the author for fixes.
PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · head 9118add · base main · 6 files, +69/−5 · no reviews, no CI checks on the head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen all clear; I independently found no prompt-injection or agent-directed content in the description, diff, docs or comments. The Design-Signed-Off-By/design-review=eb2f trailers and the "Discord:" line are ordinary PR metadata.
I re-verified every review claim against the tree rather than trusting the summaries. The reviews agree that the feature's shape is right and disagree about how much is broken; on several points the summaries are describing older heads and are now stale (see §5).
1. What the change is
After the rebase onto merged #545, the whole feature is one declarative parameter plus one consumer line:
ignition/parameters.py:1309-1321—context_target: int | Nonedeclared on the universalRecipeParametersbase as--request-context, group "capacity and compression",min_value=1,max_fn=_recipe_context_limit,manifest_key="context_target",DEPLOYMENTscope,repro_always=True. CLI registration,MODEL --help, manifest entries and reproduction args are supposed to be generated from this declaration.ignition/planning.py:357-363—Plan.prepared_context:recipe.contextwhen no target, elsemin(recipe.context, target).Plan.context(the pool bound,:352-355) is untouched.ignition/planning.py:186-190— a page-multiple rejection on the raw target inPlan.__post_init__;: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 one 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_lenand enforced at admission.ignition/cli/serve.py:67-68—max_body_bytesfromprepared_context;context_hintnames the cap.tests/cli/test_planning.py:295-329— one new test;docs/cli-design.md:468and:1436— docs rows.
No Rust change, no per-model branch, no new mechanism. The design is correct and should be kept. Omitting the flag is a true no-op.
2. Why testing now would be wasted hardware time
Blocking A — the PR's own test cannot pass, on two independent verified grounds
The head is not green, so any GPU time buys results against an artifact the author must change.
- Above-maximum cap is rejected, not clamped — the test asserts the clamp.
context_targetdeclaresmax_fn=_recipe_context_limit(parameters.py:1316), whose helper returnscontext.recipe.context(:1268-1269).validate_fieldsenforces it in theelifbound branch (parameters.py:533-540, message"--request-context for <alias> must be 1 through 262,144"), reached fromPlan.__post_init__(planning.py:185) and fromplan()before any candidate exists (planning.py:540).tests/cli/test_planning.py:310-313doesreplace(base_params, context_target=500000)against a fixture withcontext=262144, page_tokens=64(:139-140) and asserts the plan is returned withprepared_context == recipe.context, so line 311 raises. (Even without the bound,500000 % 64 = 32trips the alignment check atplanning.py:187.) Consequences: the clamp atplanning.py:363is dead code;docs/cli-design.md:468("resolves to the smaller of N and the recipe maximum") and the description ("min(recipe.context, N)") are false; and a user following the docs gets a usage error. --request-contextnever reachesreproduction_args.RecipeParameters.reproduction_args(parameters.py:1469-1528) hand-emits--max-concurrency/--prefill-chunk-size(:1483-1484), then buildsbase_field_names = {f.name for f in fields(RecipeParameters)}(:1491) and skips every base-class field in its generic loop (:1494).context_targetis a base field (:1309), so it is skipped and itsrepro_always=True(:1319) is dead metadata.tests/cli/test_planning.py:324-325asserts"--request-context"and"131072"are present → fails.rebuild_manifest.reproduction_arguments(:231-261) merely splats the same list, soflare inspectand the embedded manifest record a command that silently rebuilds an uncapped core.
Neither is a judgement call: both follow from the declaration and the message strings. pytest tests/cli/test_planning.py settles them.
Blocking B — a legal cap plus the default prefill chunk exports a core Helios refuses to load
The export-side chunk check still compares against the stock context:
if params.prefill_chunk > result.context: # planning.py:594-596; result.context == min(recipe.context, tokens)
prefill_chunk itself is bounded only by ctx.recipe.context (parameters.py:1458-1462). Nothing compares the chunk against the cap, while bootstrap.py:132 writes prepared_context as max_sequence_tokens and bootstrap.py:44-46 forwards parameters.prefill_chunk as prefill_chunk_size. So --request-context 1024 (or 2048) with the default 4096 chunk passes every export-side check, spends the entire GPU preparation, and then fails at load: helios/src/scheduler.rs:66-77 requires prefill_chunk_size <= max_sequence_tokens, surfaced through helios/src/model/catalog.rs:42. This is the same class of defect the new page check exists to prevent, and it is one flag away from the PR's headline scenario — the stated purpose is pushing memory down.
Blocking C — the artifact cannot be audited or reproduced, so a run's output could not prove what was prepared
Plan.to_dict (planning.py:379-416) emits context, checkpoint_context and (via parameters.to_dict) context_target, but no prepared_context; context_target declares no status_label, so the printed Select GPUs. line (serve.py:268-272 via status_parts, parameters.py:694-707) never mentions the cap; and reproduction_args omits the flag (Blocking A.2). A hardware run against this head could not answer "was the cap applied?" from the plan JSON, the console line, or the inspect command.
Blocking D — the evidence measures a flag that already exists
helios/src/runtime_core/memory.rs:284-292 returns Ok(None) for KvCacheLimit::Memory — the documented default (docs/cli-design.md:740) — and only Context/Concurrency derive a page ceiling from the prepared context. The author's VRAM table was measured with --kv-cache-limit concurrency, so it demonstrates an existing runtime flag, not this PR. The capability is genuinely not a duplicate (the runtime cannot lower max_sequence_tokens or max_model_len, both baked from prepared_sequence_tokens at config.rs:131-148; the runtime clamp at helios/src/model.rs:268-272 only narrows to the physical pool) — which is exactly why the evidence should show that and does not, and why the docs row states the VRAM benefit unconditionally instead of scoping it.
Blocking E — the test also depends on a GPU/FlashInfer environment
tests/cli/test_planning.py:295 takes monkeypatch and never uses it, yet calls rebuild_manifest.from_plan (:323), which calls source_identity() (rebuild_manifest.py:290,327); that raises RuntimeError("the preparation environment requires FlashInfer") when FlashInfer is absent (ignition/preparation/source_identity.py:36-41). Every neighbouring test patches it (:159, :333).
Not testable on our fleet regardless
--ranks > 1 (multi-host export) needs a second host; cn5 is four GPUs on one host and cn7 is a single GB10. The flag now forwards on that path (serve.py:178-199), so it must be pinned GPU-free, not by hardware.
3. Expected value of a hardware test at this head: zero
- The branch's own suite cannot pass — no green baseline.
- A legal flag value produces an unloadable core (Blocking B), so a run would re-confirm a known defect.
- The output cannot show the cap took effect (Blocking C).
- The headline benefit is an existing runtime flag's behaviour (Blocking D).
- End-to-end reachability depends on external
hyperflare_recipesmappingBasePreparationConfig.context→max_sequence_tokens; that code is not in this repository.
Verified clean — do not re-test once fixed: the no-flag path returns recipe.context (planning.py:360-362), exactly what bootstrap.py:132 passed before, so omission is byte-equivalent to main; Plan.context is unchanged; all four entry points forward the flag; the cap reaches the plan JSON, the manifest and SCOPE_DEPLOYMENT; the bench check uses prepared_context; max_body_bytes follows the cap; the frozen dataclass with a defaulted field keeps replace() working; no per-model branch, no env toggle, no Helios change.
4. Conditional test plan (adopt only after A–E 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 is warranted.
Phase 0 — GPU-free, must pass first (no hardware time)
pytest tests/cli/test_planning.py tests/cli/test_parameters.py (not opened) tests/cli/test_commands.py, with these cases added or repaired:
prepared_context == recipe.contextwhen unset;== min(recipe.context, N)when set; and whichever semantics the author settles for an oversize target (clamp, or an explicitUsageError) asserted consistently in test,docs/cli-design.md:468, the help string and the description.- Alignment validated on the served value (
min(recipe.context, target) % page_tokens == 0);100still rejected. - Both arms of the chunk-vs-cap error (
--request-contextbelow--prefill-chunk-size). - The seam that changes the core:
common_preparation_kwargs(capped, ...)["context"] == 131072and== recipe.contextfor the unflagged plan, viaBasePreparationConfig(**kwargs)(pattern:tests/cli/test_commands.py:140-155). The current test never asserts it and would pass ifbootstrap.py:132reverted. reproduction_argscontains--request-context 131072; manifest parameter present withDEPLOYMENTscope (assertuint_value, notint_value).- Parser: flag on
export,bench,debug-serve; absent fromflare run;_export_hostswith--ranks 2carries the cap — the only pin available since we have no second host. monkeypatchused or dropped so the test does not need FlashInfer.
Phase 1 — the cap reaches the core (1 GPU of cn5, not 4; SM120 matches the author's hardware)
Model: nvidia/GLM-5.3-Flash-NVFP4 (present on cn5; closest text recipe to the author's measurement). Two exports from the same command, differing only in the flag: A --request-context 131072, B unset.
/v1/models→max_model_lenis 131072 on A and the recipe maximum on B. 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.- Falsification control: an unaligned
--request-contextfails at planning with an actionable message, not at core load (Helios returns the opaque "invalid prepared model configuration").
Phase 2 — the isolating VRAM 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 — that is the honest result and must be reported as such.
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; --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 cn7 (no ARM64-specific question). Skip multi-host (no second host). No throughput A/B — the PR claims memory and admission-ceiling behaviour, not speed.
5. Corrections to the review summaries
- Stale at this head — do not re-raise: the
derive(context=...)crash and the missing page-multiple validation (both real at02023eba, both fixed:ignition/cli/preparation.py:62-81takesparameters=;planning.py:186-190exists), the export-host free-VRAM term inprepared_context(fixed:planning.py:357-363has notokensterm), and theint64_valuetest assertion (gone;:329asserts only scope). - The Subtractive lens's "drop the whole flag,
--kv-cache-limitalready does this" overreaches.helios/src/runtime_core/memory.rs:284-292andhelios/src/server/config.rs:131-148show the runtime cannot lowermax_sequence_tokens/max_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 docs row and description now justify the cap by same-model concurrency.
- The Architecture lens's B1 and B2, the Correctness B1/B2, and the Conventions/Prose blocking items all reduce to the same two lines (the
max_fnbound vs the documented clamp, and the base-field skip inreproduction_args), plus the chunk-vs-cap asymmetry. Fix effort is small: dropmax_fn(or delete the clamp, the test case and the "smaller of" wording), validate alignment on the served value, emit the flag beside--prefill-chunk-sizeatparameters.py:1484, compare the chunk againstmin(result.context, result.prepared_context)atplanning.py:594, addprepared_contexttoto_dict, add astatus_label, guardcontext_hint, useprepared_contextindemand_pages(planning.py:320-321), and repair the test.
Bottom line: the feature is worth building and the seam is right, but four substantive problems (a red test from two verified causes, a legal flag value that exports an unloadable core, an artifact that cannot be reproduced or audited, and evidence that measures an existing runtime flag) mean hardware time now would test the wrong artifact. Fix → GPU-free suite green → one targeted 1–2 GPU-hour run on a single cn5 GPU.