Hardware Test Plan — PR #533 "Cap the per-request context target" (head 503a438)
Verdict: refer to hardware testing, narrowly — ~2–4 GPU-hours on ONE GPU of cn5. Skip cn7. Skip multi-host.
PR #533 adds --request-context N, an export-time cap on the prepared per-request context. It is a memory-sizing and admission-ceiling change with no speed claim, so this plan deliberately contains no throughput A/B. Two things are worth GPU time and nothing else is: (1) does the cap actually reach the exported core (max_sequence_tokens, advertised max_model_len, admission enforcement), and (2) does it buy VRAM that the default --kv-cache-limit memory mode does not already give. Item 2 may honestly measure ~0 — report that, don't hide it.
1. What the code guarantees (verified at 503a438, so you can predict the result)
| Fact | Citation |
|---|---|
Plan.prepared_context = declared_context when unset, else min(declared, N) |
ignition/planning.py:373-375 |
declared_context = adjust_context(recipe.base_context(checkpoint), …) (checkpoint/#212-aware) |
planning.py:363-365, :432-441 |
The single seam into every recipe/core: "context": plan.prepared_context |
ignition/preparation/bootstrap.py:132 (BasePreparationConfig.context, default 262144 at :33) |
| It becomes the served ceiling and is advertised | helios/src/server/config.rs:131,148 → max_sequence_tokens; /v1/models max_model_len at helios/src/server/models.rs:99 |
| Served ceiling is then clamped to physical pages | helios/src/model.rs:263-275 (fit_context) |
| Over-cap request → HTTP 400, before any prefill work, message names the ceiling | helios/src/server/request.rs:577-587; code context_length_exceeded at helios/src/server.rs:743 (not opened) |
Cap also lowers the default output limit (max_new_tokens defaults to max_sequence_tokens) |
helios/src/server/config.rs:210-213 |
| Misaligned in-range N rejected at planning; above-max N silently clamps | planning.py:198-200, :373-375 |
| Prefill chunk must be ≤ served context (export-time rejection) | planning.py:626-629 |
| Cap recorded in plan JSON / manifest / repro args / serve hint | planning.py:407-409, ignition/parameters.py:1529-1530, ignition/cli/serve.py:69-74 |
| Page sizes: Qwen 64, GLM 256, DeepSeek 128 tokens | docs/core-design.md:1480 |
Default runtime mode ignores the cap for pool sizing (page_ceiling → None for KvCacheLimit::Memory) |
helios/src/runtime_core/memory.rs:314-316; default memory per docs/cli-design.md:733 |
Two known head-of-branch defects that can corrupt your reading if you trust the wrong surface (both non-blocking, already reported in the final review):
- The
Select GPUsstatus line printsmin(target, context.recipe.context)(ignition/parameters.py:1606-1607) and can under-report under a checkpoint-declared/adjust_context-scaled ceiling. Trustplan.prepared_contextin the stderr plan JSON,flare inspect, and/v1/models— never the status line. --helprendersdefault: nonefor the flag (parameters.py:1344-1352, nodefault_label). Ignore.
2. Hardware targeting
- cn5 (use): 4 × RTX PRO 6000 Blackwell Max-Q 96 GiB →
gb202/SM120, i.e. the author's exact card family;ignition/planning.py:38accepts it. Use one GPU (--gpus 0); the change is orthogonal to tensor parallelism except through page size (planning.py:334-335). - cn7 (skip): 1 × GB10, arm64. Raises no ARM64-specific question and the
gb10core would need a separate export → wasted GPU time. - Multi-host
--ranks > 1(skip): needs a second host with a rendezvous address; cn5 is 4 GPUs in one host, cn7 is a single device. It is already forwarded correctly (ignition/cli/serve.py:206) and must be pinned GPU-free in Phase 0.
Model: nvidia/GLM-5.3-Flash-NVFP4 (cached on cn5; GLM-5.3 Flash is the model the repo's own examples qualify, docs/model-preparation.md:318, docs/multi-host.md:340). Page size 256 → N must be a multiple of 256.
Preflight before booking the GPU (5 min, no GPU):
df -h ~ /tmp; du -sh ~/.cache/flare/cores ~/.cache/huggingface/hub
A cn5 job gets only 16 GiB scratch. A checkpoint + core for a GLM-class model can exceed that; point paths.core_cache, paths.export_staging, and paths.hub_cache in ~/.config/flare/config.toml (not opened) at a larger writable volume, or the run dies mid-export and burns the booking.
3. Phase 0 — GPU-free, must be green first (zero GPU time)
The head has no CI. Its own new test is tests/cli/test_planning.py:298-329 (stubs source_identity, asserts the bootstrap seam, both rejections, manifest uint_value, repro args). Run:
.venv/bin/python -m pytest tests/cli/test_planning.py tests/cli/test_parameters.py (not opened) tests/cli/test_commands.py (not opened) -q
Then confirm, all GPU-free because planning precedes download (ignition/cli/serve.py:264-290) and derive() (ignition/cli/preparation.py:62-81):
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --request-context 100000 --verbose # expect UsageError "--request-context 100,000 … is not a multiple of the 256-token page size" (planning.py:198-200)
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --request-context 2048 --verbose # expect UsageError "--prefill-chunk-size 4,096 exceeds the 2,048-token context" (planning.py:626-629)
.venv/bin/ignition export glm-5.3-flash-nvfp4 --help | grep -A2 request-context # flag present; note the "Context: X tokens max (page size: 256)" line (help.py:46)
flare-cli/target/release/flare run --help | grep request-context || echo "absent on flare run (correct)"
Record the declared maximum X from that --help line. Set N = largest multiple of 256 ≤ X/2 (e.g. X=262144 → N=131072). Do not hardcode N anywhere below.
Gate: if any of these fail, stop — a GPU run would test code that cannot plan.
4. Phase 1 — does the cap reach the core? (the only genuinely new capability; ~2 exports)
Two exports from the same command, differing only in the flag. A = capped, B = stock.
# A
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --max-concurrency 4 --request-context $N 2> a-plan.json (not opened) | tee a-export.txt
# B (skip only if `flare models list` already holds a stock core for this alias+TP: then reuse it)
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --max-concurrency 4 2> b-plan.json (not opened) | tee b-export.txt
A1 — the artifact (no serving needed). From a-plan.json (not opened) / b-plan.json (not opened):
python - <<'PY'
import json
for f in ("a-plan.json (not opened)","b-plan.json (not opened)"):
p=json.load(open(f))["plan"]
print(f, {k:p[k] for k in ("context","checkpoint_context","prepared_context","tokens","page_tokens","guaranteed_tokens","demand_pages")})
PY
PASS: A prepared_context == $N; B prepared_context == checkpoint_context (the declared max); demand_pages == 4 × prepared_context/page_tokens in each (planning.py:331 — this is the KV-demand number the PR exists to lower).
A2 — the exported core. flare inspect <A entry>:
flare-cli/target/release/flare inspect CACHE_ENTRY_A --json | grep -m1 max_sequence_tokens
PASS: max_sequence_tokens == $N on A, declared max on B; and A's printed reproduction command contains --request-context $N (ignition/parameters.py:1529-1530 → flare-cli/src/inspect.rs:454). This is the reproducibility claim from the closed #454.
A3 — the reachability gate (stop condition). Serve A and B and compare the advertised ceiling:
flare-cli/target/release/flare run CACHE_ENTRY_A --gpus 0 --max-concurrency 4 --kv-cache-limit concurrency &
curl -s localhost:8000/v1/models | python -c 'import json,sys; d=json.load(sys.stdin)["data"][0]; print(d["max_model_len"], d["model_info"]["flare"]["context_length"])'
PASS: A reports exactly $N. B: expect ≥ N and ≤ declared max — not necessarily the recipe max, because Helios narrows the served ceiling to pages × page_tokens at load (helios/src/model.rs:263-275). The pass condition is A == N and B > N, not "B == recipe max".
FAIL here = "the external hyperflare_recipes recipe does not forward BasePreparationConfig.context" — the seam is outside this repo (AGENTS.md:379-396 (not opened)). Stop and report that; do not keep spending GPU time.
5. Phase 2 — admission ceiling, cheap (no long generation)
The 400 is produced from prompt + max_tokens > max_sequence_tokens before any prefill work (request.rs:577-587), so this costs seconds, not minutes. Calibrate the prompt with the CPU-side counter (docs/api.md:13):
curl -s localhost:8000/v1/messages/count_tokens -d '{"model":"…","messages":[{"role":"user","content":"<~1k token text>"}]}'
Then, against A and B:
# accepted on both (a few tokens of generation, then cancel)
curl -s localhost:8000/v1/chat/completions -d '{"model":"…","messages":[{"role":"user","content":"<~1k>"}],"max_tokens":4000}' | head -c 200
# rejected on A only
curl -s -w '\n%{http_code}\n' localhost:8000/v1/chat/completions -d '{"model":"…","messages":[{"role":"user","content":"<~1k>"}],"max_tokens":200000}'
PASS on A: HTTP 400, code: context_length_exceeded, message prompt of P tokens plus an output limit of O tokens exceeds this server's context of $N tokens, and the body carries the context is limited by … the --request-context cap hint (ignition/cli/serve.py:73-74 → helios/src/server/http.rs:57-68). Same request on B (stock) must be accepted — that comparison is the assertion no runtime flag can reproduce, since --kv-cache-limit/--memory-limit cannot lower max_sequence_tokens.
Also record "default output limit" from flare inspect on A vs B: it should drop with the cap (config.rs:210-213) — a real user-visible side effect worth one line in the report.
6. Phase 3 — the isolating VRAM comparison (A/B × kv-limit mode; ~4 serve starts)
At --max-concurrency 4, for A and B, under both pool modes:
for core in A B; do for mode in memory concurrency; do
flare-cli/target/release/flare run $core --gpus 0 --max-concurrency 4 --kv-cache-limit $mode &
sleep 45 # after load settles
nvidia-smi --query-gpu=memory.used --format=csv,noheader -i 0
curl -s 'localhost:8000/metrics?format=json' | python -c 'import json,sys; m=json.load(sys.stdin); print({k:m.get(k) for k in ("total_kv_pages","free_kv_pages","cached_kv_pages")})'
kill %1
done; done
Read total_kv_pages as the primary number (helios/src/server/metrics.rs:1388), with nvidia-smi memory.used as corroboration.
Expected, and this is the honest framing:
--kv-cache-limit concurrency: A's pool should scale as4 × Npages vs B's4 × declared(memory.rs:322-344) → the big delta the PR's table reports. This confirms the mechanism but is partly the runtime flag's documented behaviour.--kv-cache-limit memory(default): pages fill free VRAM regardless of the cap (memory.rs:314-316), so the VRAM delta should be ≈0; the cap's benefit there is admission control only. Report this as the result, not as a failure — and say so explicitly, because the PR description's headline reads as if VRAM shrinks unconditionally (its "reduces KV pool/export size" wording is contradicted byplanning.py:502-511, which sizes pages from supply alone).
7. Phase 4 — regression (same job, ~10 min)
- No-op path: from
b-plan.json(not opened),prepared_context == checkpoint_contextand the core loads and serves identically to amain-built core of the same alias/TP. If a pre-PR core is already cached, justflare runit — it must still load (helios/src/model/catalog.rs:42-69). - Bench record:
ignition bench … --request-context $Nwritesconfiguration.preparationincluding the cap (ignition/cli/bench.py:263-266); one run, no tuning sweep, just confirm two different caps produce different records. --directparity (optional, 1 run):ignition debug-serve … --direct --request-context $N, thencurl /v1/models— served ceiling should be$N(the cap reaches direct execution viaconfig["max_sequence_tokens"],ignition/direct/scheduler.py:202). Cheap confirmation, and it is the one path not covered by the added test.
8. Budget, skip list, stop conditions
| Item | Cost |
|---|---|
| Preflight + Phase 0 (GPU-free) | ~20 min CPU |
| Phase 1 (one export ≈ 30–60 min on one Blackwell; skip export B if a stock core is cached) | 1–2 GPU-h |
| Phase 2 (admission probes) | ~10 min |
| Phase 3 (4 serve starts) | ~45 min |
| Phase 4 (regression) | ~20 min |
| Total | ≈2–4 GPU-hours, 1 GPU of cn5, 1 model, 1 host |
Skip: cn7 (no ARM64 question), multi-host --ranks>1 (no second host — Phase 0 pins it), any throughput or latency sweep (the PR makes no speed claim), any full-context decoding test (Phase 2 replaces it), autotune-effort sweeps.
Stop and report instead of continuing if: Phase 0 fails; the preflight shows <~25 GiB writable scratch for export; Phase 1 A3 shows max_model_len does not move (external-recipe gap); or Phase 1 A2 shows --request-context missing from the reproduction command.
9. What to bring back
prepared_context/demand_pagesfor A vs B (plan JSON).flare inspectcontext + reproduction command for A./v1/modelsmax_model_lenfor A and B, with the< N/> Ncomparison.- The exact 400 body +
code+context_hintfor A, and B accepting the same request. total_kv_pagesandnvidia-smi memory.usedfor the 2×2 grid (core A/B ×memory/concurrency), including the honestmemory-mode delta.- Any mismatch between the
Select GPUsstatus line andprepared_context(expected: the known display bug atignition/parameters.py:1606-1607) — worth reporting as confirmation, not a new blocker. - Whether the external recipe actually forwarded the cap (item 3) — the single fact that decides whether this feature ships working.