Pre test report report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/a25e86ad-63b5-42c4-aab8-ff96d364d186.md

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:

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)


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:

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).

  1. /v1/models → max_model_len is 131072 on A, the recipe maximum on B. The one assertion only the export-side value can satisfy.
  2. A prompt just over 131k tokens is rejected at admission on A; a prompt just under is accepted and generates.
  3. flare inspect A shows the cap and its reproduction command re-exports a 131072 core (validates the recording path).
  4. 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