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

Raw Markdown for agents: https://autobot.eidonix.com/p/44a92e7f-e6e2-4ac3-89f9-7e3dbeadda04.md

Pre-test report — PR #483 "Gemma 4 image prep profile, bracketed 3×3 packing, atomic spans"

Head f2340e42 (2026-11-22) · base 6d6fe0c6 · 13 files · +732/−164 · no CI checks on head

Verdict: DO NOT REFER TO HARDWARE TESTING YET. Return to author.

Three independent grounds, any one of which is sufficient:

  1. The checked-in generated artifact would regress a feature merged after the branch point (verified two ways, see F1). That is wrong code, not untested code.
  2. A substantive architecture problem sits in the shared upload path (F2) and a second one in shared prompt/scheduling code (F3) — exactly the "will need to be changed" category that must never consume hardware time.
  3. There is nothing on cn5 or cn7 to test it against. No Gemma 4 checkpoint is present on either host, and no in-tree recipe selects the gemma4 image profile (recipes were split into local-inference-lab/hyperflare-recipes by 17bb3c4a). A GPU run today cannot exercise this change end to end at all.

Expected value of a hardware run as the PR stands: near zero. Everything the diff actually changes is CPU-side and deterministic (decode → resize → patch interleave → positions → envelope expansion → upload-layout arithmetic → prompt/span validation). No kernel, no graph, no numeric-precision path is modified. Details and the conditional plan follow.


Findings — blocking (do not test; must be fixed first)

F1. The regenerated Python bindings overwrite main and drop TERMINAL_PREFILL (regression of #479)

Mechanism, verified by reading both refs:

Fix: rebase onto main, regenerate with the pinned protoc so the artifact carries both GEMMA4_IMAGE_PREPARATION = 11 and TERMINAL_PREFILL = 14 at 7.36.2, and show tests/direct/ passing. This is the same class of issue that was treated as a merge blocker on #426.

Review-summary accuracy note: the "explore", "Prose", "Value Proposition" and "Architecture (lens B)" summaries all flagged the pb2 downgrade; only "explore" and "Prose" connected it to #479 specifically. The "Conventions", "Simplicity" and "Correctness" summaries called it a mere nit ("still loads", "not a functional defect") — that understates it, because the failure is not the version tuple but the missing enum in the overwritten descriptor. None of the summaries identified the TERMINAL_PREFILL drop as the decisive defect; I verified it directly.

F2. bracketed_patch_geometry is a model allowlist in shared packing, and changes core-load behaviour

helios/src/frontend/images/packing.rs:16-22:

fn bracketed_patch_geometry(patches_per_feature: usize) -> Result<(i64, usize)> {
    match patches_per_feature { 4 => Ok((2, 1176)), 9 => Ok((3, 768)), _ => Err("unsupported …".into()) }
}

Fix: carry the patch feature width in the prepared contract (e.g. next to patches_per_feature in VisionCapabilities, validated at model.rs:68-87), derive merge_side = patches_per_feature.isqrt() and width = 3·patch_size², and have conditioned.rs, bracketed() and gemma4::process read that one source. Add the load-time cross-check pooling² == patches_per_feature and 3·patch_size² == width.

Review-summary accuracy note: all five lenses independently found this; the most precise framing is the "Conventions" and "Architecture (lens B)" ones (count-keyed allowlist + the DeepSeek 588 counter-example). The "Correctness" summary's claim that this is a load-time break is correct and is the strongest argument for blocking, and no summary pressed it to a blocker.

F3. prompt.rs:137-151 changes scheduling behaviour for every span-declaring layout, with zero tests

if prepared.data.spans.is_empty() && config.contract.frontend.image_tokens.as_ref()
    .and_then(|layout| layout.span.as_ref()).is_some() {
    prepared.data.spans = prepared.conditioned_inputs.iter().map(|i| i.token_span.clone()).collect();
}

Fix: produce the span in layouts/bracketed.rs beside the envelope it computes, make overlap or absence a defect instead of an is_empty() preference, add a Bracketed contract fixture with image_tokens.span set, and add a test that a 1,120-soft-token envelope either fits or is rejected with a named error.


Findings — should-fix before any test run

# Finding Evidence
F4 Parity evidence cannot be reproduced or trusted. Both HF comparison tests return silently (counted as passes) without FLARE_GEMMA4_TEST_SNAPSHOT + ../.venv/bin/python: gemma4.rs:238-244, 253-256, 281-283, 336-339. No CI ran on f2340e4. The description's "45 passed … including Hugging Face checkpoint pixel/position parity" is consistent with the comparison never executing. Inputs are synthetic (x % 256) u8 rasters at 91×37, 10×3000, 3000×10 (gemma4.rs:355, 378-383); geometry_matches_the_hugging_face_processor (:197-216) is a hardcoded table, not a comparison. gemma4.rs:197-216, 236-334, 334-415
F5 Preparation pins one vision tower and hardcodes three tokens without validating them. frontend.py:126-129 pins 27 layers / 1152 hidden / 16 heads / head_dim 72 / 4304 FFN, and :130-137 hardcodes "<|image|>", "<|image>", <image|> with no check that each encodes to one added token — unlike _native_image_placeholder (frontend.py:231-245) which does exactly that for DeepSeek. Repo docs list five Gemma 4 variants (docs/model-preparation.md:345 (not opened), incl. gemma-4-26b-a4b, -31b). Charter's "more than one checkpoint (#74)" is unmet. No pytest for image_settings(profile="gemma4") exists (gemma4 has no match under tests/). frontend.py:113-137, 231-245
F6 Envelope test is scaffolding that proves nothing and leaks a temp file. gemma4.rs:257-299 shells out to Python to build a chat template it never renders, then remove_file only on the success path (:281-283 leaks). FrontendAssets.chat_template is Option (frontend/mod.rs:96-100 (not opened)), and the envelope expansion itself is already covered by layouts/bracketed.rs:104-180. The existing accessor is crate::template_fixtures::template("gemma4", "chat_template.google"). gemma4.rs:236-334
F7 Docs not updated for a new preparation kind / ImageSettings tag / the derived Bracketed stride, though helios/README.md:702-704 (not opened), docs/runtime-core-design.md:226-233 (not opened) and helios/model-contract.md:224-254 (not opened) each enumerate every other profile. Doc-only — does not gate hardware testing, but should land with the code. —
F8 No protobuf round-trip test for tag 11, unlike its precedents (protobuf.rs:726 (not opened), :749). The "additive and wire-compatible" claim currently rests on a hand-run script. protobuf.rs:167-171 (not opened)

Findings — nits (do not block, do not test)

packing.rs:494-502 unsolicited reformatting around a one-token change; redundant h % merge_side check (packing.rs:486) given gemma4.rs:46-48 guarantees the multiple; SUPPORTED_SOFT_TOKENS duplicated (gemma4.rs:11 vs frontend.py:123); self-referential Envelope doc comment (patch_merge.rs:10); layout-name drift in an error string (packing.rs:491).

Verified clean (no action)


Expected value if a hardware test were performed

Low, and currently zero in practice.

Minimal test plan — only if F1–F4 are fixed and the PR is re-referred

Stage 0 is required to make Stage 1 meaningful; skip Stages 2–3 if the author's CI already proves them.

Stage 0 — gate on the author (no hardware). Rebase onto main; regenerate runtime_core_pb2.py at protobuf 7.36.2 and confirm GEMMA4_IMAGE_PREPARATION and TERMINAL_PREFILL are both present (p.GraphOperation.Value("terminal_prefill") == 14); cargo test + pytest tests/preparation tests/direct green; report parity tests with skips made visible (or replaced by a checked-in fixture), not as a bare count.

Stage 1 — CPU correctness (cn5 job, no GPU needed; ~5 min).

  1. cargo test -p helios frontend::images model:: — must include the new Bracketed span test and the load-time pooling² == patches_per_feature rejection.
  2. Misspecification regression (the key new test): build two ImageLimits/contracts, one with patches_per_feature = 4, one = 9, both against a patch_size = 16 Gemma 4 profile; prepare a 91×37 and a 1008×672 image; assert the packed vision_pixel_values length is patches × 768 in both and that the pixel bytes are byte-identical between the two (the width must not depend on the merge factor). Then assert a patch_size = 14 profile is rejected at load, not mis-strided at upload.
  3. Span/scheduling test: a Bracketed contract with image_tokens.span set → data.spans equals the conditioned-input spans, boundaries are the declared start/end tokens; the same contract with max_soft_tokens = 1120 and prefill_chunk_size = 512 → rejected with a nameable error at load or admission, not a generic geometry message; a core already filling spans (DeepSeek fixture) → byte-identical prompt data to main.
  4. Backward compatibility: load one pre-existing prepared core per image layout (DeepSeek, MiMo, Qwen, Step, RADIO, GLM, padded-grid, patch-merge) and confirm each loads and packs exactly as on main — this is the claim the description asserts and nothing currently checks.

Stage 2 — single serving check (cn5, one job, only if a recipe + checkpoint land). One Gemma 4-31B-it run: prepare the core, then two requests — one text-only (regression: must be unchanged) and one with a single image — asserting a 200, that the response mentions plausible image content, and that max_soft_tokens at both a small and the 1,120 setting both admit. Watch specifically for "conditioned input spans or features violate prompt geometry", "invalid bracketed patch-merge image extent", and any prefill-split rejection. One image size larger than the prefill chunk is enough; do not sweep resolutions.

Stage 3 — regression sweep, intentionally minimal (cn5, one job). Serve one non-Gemma vision model (Qwen3.8-27B-NVFP4 on cn7 is the better fit; GLM-5.3-Flash-NVFP4 on cn5 also works) with one image request, to prove the generalized bracketed/tensor_layout path and the pb2 change did not disturb existing vision cores. A single request each — no throughput comparison, no multi-run statistics, no cn7 GB10 arm64 pass unless Stage 1 or CI surfaces an arch-specific failure.

Explicitly not to be tested: throughput/latency A/B on any GPU; alphanumeric carving, EXIF/alpha edge cases for Gemma 4 (untested for every other profile — out of scope, not a regression); the synthetic ultra-wide 10×3000/3000×10 cases on hardware (already covered by the CPU geometry table); second-checkpoint variants until the vision-tower pin in F5 is relaxed.


Summary of review-summary reliability

The five summaries agreed on the substance and were mostly accurate. Corrections and emphasis I applied after direct verification: (1) F1 is a blocking regression of #479 via the overwritten descriptor — three summaries graded it a nit, and no summary named the TERMINAL_PREFILL loss; (2) F2's load-time break for patches_per_feature ∉ {4,9} is the strongest reason to block and appears only in the Correctness lens; (3) the envelope span is tokens + 2 (1122 at the max setting), not +1; (4) the hardware hosts carry no Gemma 4 checkpoint and no recipe selects the profile, which no summary stated and which makes the "worth testing?" question moot regardless of code quality; (5) I found no evidence that the PR discussion or any reviewed text attempted to direct the review — the single bot comment is a case-file notice.