PR #483: Add Gemma 4 image prep profile, bracketed 3x3 packing & atomic spans

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/dd63dd77-4a62-4b14-865c-72cc7f26f59a

Opened by a workflow run, Nov 24, 2026 9:23 AM EST.

screen malicious

Screen Result: All Clear

Evidence:

Open questions: whether the precision/patch-geometry refactor in packing.rs:16-22 is covered by parity tests for every patches_per_feature, and why no CI runs on the head commit.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: rickybrent (no GitHub association with the repo; 0 merged, 1 open PR in 180 days — #484, same day; Discord ran.cossack) Motivation: Gemma 4 is already a supported text model here, but its image half was missing: Helios had no way to turn a picture into the 16×16 patches, (x, y) positions and 3×3 pooling Gemma 4 expects, and ImageLayoutKind::Bracketed was hard-wired to 2×2 merge. This adds a native Rust Gemma 4 image preprocessor plus the profile wiring, and feeds atomic image spans to the prefill scheduler. Scale: +732 / −164 lines in 13 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes

The change is aimed at the right layer and the right problem, and it is built in the style the project already uses. It should not merge as-is: it carries a downgraded generated artifact, a hardcoded geometry table that contradicts its own stated goal, and one shared-code change (populating data.spans) with zero test coverage. Fix those five or six specific things and it is mergeable.

Charter fit: mostly good

Right layer. The charter says Helios "shouldn't accumulate per-model branches (#267, #334)" — but image preparation is already an explicit, enumerated extension point, not an ad-hoc branch. docs/model-contract.md:226-227 (not opened): "Tool parsers, reasoning parsers, image preparation, and image layouts each have an independent enum selector. Implementations are reusable syntax or image [implementations]." There are already eleven profiles (qwen, mimo, deepseek4, deepseek_row_major, moonvit, step, radio, glm, patch_merge, padded_grid), and the most recent, padded_grid, was added by a maintainer (Luke Alonso, 8628b7c5). Adding a twelfth profile is the sanctioned shape, not a violation.

Not a new model alias. It adds a preparation profile for a family the repo already supports: docs/model-preparation.md:345 lists gemma-4-e2b, -e4b, -12b, -26b-a4b, -31b and NVFP4 variants. The PR's Ignition side pins geometry shared by all of them (ignition/preparation/frontend.py:126-129: 27 layers, 1152 hidden, 16 heads, head_dim 72, 4304 FFN), so "more than a single checkpoint (#74)" is structurally satisfied — but see the evidence gap below.

A real gap. Today's Gemma 4 fixture has no image support at all: helios/tests/support/contracts/gemma4_frontend.json:16-17 (image_preparation: null, image_layout: null) and :38 (image_tokens: null). So Gemma 4 is text-only in Helios, and this PR is what unblocks images for it. That is a genuine user-facing benefit for people running Gemma 4 locally, which is exactly the focus the charter asks for.

Fits several "how we work" rules. The proto changes are strictly additive (ImagePreparationKind value 11, ImageSettings.profile tag 11 — helios/proto/runtime_core.proto:386,522), so existing cores stay wire-compatible. The Bracketed validation is generalised rather than special-cased: tokens.checked_mul(patches_per_feature) == patches replaces the old tokens == patches/4 && patches_per_feature == 4 (helios/src/frontend/images/packing.rs:488, cf. :527 in class_token, which was left alone). Extracting patch_merge::Envelope (helios/src/frontend/images/patch_merge.rs:11-81) instead of copying the envelope logic is the right call, and it reuses resize::resize rather than adding a second resampler. That is the "smallest footprint in shared code" the charter asks for.

Costs

Must fix before merge

  1. The checked-in protobuf is a downgrade. ignition/preparation/runtime_core_pb2.py:5 goes from Protobuf Python Version: 7.36.2 to 7.36.1, and :16 from minor 2 to 1. Main's file was generated at 7.36.2 (from #430) and pyproject.toml:34 pins protobuf>=7.36.2,<8. Regenerate with the pinned toolchain per helios/manifest.md:468-472. This is a "pin everything (#215)" violation and would make the artifact look tampered with in review.
  2. The hardcoded geometry table defeats the PR's own claim. helios/src/frontend/images/packing.rs:16-21 matches 4 => (2, 1176), 9 => (3, 768) and errors otherwise. The PR description says the stride and width are "derived ... directly from patches_per_feature ... with no model-identity branching"; a two-entry literal match is a model-identity branch in disguise. Worse, the same constant is written three times: gemma4.rs:159 computes 3 * patch_size * patch_size, packing.rs:19 hardcodes 768, and conditioned.rs:192 hardcodes 768. Derive both from the profile/contract (e.g. carry patch feature width or the merge side next to patches_per_feature in VisionCapabilities), or at minimum from one shared helper. A future 2×2-merge encoder with 588-wide patches will otherwise silently fail upload.
  3. The spans change has no test. helios/src/model/prompt.rs:137-151 now fills prepared.data.spans for any layout whose ImageTokenLayout declares a span. That is shared code affecting scheduling (helios/src/scheduler.rs:1913-1934, helios/src/server/runtime.rs:1460 (not opened)) for models beyond Gemma 4. Add tests for: (a) a span-declaring Bracketed layout gets spans equal to the conditioned input token spans; (b) layouts that already fill spans (ImageLayoutKind::Deepseek, which pushes at helios/src/frontend/images/layouts/deepseek.rs:149) are unchanged, since the is_empty() guard is the whole safety argument; (c) a layout with no span stays empty (helios/src/model.rs:452-454 still rejects it).
  4. Preparation doesn't validate what it will later depend on. ignition/preparation/frontend.py:130-137 hardcodes "<|image|>", "<|image>", "<image|>" with no check that each encodes to one atomic token — contrast _native_image_placeholder (frontend.py:231-245), which does exactly that for DeepSeek. Today a tokenizer mismatch only fails at request time inside Envelope::expand (patch_merge.rs:38-48). Also: max_soft_tokens up to 1120 produces an image span of up to 1122 tokens, but validate_prompt_data rejects any span longer than prefill_chunk_size (helios/src/model.rs:420-423, again at scheduler.rs:1926). Nothing validates that pair at preparation, so a recipe with a 512-token prefill chunk could export a core that rejects its own large images at admission. Reject the combination during preparation, with the reason stated.
  5. Make the parity evidence durable. Both Hugging Face parity tests return silently unless FLARE_GEMMA4_TEST_SNAPSHOT and ../.venv/bin/python exist (gemma4.rs, the two tests near the end of the file), so CI proves nothing here — the 45-passing claim is a local run. Follow the patch_merge.rs:174-212 precedent but gate it on a checked-in fixture of reference pixels/positions rather than a live transformers import, or record the environment in the test output. The exactness claim is also narrower than it reads: f32 parity is against synthetic arange images at 91×37, 10×3000 and 3000×10. One real photograph and one second Gemma 4 checkpoint (the 26B-A4B or E4B, not just the 31B snapshot) would make the "#74 / prove it exports and serves" case.
  6. Add the missing Ignition test and doc note. There is no pytest for image_settings(profile="gemma4") despite the new strict _expected() pins at frontend.py:113-129 — and those pins are exactly the kind of checkpoint-contract assertions this repo tests elsewhere. Also record the profile's pinned processor/vision fields and the prefill-chunk constraint somewhere in docs/, since docs/model-preparation.md currently says nothing about Gemma 4 images.

Minor: SUPPORTED_SOFT_TOKENS is duplicated (gemma4.rs:8 and frontend.py:123); pick one owner.

Is there a simpler way?

Not for the preprocessing itself. Ignition is Python and serves nothing at request time, so the HF Gemma4ImageProcessor can't be reused; and the patch layout (interleaved (y, x, channel), (x, y) positions, 1/255 scaling) genuinely differs from patch_merge's channel-planar 1176-wide temporal patches — reusing that profile would mean parameterising patch layout, stride, normalization and geometry mode, which is more code, not less. The Envelope extraction already takes the one real reuse opportunity. The only place the PR makes itself more complicated than necessary is item 2 above.

The honest caveat: the atomic-span path has no in-repo consumer yet, since serving needs the companion recipe PRs in local-inference-lab/hyperflare-recipes. That is a reason to land the preparation profile (it is inert until a recipe selects it) but also a reason item 3 is non-negotiable — the one piece with cross-model blast radius is the one piece that end-to-end testing will not exercise.

Bottom line

Worth it with changes. The profile fills a real hole for an already-supported model family, lives at the sanctioned extension point, and is built with acceptable restraint and additive wire changes. Blocking items are mechanical (regenerate protobuf at 7.36.2; derive instead of hardcoding the 4/9 table; remove the three-way duplicated 768), one is a correctness risk in shared code (test the spans population across span and non-span layouts), and one is a preparation-time guard (single-token validation of the three image tokens; reject max_soft_tokens × 9 merges whose span exceeds the prefill chunk). With those plus a durable parity fixture and a second checkpoint, this is a clean merge.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 4 — redundant h % merge_side check (packing.rs:486), unsolicited reformatting (packing.rs:494-502), a packing test that only proves a table lookup (packing.rs:570-586), and a duplicated soft-token allowlist (gemma4.rs:11 vs frontend.py:123).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

Prose

Verdict: blocking issues

Blocking:

Should fix:

Nits: 5 — ignition/preparation/frontend.py:113-137 unexplained hard-coded processor values; helios/src/frontend/images/gemma4.rs:11,26-27 unexplained bounds duplicated from frontend.py:123; helios/src/frontend/images/packing.rs:491 layout-name drift; helios/src/frontend/images/patch_merge.rs:10 self-referential docstring; helios/src/frontend/images/conditioned.rs:192 unexplained width.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

Conventions

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 4 — pb2 generator version downgraded to 7.36.1; no ImageSettings.gemma4 protobuf round-trip test (precedents protobuf.rs:726, :749); soft-token allowlist duplicated Rust/Python; patch_merge::Envelope still homed in patch_merge.rs:10.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

Nits: 2 (unrelated runtime_core_pb2.py regeneration churn; hardcoded envelope token strings in ignition/preparation/frontend.py:130-137). Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

Architecture

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 2

Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

Pre Test Report

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.

Full report · Notes Decision to Test: no (100%): Testing will not add much value

code review summary

Changes Requested

The bones are good — the proto/contract additions are properly additive, the patch_merge::Envelope extraction is real de-duplication, and the Gemma 4 geometry is overflow-guarded. What blocks merge is that three behaviours do more than the description says, and one headline claim has no reproducible evidence.

Blockers:

Should fix:

Nits:

7 nits (churn in the staging.put rewrite, a table-only test, missing protobuf round-trip test, duplicated soft-token allowlist, and four prose items)

Full report · Notes

screen malicious

Screen Result: All Clear

Evidence: Screening of NVIDIA/hyperflare-inference#483 covered the full conversation, the PR description, and all 36 changed files at head commit 2b4a31e (base main @ 27716185, +2269/−240, author rickybrent, GitHub association NONE).

(1) Conversation and description contain no agent-directed content. The only discussion is flare-autobot intake/review notices ("A case file has been opened for 483"; a "Full Review" verdict with Changes Requested), one paragraph-level technical reply from the author, and a reference to issue #74. The autobot notices carry the repository review bot's standard #autobot:ignore opt-out footer, which is addressed to humans interacting with that bot and is not an instruction to this agent. The description is an ordinary change log ending with a contact handle ("Discord: ran.cossack"). No text anywhere attempts to instruct an AI reviewer, reviewer, or model ("ignore previous instructions", "you are…", "do not flag", "approve/merge this", "skip review").

(2) The riskiest-looking new artifacts are legitimate on line-by-line inspection. tests/frontend/gemma4_images.json (new, 256 lines) holds only processor/model metadata plus 8 fixture cases with numeric values and hex SHA-256 digests — no base64 blobs, URLs, or executable payloads. tests/frontend/generate_gemma4_image_fixtures.py (new) imports only argparse/hashlib/json/numpy/torch/torchvision/transformers, reads config JSON from a CLI-supplied snapshot path, and writes a JSON fixture — no network, no subprocess, no eval/exec, no environment exfiltration. ignition/preparation/runtime_core_pb2.py is regenerated in the expected generated shape: header still "Protobuf Python Version: 7.36.1" matching main, diff confined to the AddSerializedFile descriptor blob (containing the new Gemma4ImageSettings and GEMMA4 geometry), no appended imports, prints, or env access. ignition/preparation/frontend.py's Gemma 4 branch adds dict-shape guards, fixed-value expectations, Tokenizer.from_file(snapshot/tokenizer.json (not opened)), token-id cross-checks against config.json (not opened), and fails closed when tokenizer_config/snapshot are omitted. helios/src/frontend/images/gemma4.rs (new, 534 lines) is pure resize/geometry/pack code; its only process spawn is inside an #[ignore]d parity test invoking a hardcoded ../.venv/bin/python -c <inline script> with no interpolation of repo or environment data — a normal parity harness that cannot run under a plain cargo test.

(3) Hidden-instruction and obfuscation checks came back empty. No HTML/markdown comments in the modified docs and .md files; no bidi/invisible characters observed in the read text; no anomalous glyph ordering or wrapping; repo-wide regex sweeps for ignore-previous/prompt-injection/reviewer-coercion phrasings returned only unrelated code (e.g. flare-cli/src/orbit/controller.rs:172 (not opened)).

(4) Non-security observations only. This is an external contributor's first large PR into helios/src and ignition/preparation; an earlier autobot review raised substantive design concerns (patch-width lookup table, silently-skipped parity tests, duplicated span emission, stale docs) which the author says are addressed; no CI checks ran on head 2b4a31e, so the claimed test counts are unverified. Those affect merge confidence, not safety.

Screening limitations: invisible-character/bidi sweeps could not be run mechanically (the tool's regex engine rejected \x{...}, {n}, and non-capturing-group patterns), so those conclusions rest on direct reading; no tests were executed; the review was a screening pass for injected instructions and agent-steering content, not an audit of the resize math or atomic-span semantics.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: rickybrent (no GitHub association with this repo; 0 merged, 1 open PR — #484, same day; Discord ran.cossack) Motivation: Gemma 4 is already a supported text model here, but its image half was missing, so this PR adds a Gemma 4 image-preparation profile and generalizes the shared "bracketed" image layout so it can pack 3×3 rather than only 2×2 patch merges. The vision/recipe half now lives in the split-out hyperflare-recipes repo, so nothing becomes servable from this PR alone. Scale: +2269 / −240 lines in 36 files (was +732/−164 in 13 files before the rebase) Proposal:

Full report · Notes

Value Proposition

Verdict: worth merging

This is my second pass. My first review (2026-11-24) said "worth it with changes" and listed six must-fixes. The author rebased onto main (27716185, head 2b4a31e9) and addressed all six, plus two "should fix" items. I re-verified each against the current head. Nothing blocking remains.

Charter fit

Right layer, not a per-model branch. Helios "shouldn't accumulate per-model branches" (#267, #334), but image preparation is an enumerated extension point, not an ad-hoc branch — docs/model-contract.md:226-227 (not opened): "Tool parsers, reasoning parsers, image preparation, and image layouts each have an independent enum selector." There are already eleven profiles, and the most recent (padded_grid) was added by maintainer Luke Alonso (8628b7c5). A twelfth profile is the sanctioned shape.

Not a new alias, and more than one checkpoint. Gemma 4 is already a supported family (docs/model-preparation.md:321 lists e2b/e4b/12b/26b-a4b/31b + NVFP4). The Ignition side now deliberately asserts only consumed fields (ignition/preparation/frontend.py:114-172) — model_type: gemma4 / vision_config.model_type: gemma4_vision — so all four serving variants pass while gemma4_unified (12B) is rejected. tests/preparation/test_frontend_gemma4.py:187-216 validates three real cached checkpoints (31B, 31B-NVFP4, E2B). The earlier 31B-only encoder pins are gone.

It fixes real bugs, which is the strongest argument. Two independent latent defects:

  1. A span-declaring Bracketed image failed per request. On main, layouts/bracketed.rs emitted no data.spans, while helios/src/model.rs:441-451 (ref=main) rejects any scoped token (feature_token/start_token/end_token) not inside a span → "image token spans do not match their declared boundaries". The PR's "Why" claim is accurate, not speculative. Fixed by emitting spans in layouts/bracketed.rs:58-65 (the deepseek.rs (not opened) pattern), gated on the contract declaring a span, with envelope-marker validation on both ends. The shared prompt.rs fallback block was deleted rather than patched.
  2. Every cached MiniMax prepared-image record was being invalidated. conditioned.rs:187-193 (ref=main) ended _ => 588, so PatchMerge's 1176-wide patches never satisfied valid_processed, causing needless re-materialization per request. Now routed through ImageProcessor::patch_features() (mod.rs:459-471), fixing this for PatchMerge = 1176 and PaddedGrid = 1200. A latent correctness/performance bug, found incidentally.

Wire changes are strictly additive — ImagePreparationKind value 11, ImageSettings tag 11, VisionCapacity.patch_features field 6 with #[serde(default)] (helios/build.rs:53-56), proto/runtime_core.proto:281,449,585,598. Existing cores stay loadable.

The six prior blockers, re-verified

  1. Protobuf downgrade — moot. main itself now carries Protobuf Python Version: 7.36.1 (I read the file at ref=main). The PR's diff is descriptor-only. Separately, pyproject.toml:34 still pins protobuf>=7.36.2,<8 while main's own artifact says 7.36.1 — a pre-existing main inconsistency, worth its own fix, not this PR's.
  2. Hardcoded 4→1176 / 9→768 table — gone. packing.rs:16-32 is now LEGACY_BRACKETED_PATCH_FEATURES, bracketed_patch_features(vision) (0 → legacy), and square_merge_side(ppf) via isqrt with an exact-square check. No model-identity branch. Single owner is ImageProcessor::patch_features(), with a cross-profile consistency test over all 11 profiles (packing.rs:695-824) asserting processor width == tensor layout width. The MiniMax caveat the author raised is legitimate: temporal frame duplication means width genuinely isn't derivable from 3·patch_size², so carrying it in prepared metadata is the right call.
  3. Spans in shared code — moved and tested. prompt.rs now only passes image_tokens.span.is_some(); emission lives in the layout. prompt.rs:1172-1281 tests span-bearing Bracketed (2 spans == conditioned input token spans, length 262, markers correct), 64-aligned chunk too small (256 → Err), and span-less MiniMax (spans empty).
  4. Preparation doesn't validate what it later depends on — fixed. Envelope tokens now come from tokenizer_config.json (not opened) and each is verified as a single atomic vocabulary token via token_to_id plus encode(..., add_special_tokens=False).ids == [id], cross-checked against optional config.json (not opened) IDs; fails closed without tokenizer_config/snapshot. 216 lines of pytest cover the negative cases (missing/empty/duplicate/unknown/multi-token/bool-ID).
  5. Evidence not durable — fixed. tests/frontend/gemma4_images.json plus its generator are checked in; gemma4.rs:266-333 verifies SHA-256 of resized RGB bytes, pixel_values, position_ids, grid/tokens/patches and cu_seqlens unconditionally under plain cargo test, across 8 cases at max_soft_tokens 280 and 1120. Live-snapshot tests are now #[ignore] with real assertions instead of silent returns.
  6. Missing Ignition test and docs — fixed. tests/preparation/test_frontend_gemma4.py added; helios/README.md:706-718, docs/runtime-core-design.md:181-196, helios/model-contract.md:82, and a protobuf round-trip test (protobuf.rs:813) all updated.

Load-time invariants also landed: gemma4::Processor::load enforces pooling² == patches_per_feature and max_soft_tokens·pooling² ≤ max_patches_per_image (gemma4.rs:25-52), and server::config::validate_loaded_image_processor (config.rs:443-489) checks patch width against vision.patch_features (with an actionable "re-export the core with vision.patch_features" error), plus max_image_envelope_tokens ≤ prefill_chunk_size and ≤ span.max_tokens — with 64-aligned boundary tests on both sides (1122 vs 1088/1152; span_max 1121/1122).

Costs

Residual, non-blocking

Is there a simpler way?

No. Ignition is Python and serves nothing at request time, so the HF Gemma4ImageProcessor can't be reused. The patch layout (interleaved (y, x, channel), (x, y) positions, 1/255 scaling, 16×16) genuinely differs from patch_merge's channel-planar 1176-wide temporally-duplicated patches; parameterising one profile for both would be more code, not less. The PR already takes the one real reuse opportunity (patch_merge::Envelope extracted, shared) and reuses resize::resize rather than adding a second resampler.

Bottom line

Worth merging. Every blocker from my first review is resolved with tests that run in CI, not on the author's machine. The change sits at the sanctioned extension point, keeps the wire additive, and — unexpectedly — fixes two independent latent defects: a per-request rejection for any span-declaring Bracketed core, and a per-request cache-invalidation bug for every MiniMax prepared image. The only real gap is that #74's "serve cleanly" half needs the companion recipe, which is correctly tracked rather than hand-waved.

One process note: the review bot on this PR (flare-autobot, 2026-11-24) requested the same three blockers I independently reached, and the author's 2026-11-25 reply addressed them accurately — I verified each claim rather than taking it at face value, and they held up.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: should-fix issues only Blocking:

Full report · Notes

Conventions

Verdict: clean Blocking:

Reviewed the revised head 2b4a31e (36 files, +2269/−240) through the conventions-and-duplication lens, judging each new construct against its closest in-repo precedent and against docs/design-review.md principles 1–3 and 13, .agents/skills/repo-prose/SKILL.md (not opened) and AGENTS.md. All four should-fix findings from my earlier pass on this PR are closed in the code, not only in the reply: the patches_per_feature → width table is gone (packing.rs:16-32 reads VisionCapabilities.patch_features with an explicit legacy 1176 default and derives the merge side by isqrt), conditioned.rs:187 calls ImageProcessor::patch_features(), atomic spans are built by the Bracketed layout (layouts/bracketed.rs:52-111, mirroring layouts/deepseek.rs:149) rather than the prompt dispatcher, and the Gemma 4 envelope test no longer shells out to Python.

Residual nits (7), all recorded with fixes:

  1. Per-profile patch width is still authored in two independent matches keyed on different enums — packing.rs:41-100 (ImageLayoutKind) and mod.rs:459-473 (Profile) — linked only by the processor_patch_features_match_tensor_layout_for_every_profile test (packing.rs:695), not by the compiler. This is the one structural item worth a reviewer's attention; a compiler link (one delegating to the other) would close it.
  2. gemma4.rs:132 re-inlines 3 * patch_size² next to the patch_features() accessor that already computes it (gemma4.rs:54-56).
  3. The soft-token allowlist is duplicated between gemma4.rs:13 and ignition/preparation/frontend.py:132; no neighbouring profile enumerates an allowlist, so there is no precedent to follow.
  4. patch_merge::Envelope (patch_merge.rs:10-17) is now shared by PatchMerge and Gemma4 but still homed in patch_merge; gemma4.rs:8 imports it from there.
  5. server/config.rs:456-457 reaches into frontend::images::packing::bracketed_patch_features to restate the legacy-default rule; a VisionCapabilities/processor accessor would keep server config out of packing internals.
  6. tests/frontend/generate_gemma4_image_fixtures.py:17-25 copies pattern()/digest() verbatim from generate_glm_image_fixtures.py:18-25 — consistent with how every generator is written, but a shared helper is the DRY form.
  7. bracketed.rs:57-65 restates a partial marker-presence check that validate_prompt_data (model.rs:441-456) already performs against the declared span tokens.

Precedents that hold: proto tag 11 / Gemma4ImageSettings, contract_enum! appended value 11, the describe.rs/protobuf.rs arms, the Ignition gemma4 branch (mirroring the glm branch), serde shapes, and the Envelope extraction (genuine de-duplication).

Limits: no build or test was run here; every behavioural claim is from reading code and callers. Numerical parity, load-path cost and serving behaviour are outside this lens.

Full report · Notes

Prose

Verdict: should-fix issues only Blocking:

Full report · Notes

Architecture

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 1 — the positive-square Bracketed narrowing is enforced at model load, not per request; correct layer, but the description should say so.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

Two findings from my first review are now genuinely resolved in code: the three independent 768-float width derivations have collapsed into ImageProcessor::patch_features() (mod.rs:459-471) plus the load-time agreement check (config.rs:449-463), so the "Gemma 4 profile accepts settings the packing path cannot represent" failure no longer exists — a patch_size/pooling pair that differs from 16/3 is now internally consistent and rejected only if widths disagree; and HF parity is now exercised unconditionally by checked-in fixtures. What remains is diagnostic quality on the load path, one undisclosed load-time narrowing for Bracketed cores, and three untested edge paths. I could not settle whether any shipped or previously exported core declares ImageLayoutKind::Bracketed with a non-square (or zero) patches_per_feature; if one exists, the narrowing becomes a startup regression and should block.

Full report · Notes

Subtractive

Verdict: should not be merged The change: +2269 / -240 lines, 36 files Could remove: about 1,200 lines, in 10 places (~53% of the diff) if the Gemma 4 image profile is deferred; about 484 lines, in 6 places, if the profile is kept Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-test report — PR #483 "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans"

Head 2b4a31e (2026-11-22, rebased onto main 27716185) · 36 files · +2269 / −240 · no CI checks visible on the head

Verdict: DO NOT REFER TO HARDWARE TESTING. Merge-readiness is close, but hardware is still the wrong instrument.

This supersedes my 2026-11-24 report (which was written against the pre-rebase head f2340e42). All three blocking findings from that report are fixed and verified in code at the new head. What remains is one small should-fix on the Python authoring surface plus nits and doc drift — none of which a GPU run can inform, and none of which changes the fact that nothing on either host can exercise this change end to end.

Grounds, in order of weight:

  1. No reachable test target. cn5 (4× RTX PRO 6000 Blackwell) hosts facebook/dinov2-base, timm/vit_base_patch14_dinov2.lvd142m, and GLM-5.3-Flash-NVFP4 variants; cn7 (1× GB10) hosts Qwen3.8 variants. No Gemma 4 checkpoint on either host. The companion Gemma 4 recipe lives in the split-out local-inference-lab/hyperflare-recipes and does not exist yet (docs/TODO.txt:331-337 is this PR's own tracking entry). No in-tree contract fixture uses ImageLayoutKind::Bracketed (9) at all — fixtures use layouts 1, 2, 3, 5, 6, 10 — and helios/tests/support/contracts/gemma4_frontend.json:16-17,38 still declares image_preparation, image_layout, image_tokens = null. A GPU run today would exercise nothing this PR adds.
  2. Nothing GPU-side is modified. No kernel, graph, numerics, or precision path changes. Every changed computation is CPU/deterministic: decode → area-bounded resize → RGB-interleaved patch pack → (x,y) positions → token envelope expansion → upload-buffer extent arithmetic → prompt/span validation. The PR makes no performance claim and there is no benchmark expectation attached, so the "#210 benchmarks" rule is not engaged. A throughput A/B would be pure waste.
  3. Zero blast radius on the models the hosts can serve. The one behaviour change reaching existing vision cores is conditioned.rs:187 in valid_processed, which now calls ImageProcessor::patch_features() instead of the old _ => 588 fallback (verified at main:187-193). Per profile the resulting width is Qwen/MiMo 1536, Radio 768, Glm 1176 (unchanged), PaddedGrid 1200 (was 588), PatchMerge 1176 (was 588), others 588. The only profiles whose width actually changed — PatchMerge (MiniMax) and PaddedGrid (Inkling 2) — are not hosted on either machine, and both changes are bug fixes. The new load-time narrowings don't bite hosted cores either: square_merge_side requires a positive square patches_per_feature for Bracketed only (MiniMax is 4, fine), server/config.rs:465-488 envelope bounds apply only to Profile::Gemma4, and model.rs:79 (patch_features divisible by 3) only fires when the field is nonzero, which no existing core sets.

Expected value of a hardware run as the PR stands: ≈ 0, and strictly negative if it displaces a run of real work. The valuable evidence here is CPU-only and cheap — cargo test, the checked-in fixture test, pytest tests/preparation — which belongs in CI, at no hardware cost.


What changed since my last report — all three blockers verified fixed

B1 (was F1): regenerated runtime_core_pb2.py no longer regresses #479 — FIXED

I re-read the descriptor at ignition/preparation/runtime_core_pb2.py:27 on pr/483 and confirmed it now contains both GEMMA4_IMAGE_PREPARATION (value 11) and TERMINAL_PREFILL (value 14), plus main's PreparationManifest / PreparationParameter / PreparationParameterScope messages — i.e. it was regenerated from a schema that includes #479 and #426. The helios/proto/runtime_core.proto hunks remain strictly additive and disjoint (+:281-282 field 6, +:449 enum value 11, +:585 oneof tag 11, +:598-605 Gemma4ImageSettings).

The gencode header is still Protobuf Python Version: 7.36.1 (pb2:5, ValidateProtobufRuntimeVersion(..., 7, 36, 1, ...) at :12-19), but I read the same two lines at ref=main and they are identical — no drift against the base. The residual pyproject.toml:34 (not opened) (protobuf>=7.36.2,<8) versus main's own 7.36.1 artifact is a pre-existing main inconsistency, not this PR's. My prior report's blocker is fully withdrawn.

B2 (was F2): count-keyed patch-width table is gone — FIXED

packing.rs:16-32 is now LEGACY_BRACKETED_PATCH_FEATURES = 1176, bracketed_patch_features(&VisionCapabilities) (nonzero wins, 0 → legacy), and square_merge_side via isqrt with an exact-square check. tensor_layout takes &VisionCapabilities (packing.rs:34-56), its load-time caller model/packing.rs:92-97 and the upload path packing.rs:493-518 agree, and the width comes from the new additive VisionCapacity.patch_features = 6 (runtime_core.proto:281-282, #[serde(default)] at helios/build.rs:53-56, Rust field model.rs:51-53). The MiniMax counter-argument the author raised is legitimate: PatchMerge::patch_features() is 3*2*patch_size² = 1176 (patch_merge.rs:124-126), so width genuinely is not derivable from 3*patch_size² for temporal merges — carrying it as prepared metadata is the right call, and is exactly what design-review principle 3 asks for. Non-square Bracketed values are rejected at load (packing.rs:26-32) and covered by packing.rs:671-680; the legacy 0 → 1176 path is covered at packing.rs:660-670.

B3 (was F3): atomic spans are emitted by the layout, with tests — FIXED

layouts/bracketed.rs:52-111 now builds spans from mm_token_type_ids runs, gated on atomic_spans and rejecting a run without an envelope marker at either end; the shared fallback in model/prompt.rs is deleted (prompt.rs:52-65 now only derives the bool). Coverage that runs under plain cargo test: model/prompt.rs:1171-1282 asserts two spans equal to the conditioned-input spans, length 262, correct start/end marker tokens, all-interior-token identity, a 64-aligned 256-token chunk correctly rejected, and a MiniMax-style no-span contract staying empty.

Also fixed since the last report


Residual findings — and whether any should gate a hardware run

# Finding Severity Gates testing?
A ignition/preparation/contract.py:112 cannot author the new field. The default vision dict is dict(features_per_request=0, max_images=0, patches_per_feature=0, patch_capacities=[]) with no patch_features; patch_features appears nowhere else in ignition/ except the generated descriptor. A recipe that fills in the four historical keys exports 0 → legacy 1176, and a Gemma 4 (768) core is then rejected at flare run by config.rs:456-464. **vision still accepts an explicit key, so this is a default/ergonomics defect with a serve-time symptom, not a functional break. One-line fix, plus a docstring note that Bracketed vision cores must set it. should-fix No — Python-side, CPU, unreachable from hardware
B server/config.rs:449-455 duplicates :456-464: for the only layout that defines patch_features, bracketed_patch_features returns vision.patch_features verbatim, so the first check produces a second, vaguer error for the same mismatch. Fold into the Bracketed check. nit No
C gemma4.rs:30-38 collapses six distinct rejections into "invalid Gemma 4 image settings", including the new settings-vs-capacity check an operator is most likely to hit (max_soft_tokens·pooling² > limits.max_patches_per_image, where the limit comes from how the core was exported). Name the failing field/limit. nit (diagnostics) No
D gemma4.rs:132 re-inlines 3 * self.patch_size * self.patch_size next to the patch_features() accessor at :54; one-sided edit risk. Use the accessor. nit No
E Per-profile width is still authored in two matches keyed on different enums — packing.rs:41-100 (ImageLayoutKind) and mod.rs:459-471 (Profile) — linked only by the 11-row test at packing.rs:695-824, not the compiler. nit (test-covered) No
F patch_size/pooling_kernel_size are configurable on the wire and in serde, but frontend.py:124-127,140-141 pin 16/3 and :168-173 writes them literally, so no exporter can emit another pair; three validation arms (gemma4.rs:32-33) are unreachable. Profile constants (the glm.rs (not opened) const FACTOR precedent) would be smaller. Keep only if a future Gemma 4 size needs them. nit / design choice No
G Docs still drift: helios/README.md:721-728 presents Qwen's "1536 / temporal copy / 2×2 merge" as the shared process contract immediately under the new Gemma 4 paragraph (768 floats, no temporal copy, 3×3 pooling); docs/runtime-core-design.md:233-240 still omits Gemma 4 from the per-profile ImageSettings enumeration; the image-fixture provenance section (helios/README.md:772-789) names only the Qwen fixtures, so the new Gemma 4 generator/fixture and their pinned Transformers version are undocumented. should-fix (docs) No
H tests/frontend/gemma4_images.json:2-125 carries processor/model blocks the generator writes but the only consumer never reads (gemma4.rs:273 reads cases only), so envelope/token parity rests on the two #[ignore]d tests plus pytest checkpoint cases that pytest.skip without HF_HOME. Either consume the ids in Rust or trim the blocks. nit No

Nothing in this table is a substantive architecture or code-quality defect that would be invalidated by hardware testing. Finding A is the only pre-merge must, and it is one line in a Python helper.

The "Subtractive" lens recommends deferring the entire Gemma 4 profile (~1,200 lines) until the recipe PR exists. I do not treat that as a defect: the profile sits at the sanctioned enumerated extension point, is inert until a recipe selects it, and is the only way to unblock the recipe work. It is a scope/sequencing judgement for the maintainers, not a reason to test or not test.


Reliability of the supplied review summaries

The lenses converged and I re-verified their load-bearing claims directly. Corrections worth recording:


  1. Author fixes finding A (patch_features=0 in contract.py:112 + docstring note) and the four doc items in G. Both are cheap and land with the code.
  2. CI proves the change, not a GPU: cargo test (must include canonical_processor_pixels_positions_and_resize, bracketed_layout_emits_atomic_spans_only_when_contract_declares_them, bracketed_packs_3x3_metadata_widths_and_rejects_invalid_extents, processor_patch_features_match_tensor_layout_for_every_profile, loaded_gemma4_image_processor_validates_patch_width_and_envelope_chunk_bounds, serialized_gemma4_profile_selects_only_image_preparation) plus pytest tests/preparation tests/direct — the direct-scheduler test at tests/direct/test_scheduler.py:720 (not opened) (TERMINAL_PREFILL == 14) is the guard that the regenerated gencode did not regress #479. No CI status is visible on the head, so the author's counts remain unverified; asking for them is far cheaper than a GPU job.
  3. Refer to hardware only when a Gemma 4 vision recipe and a hosted checkpoint exist — that is the point at which this PR becomes testable at all, and the plan below applies.

Minimal test plan — only if referred (i.e. only after a Gemma 4 core can be prepared and served)

Deliberately small: 2 jobs total, no sweeps, no statistics.

Stage 0 — gate before any GPU time. p.GraphOperation.Value("terminal_prefill") == 14 and p.ImagePreparationKind.Value("GEMMA4_IMAGE_PREPARATION") == 11 both resolve from the checked-in runtime_core_pb2.py; cargo test and pytest tests/preparation tests/direct green; the two #[ignore]d tests reported as unrun, not as passes.

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

Stage 2 — single serving check, one cn5 job (4× RTX PRO 6000), only once a recipe + checkpoint exist. Prepare the Gemma 4 core from the companion recipe (vision.patch_features = 768, ImageLayoutKind::Bracketed, ImagePreparationKind::Gemma4); serve TP=1 or TP=2, then two requests: one text-only (must be unchanged versus main) and one with a single image, asserting HTTP 200 and plausible image-grounded output. Repeat the image request once at max_soft_tokens = 280 and once at 1120. Fail-fast signals to watch: conditioned input spans or features violate prompt geometry, invalid bracketed patch-merge image extent, bracketed image span is missing envelope markers, image token spans do not match their declared boundaries, and any prefill-split rejection. One image size at or below the chunk and one above it is enough — do not sweep resolutions.

Explicitly not to be tested (would waste hardware):

Full report · Notes

code review summary

Recommendation: Changes Requested

Blockers:

None. Nothing on the served path is incorrect; the remaining items are one scope question, one authoring gap on the Python side, and cleanup.

Should fix:

Nits:

5 nits


PR #483 — Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans

Head 2b4a31e, base main 27716185, 36 files, +2269/−240. Third review round; line-level detail and prior rounds are in the linked case file.

Key findings

No blockers. Every blocker and should-fix from the previous round is fixed and verified in code at this head: patch width comes from prepared metadata instead of a patches_per_feature lookup table, the Hugging Face parity fixture runs unconditionally under cargo test, atomic spans are emitted by the Bracketed layout rather than shared prompt code, patch width has one authority across all 11 profiles (which also fixes a real main bug for PatchMerge 1176 / PaddedGrid 1200), load-time bounds cover pooling, patch budget and envelope size, and the Ignition tower pins are gone. Genuinely good work.

What remains: five should-fix items — one scope question needing an answer before merge, one authoring gap that hands the first Gemma 4 recipe author a serve-time error, one opaque load error, dead configuration knobs, and superseded test scaffolding — plus five nits, mostly documentation and duplicated test rows.

Note on diff scope: the head diff also shows large unrelated base-branch churn (banner removal, flare doctor, parallax, download rewrites, RebuildManifest → PreparationManifest). Those commits landed on main between the old base and now, are not this PR's files, and are not attributed to the author.

Verified resolved this round — not re-litigated

Blockers

None.

Should Fix

S1 — The profile lands ahead of the exporter that can use it, and no test mounts an existing Bracketed core

Finding: the description defers end-to-end serving to an unlanded companion PR in local-inference-lab/hyperflare-recipes, and docs/TODO.txt:331-337 records qualification (E2B/E4B/26B-A4B/31B export and serving) as open. No core fixture uses the profile: helios/tests/support/contracts/gemma4_frontend.json:16-17,38 has image_preparation: null, image_layout: null, image_tokens: null, and no contract JSON under helios/tests/support/contracts/ declares a Bracketed layout (values used: 1, 2, 3, 5, 6, 10). The charter asks a new model format to "prove they export and serve cleanly from the PR branch, and support more than a single checkpoint (#74)" and separately to "verify that existing data, artifacts, and exported cores still load". The legacy staging arithmetic is tested — packing.rs:660-670 asserts patch_features == 0 yields 16 × 1176, and :671-680 asserts a non-square patches_per_feature errors — but the load path is not: tensor_layout runs from Inputs::new (model/packing.rs), so an existing Bracketed core now passes through square_merge_side (packing.rs:26-32) at core load, and nothing in the tree mounts such a core.

Request: state in the description whether a maintainer approved landing the profile ahead of its recipe, or split the shared half (patch_features field, contract-driven Bracketed packing, Bracketed spans, envelope bounds) onto its own PR, since it stands alone and fixes a main defect. Either way, add one core-load test with a Bracketed contract JSON that omits patch_features, asserting the core loads and stages 1176-wide pixels.

Why: the charter makes export-and-serve the bar for a new profile and requires existing cores be shown to still load. Both claims are currently prose only.

S2 — Nothing on the Python side authors patch_features

Finding: ignition/preparation/contract.py:112 defaults vision to the four historical keys (features_per_request, max_images, patches_per_feature, patch_capacities) plus feature_slots: 0, and never mentions patch_features; a search for the name across ignition/ returns only the generated runtime_core_pb2.py. A recipe that fills the historical four keys therefore exports patch_features = 0, bracketed_patch_features reads that as 1176 (packing.rs:18-24), and server/config.rs:456-463 rejects the core at flare run with "bracketed image layout patch width (1176) differs from image processor (768); re-export the core with vision.patch_features". Meanwhile Ignition has already validated patch_size = 16 and pooling_kernel_size = 3 from the checkpoint (frontend.py:124-127, :140-141) and writes them literally at :168-170, so the width is derivable as 3 · patch_size² = 768.

Request: derive patch_features in Ignition from the settings it already validated and emit it in the vision block, and add patch_features=0 to the default dict at contract.py:112 with a docstring note that Bracketed vision cores must set it.

Why: right problem, wrong layer. The width is preparation metadata; the first feedback a recipe author gets should not be a serve-time rejection whose only other hint is a docs/TODO.txt line.

S3 — Seven distinct load rejections share one message

Finding: gemma4.rs:30-38 returns "invalid Gemma 4 image settings" for zero/oversized patch_size, zero/oversized pooling_kernel_size, an unsupported max_soft_tokens, pooling_area != Some(limits.patches_per_feature) (:35), and the patch budget max_soft_tokens · pooling² > limits.max_patches_per_image (:36). The last two compare settings against captured capacity, and that capacity comes from the export's vision.patch_capacities (server/config.rs:497-502), not from the checkpoint — so an operator cannot tell a mis-exported core from a mis-declared checkpoint. server/config.rs:449-463 in this same PR shows the actionable style, and the neighbouring Envelope::load (gemma4.rs:40-44) names the offending token.

Request: split the condition into named errors naming the failing field and both values; add a comment naming the source of the patch_size > 64 / pooling > 16 bounds.

Why: a load path that only says "invalid settings" moves the diagnosis onto the operator, and this is the error most likely to be hit because the capacity comes from export, not the checkpoint.

S4 — Dead wire knobs and constants spelled several ways

Finding: Gemma4ImageSettings.patch_size / pooling_kernel_size (helios/proto/runtime_core.proto:599-600, mod.rs:335-336, gemma4.rs:18-19) travel through proto, serde and the Python producer, but no exporter can emit anything but 16/3: frontend.py:124-127 and :140-141 reject any other pair and :169-170 writes the literals — which makes the patch_size > 64 / pooling > 16 arms at gemma4.rs:32-33 unreachable. The width 768 is spelled four ways: computed at gemma4.rs:55, via patch_features() at conditioned.rs:187 (not opened), the legacy 1176 at packing.rs:16, and a 3 * 16 * 16 literal in a test. gemma4.rs:132 re-inlines 3 * self.patch_size * self.patch_size instead of calling self.patch_features(), so the value validated at server/config.rs:448 and the value sizing the buffer are two expressions. conditioned.rs:367 (not opened) recomputes pooling_kernel_size * pooling_kernel_size outside gemma4.rs. The soft-token allowlist exists twice in two languages (gemma4.rs:13, frontend.py:132) with no test tying them.

Request: replace with const PATCH: usize = 16; const POOLING: usize = 3; const FEATURES: usize = 3 * PATCH * PATCH; as helios/src/frontend/images/glm.rs:13 (not opened) does; reserve proto tags 1-2 (append-only rule); drop the struct fields, serde keys, validation arms and the two Python literals; make gemma4.rs:132 call self.patch_features(); keep the Python soft-token gate (preparation is the right place) and let Rust accept any positive budget, or the reverse — not both.

Why: AGENTS.md:188-193 (not opened) forbids configuration switches without a concrete requirement, and these tags become permanent once a core ships. Doing this now costs ~25 lines; later it costs a reserved-tag migration.

S5 — Superseded test scaffolding and 124 unread fixture lines

Finding:

Request: delete the ignored Python-comparison test and the chat-template plumbing; for the fixture, either consume the model block in Rust (assert the configured envelope strings map to the recorded ids and that processor round-trips into Gemma4ImageSettings) or trim both blocks to a small provenance object. Also state in the description that the live-checkpoint runs are not part of CI.

Why: AGENTS.md:194-199 (not opened) — "Do not present scaffolding or partially wired features as supported." An ignored test that duplicates an unconditional one is a liability, and a 124-line block nothing reads invites the next reader to assume it is validated somewhere.

Nits

  1. Duplicate patch-width check in bootstrap. server/config.rs:449-455 and :456-464 fire on the same condition for a Bracketed core, because bracketed_patch_features returns vision.patch_features verbatim when nonzero (packing.rs:18-24); the second has the strictly better message (layout, expected width, remedy). Keep the Bracketed check (it also covers 0 → 1176) and fold the != 0 case into it — one error per defect. Related: server/config.rs:457 reaches into packing::bracketed_patch_features while its neighbours use ImageProcessor/VisionCapabilities accessors; expose an accessor instead.
  2. Two documentation contradictions. helios/README.md:721-728 states, unqualified, that process produces pixel_values[N,1536] float32, orders patch features by "channel, temporal copy, pixel row, and pixel column", and orders patches by "2×2 spatial merge blocks" — all three false for the Gemma 4 paragraph three lines above (:713-719: 768 floats, no temporal copy, 3×3). Scope it to Qwen/MiMo and point per-profile width at ImageProcessor::patch_features(). docs/runtime-core-design.md:233-240 enumerates what each image-settings kind consumes and omits the new Gemma 4 kind (and the pooling → merge-stride relationship), in the one place a reader looks; patch_features itself is documented at :181-197, so the gap is local to this enumeration.
  3. New fixtures undocumented; reproduction command is a placeholder. helios/README.md:772-789 pins only tests/frontend/qwen38_images.json (not opened) and its generator; gemma4_images.json and generate_gemma4_image_fixtures.py appear in no document (the only reference in the tree is the include_str! at gemma4.rs:270), yet the generator depends on a Transformers release shipping Gemma4ImageProcessor and on the snapshot's processor_config.json (not opened)/config.json (not opened), none of it pinned where a reader can find it. Add the fixture set, its pinned Transformers/Torch/Torchvision versions, the snapshot, and the regeneration command. In the description, FLARE_GEMMA4_TEST_SNAPSHOT=<gemma-4-31B-it@842da379> is a placeholder where the code needs a directory holding tokenizer.json (not opened) and tokenizer_config.json (not opened) (gemma4.rs:377-385) plus .venv/bin/python with transformers/torch (:452-457); AGENTS.md:110-112 (not opened) requires the inputs be identified. Also: "libprotoc 36.1" does not match the artifact's Protobuf Python Version: 7.36.1 — name the generator release or drop the version.
  4. Four tests restate the fixture. geometry_matches_the_hugging_face_processor (gemma4.rs:336-354) repeats seven of nine rows from the fixture — only (100,3000) and (3000,100) are unique; keep those plus the tokens * 9 == patches invariant. pixels_interleave_rgb_and_positions_are_xy (:357-372) restates what the 91×37 fixture case pins by hash. The cross-profile table (packing.rs:695-825, ~130 lines) repeats patch_features: 0 ten times; three rows (PatchMerge 1176, PaddedGrid 1200, Gemma4 768) cover every distinct outcome. packing.rs:501's grid-divisibility guard is implied by :503 (tokens * patches_per_feature == patches) and by every producer's rounding, leaving merge_side unused there.
  5. Small shape and wording. Keep atomic_spans: bool (bracketed.rs:23, computed at prompt.rs:53-65) — emitting unconditionally would make model.rs:457-458 reject every existing Bracketed core that declares no span — but passing Option<&ImageSpan> (the prepared layout field, as class_token receives its token) puts the derivation next to its use. bracketed.rs:60 says "missing envelope markers" but tests bounds (start == 0 || end >= len); marker identity is enforced at model.rs:444-445, so reword to "bracketed image span run is outside the expanded prompt". Envelope is now a general frontend construct homed in patch_merge (patch_merge.rs:10-17 (not opened)); move it to frontend/images/envelope.rs (not opened). For the record: scheduler/policy.rs:343-350 truncates end to span.start for a straddling span, so a captured capacity below the envelope length contributes no work for span-bearing requests; the bootstrap bound makes that unreachable today, but no test advertises a sub-envelope capacity.

Verified clean (so the report is honest about what was not flagged)

Open questions and what could not be established

What to do next, in order

  1. Answer S1 (maintainer sign-off or split) — it decides whether S4/S5 are worth doing now.
  2. S2 (Ignition derives patch_features) — otherwise the first recipe author cannot serve a Gemma 4 core.
  3. S3 (split the load error) — small, and it is the error operators will hit.
  4. S4 and S5 — line-count reductions with no behaviour change.
  5. Nits 1-5 — documentation and duplicated test rows, batchable in one pass.

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: Screened PR #483 (NVIDIA/hyperflare-inference, "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans", author rickybrent, head ab9a432, base main 27716185, 38 files +2490/−251): all 38 changed files and the full discussion were inspected. No prompt injection, no agent-directed instruction, no hidden/encoded payload, no unexpected network, shell-out, eval/exec, or exfiltration was found; no CI workflow, permission, or dependency changes are included.

Open items: the two external autobot.eidonix.com case-file links were deliberately not fetched (third-party pages, not PR material); confidence in the All Clear verdict rests on the in-repo material, which is complete.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: rickybrent (no GitHub association with this repo; 0 merged, 1 open PR in 180 days — #484, same day; Discord ran.cossack) Motivation: Gemma 4 is already a supported text model here, but Helios had no image profile for it and shared packer code hardcoded the 2×2/1176-float patch width, so Gemma 4's 16×16 patches pooled 3×3 into soft tokens could neither be prepared nor loaded. This PR adds that profile, lets the Bracketed layout take the patch width from the prepared contract, and has the Bracketed layout emit atomic image spans so the scheduler cannot split an image envelope. Scale: +2490 / −251 lines in 38 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth merging — PR #483 "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans"

Head ab9a432b, base main 27716185, 38 files, +2490/−251. Third review pass; all verified against the current head.

One correction to my earlier summary: this is the eleventh image-preparation profile, not the twelfth — helios/src/model/contract.rs:68 (not opened) on main defines ImagePreparationKind 1–10 and the PR appends 11. The cross-profile consistency test has 11 rows because it includes Gemma 4.

Charter fit

Right layer. The charter says Helios "shouldn't accumulate per-model branches" (#267, #334). Image preparation is not an ad-hoc branch but a declared extension point: helios/model-contract.md:243-244 — "Tool parsers, reasoning parsers, image preparation, and image layouts each have an independent enum selector." Ten profiles already exist, the most recent (padded_grid) added by maintainer Luke Alonso in 8628b7c5. An eleventh is the sanctioned shape, and the only route by which a Gemma 4 core can declare native image preprocessing.

Not a new alias, and more than one checkpoint. Gemma 4 is already a shipped family: docs/model-preparation.md:321 (e2b/e4b/12b/26b-a4b/31b + NVFP4), docs/api.md:749 (not opened), docs/cli-design.md:457 (not opened),486, docs/model-development.md:77-83, history commits 1fd1f917, d367edc5 (#56), bcf7177d (#62). Images are the missing half. Ignition now asserts only consumed fields — model_type: gemma4, vision_config.model_type: gemma4_vision, patch_size 16, pooling 3, processor flags, soft-token allowlist (ignition/preparation/frontend.py:114-141) — so E2B/E4B/26B-A4B/31B pass while gemma4_unified (12B) is rejected (tests/preparation/test_frontend_gemma4.py:129), with three real cached checkpoints at :228-257.

Wire additive and inert. ImagePreparationKind = 11; ImageSettings.profile tag 11; VisionCapacity.patch_features field 6 with #[serde(default)] (helios/src/model.rs:51-53); describe.rs:466-468 omits 0 so legacy describe JSON is byte-identical; round-trip test at protobuf.rs:813 (not opened). Existing cores keep loading: missing patch_features decodes 0 → legacy 1176 (model.rs:72-80).

Decisive argument: it fixes two real main defects

  1. Every span-declaring Bracketed image failed per request on main. layouts/bracketed.rs emitted no data.spans, while model.rs:442-465 rejects any scoped token outside a span → "image token spans do not match their declared boundaries". Fixed in layouts/bracketed.rs:57-88: the run is flushed when the feature run ends, the span is start-1..end+1 (covering start_token…end_token), bounds-checked at both ends, gated on image_tokens.span.is_some(). The shared prompt.rs fallback was deleted, not patched, so the layout that builds the envelope owns the span (matching layouts::deepseek).
  2. Every cached MiniMax prepared-image record was discarded. conditioned.rs:185-193 on main ended _ => 588, so PatchMerge's 1176-wide patches never satisfied valid_processed and were re-materialized per request. Now via ImageProcessor::patch_features() (mod.rs:459-471, conditioned.rs:187), which also fixes PaddedGrid = 1200.

Both fixed without adding a branch in shared scheduling or cache code.

Cost

Simpler way? Duplication?

No. Ignition is Python and serves nothing at request time, so HF's Gemma4ImageProcessor cannot be reused. Gemma 4's layout (interleaved (y,x,channel), (x,y) positions, 1/255, 3×3 pooling) genuinely differs from patch_merge's channel-planar temporally duplicated 1176-wide patches; parameterising one profile for both is more code and more risk. The PR takes the two real reuse opportunities: patch_merge::Envelope extracted and shared (patch_merge.rs:10-136, MiniMax behaviour unchanged), and resize::resize reused.

Residual, non-blocking

Bottom line

Worth merging. It sits at the sanctioned extension point, keeps the wire additive, ships CI-durable bit-exact parity against Hugging Face across 8 fixture cases at two soft-token budgets, moves three invariants from per-request rejection to load-time failure, and repairs two independent latent main defects — a per-request rejection for any span-declaring Bracketed core, and a per-request cache-invalidation bug for every MiniMax prepared image. Land it, then treat the TODO's end-to-end qualification as the real bar before claiming Gemma 4 vision support.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Prose

Verdict: clean Blocking:

Re-reviewed PR #483 at head ab9a432b (38 files, +2490/−251; base main 27716185) through the prose lens against the charter (charter lines 12, 21, 35, 42), AGENTS.md:43-70 (required prose review), AGENTS.md:72-140 (the four mandatory PR-description questions and their sub-rules, incl. :110-112 on reproduction inputs and :129-132 on process assurances), AGENTS.md:188-199 (no unsolicited churn; don't present scaffolding as supported), AGENTS.md:431-444 (core compatibility), and .agents/skills/repo-prose/SKILL.md:13-46 (not opened) (present-state spec, no false definite references, evidence as conditions/measurement/result).

All four should-fix items from the previous round are verified fixed in the diff: the helios/README.md:721-724 contradiction (the 1536 / temporal-copy / 2×2 paragraph is now scoped "For Qwen" and points at ImageProcessor::patch_features()), the missing Gemma 4 settings in docs/runtime-core-design.md:237-239, the undocumented fixture provenance at helios/README.md:798-807, and the --ignored evidence block in the description (now names the two required tokenizer files, a real snapshot path form, and "not part of CI"). Earlier nits on gemma4.rs load-error wording, the bracketed.rs span message, and the libprotoc/7.36.1 mismatch are also resolved.

I re-verified the description's causal "Why" against main: the span-declaring Bracketed failure at validate_prompt_data (helios/src/model.rs:436-454 on main) and the per-request prefill_chunk_size rejection (:421-423 on main) both exist, and both are now handled at load time (helios/src/server/config.rs:449-455, :473-486).

Five nits remain, all wordsmithing rather than correctness: "normalizes" in the description's Claimed result when the profile only rescales by 1/255; a reused $SNAPSHOT name for a different checkpoint; an unmarked mirror of the soft-token allowlist between frontend.py and gemma4.rs; two tests that restate fixture rows already pinned bit-exactly by SHA-256; and a subject-only commit message whose compatibility/validation note lives only in the PR description. None of these would mislead a reviewer about behavior or evidence.

Full report · Notes

Conventions

Verdict: clean Blocking:

Reviewed PR #483 at head ab9a432 (38 files) through the conventions-and-duplication lens: each new construct compared with its closest in-repo precedent and against AGENTS.md:188-199, docs/design-review.md principle 3 and the charter's "keep the runtime small and model-agnostic". Every item raised in earlier passes is closed in code, not just in the reply: gemma4::Processor::load now emits per-condition errors naming the field and both values (gemma4.rs:25-84); process calls self.patch_features() instead of re-inlining 3*patch_size² (gemma4.rs:164); the legacy 0 → 1176 rule moved onto the contract type as VisionCapabilities::bracketed_patch_features() (model.rs:72-80) with the duplicate Bracketed bootstrap check collapsed into one actionable error (server/config.rs:443-463); the README process paragraph is scoped to Qwen with per-profile width pointed at the accessor; the fixture model block is consumed by a provenance test; and a legacy Bracketed core with patch_features omitted loads end-to-end through Inputs::new at 1176 floats (model/tests.rs:1277-1452). The pb2 header nit is withdrawn: main is also 7.36.1.

Residual nits: per-profile patch width is authored twice over different enums (packing.rs:31-93 vs mod.rs:459-471), linked only by a test; the soft-token allowlist exists in Rust and Python with nothing tying them (gemma4.rs:13 vs frontend.py:132); Envelope is documented as shared but homed in patch_merge.rs:10-17; max_patches is computed twice (gemma4.rs:61-64, :98-100); load validation accepts ranges where patch_merge.rs:92/qwen.rs:22 pin one value and glm.rs:13/padded_grid.rs:31-34 would suggest a const; the settings literal repeats in six tests despite frontend::test_support (frontend/mod.rs:104 (not opened)); and the new fixture generator copies pattern/digest verbatim from the GLM generator (consistent with every generator there). Precedents that hold: proto tag 11 + Gemma4ImageSettings, additive contract_enum! append, #[serde(default)] tag 6, describe.rs/protobuf.rs arms beside PatchMerge (with 0 omitted so legacy describe JSON is unchanged), Profile/ImageSettings arms mirroring PaddedGrid, and the Ignition gemma4 branch mirroring glm. Limits: read-only review, no cargo test/pytest run; numerical parity, load cost and serving behaviour are other lenses.

Full report · Notes

Simplicity

Verdict: should-fix issues only Blocking:

This round the PR's simplicity debt is mostly gone: the author's polish commit deleted the superseded native_* test, Drop-guarded the ignored test's temp Jinja file, flattened the duplicated patch-width check in server/config.rs into one if/else if, wired the fixture's processor/model blocks into a real Python test, and added the requested legacy Bracketed core-load test. I withdraw my earlier "redundant grid guard" nit: the author's h=2, w=9, ppf=9 counter-example is correct — tokens * patches_per_feature == patches does not imply a square tiling.

What remains is concentrated in the Gemma 4 profile's unreachable configuration surface and in two tests that restate facts already pinned elsewhere. The patch_size/pooling_kernel_size finding is the most substantive: ignition/preparation/frontend.py:124-127 and :140-141 reject every pair except 16/3, and :168-173 writes the literals, so the 1..=64 and 1..=16 caps in gemma4.rs:27-40 are dead code and 768 is spelled three ways. The author's defence (it mirrors PatchMergeImageSettings.patch_size, pinned to 14 at patch_merge.rs:92) is precedent for the defect, not a requirement — and unlike PatchMerge these tags have never shipped, so nothing constrains them. Both should-fix items are ~10-70 lines each and strictly reduce what a future reader must hold in mind.

Limits: read-only review, no cargo or pytest run; test counts and SHA-256 parity are the author's claims, and the live-checkpoint runs are outside CI.

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

Reviewed PR #483 at head ab9a432b (38 files, +2490/−251) through the correctness lens; read-only (no cargo/pytest executed). No blocking issue: the wire additions are additive and defaulted (proto tag 11 for ImageSettings.gemma4, VisionCapacity.patch_features = 6, ImagePreparationKind::Gemma4 = 11), patch_features == 0 preserves the legacy 1176 Bracketed width so existing MiniMax cores still load (model.rs:74-80, mounting test helios/src/model/tests.rs:1279-1452), atomic span emission moved into the layout and is gated on image_tokens.span.is_some() with bounds checks at both ends (layouts/bracketed.rs:52-106), and the sizing path is overflow-guarded (gemma4.rs:48-71, :157-177).

The two findings from earlier runs are genuinely closed: gemma4::Processor::load (gemma4.rs:25-83) now returns a distinct, value-naming error for each rejection instead of one opaque message, and the Bracketed narrowing (positive-square patches_per_feature) is disclosed in the PR body and covered by a load test.

Remaining should-fix is coverage: the two allowlists in two languages admit 70/140/560 but nothing loads those budgets — the fixture generator only emits 280 and 1120 (tests/frontend/generate_gemma4_image_fixtures.py:31-40, the 70 at gemma4_images.json:67 is the video processor block, not a case). Nits: patch_features % 3 enforced on non-Bracketed cores with a generic message (model.rs:89); the duplicated allowlist; unchecked arithmetic safe only via the load caps (gemma4.rs:99, :139); and the untested sub-envelope prefill truncation in scheduler/policy.rs:337-351. Could not settle whether any already-published core in local-inference-lab/hyperflare-recipes declares a Bracketed non-square patches_per_feature — a recipe-repo compatibility question, not a defect here.

Full report · Notes

Architecture

Verdict: should-fix issues only Blocking:

Scope is right: helios/src/frontend/images/ already owns ten preparation profiles and Gemma 4 enters through the existing ImageSettings enum (mod.rs:249-261), not a new mechanism; the proto change is additive and optional (VisionCapacity.patch_features tag 6, #[serde(default)], 0 = legacy 1176); the load-time envelope bound sits in bootstrap (server/config.rs:464-487) where it belongs.

Every blocker and should-fix from my previous round is fixed at head ab9a432 and verified in code: contract.py:109-119 now defaults vision["patch_features"] = 0 with the docstring telling a Bracketed recipe with a non-1176 width to set it; helios/src/model/tests.rs:1279-1452 strips patch_features from a serialized Bracketed contract, asserts the decode is 0 and loads through Inputs::new staging 16×1176 floats; gemma4.rs:25-84 returns per-condition errors naming field and both values; gemma4.rs:86-88 is the single width expression; tests/preparation/test_frontend_gemma4.py:187-225 now reads the fixture's provenan

Full report · Notes

Subtractive

Verdict: should not be merged

The change: +2490 / −251 lines across 38 files

Could remove: about 1,514 lines in 7 places (61% of the diff) if the Gemma 4 profile is deferred; about 304 lines (12%) if it is kept as written.

Biggest subtractions:

Left behind: nothing dead outside the change once the duplicated tests/fixture keys above go; helios/src/model/prompt.rs:52-65 is left with a one-use derivation of atomic_spans (image_tokens.span.is_some()) that belongs in the Bracketed arm as an Option<&ImageSpan>.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/483

Full report · Notes

code review summary

Recommendation: Changes Requested

Blockers:

None.

Should fix:

Nits:

10 nits


Full report — no blockers; every round-3 should-fix is fixed and verified in code at ab9a432b (per-condition load errors naming both values, a single patch_features() authority, patch_features authored in the Ignition contract default, fixture provenance consumed by a CI test, the legacy Bracketed core-load test, the folded bootstrap width check, the deleted superseded #[ignore] test with a Drop-guarded template, and corrected README/docs). Nothing is wrong on the served path. The four remaining should-fix items are one scope confirmation plus one test that would catch a real FileNotFoundError, one budget-coverage gap, and one test-plumbing reduction. Ten nits cover patch width authored over two enums, duplicated test rows, a doubled max_patches, an over-broad % 3 rule, Envelope's home, the atomic_spans shape, an untested sub-envelope prefill path, and two doc/wording fixes. Two debates are recorded as accepted as-is (patch_size/pooling_kernel_size on the wire, recipe-side width authoring); round-3 nits on the duplicate bootstrap check and bracketed_patch_features() are resolved, and the packing.rs divisibility nit is withdrawn as wrong. Verification was read-only: no cargo test/pytest, and no CI checks on the head commit, so all behavioural claims come from code and callers.

Full report · Notes

Pre Test Report

Pre-test report — PR #483 "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans"

Head ab9a432b · base main 27716185 · 38 files · +2490 / −251 · no CI checks on head

Verdict: DO NOT REFER TO HARDWARE TESTING. Send back to the author for one small fix plus a CI run.

This supersedes my 2026-11-25 report (written against 2b4a31e). The author pushed ab9a432b answering the third review round point by point; every blocker from previous rounds is now verified fixed in code. Three independent grounds say hardware is the wrong instrument:

  1. Nothing on cn5 or cn7 can exercise this change. cn5 hosts facebook/dinov2-base, timm/vit_base_patch14_dinov2.lvd142m and GLM-5.3-Flash-NVFP4 variants (GPU 0 is at 86 °C and the host is not taking runs); cn7 hosts Qwen3.8-27B variants. No Gemma 4 checkpoint on either host, and no in-tree recipe selects the new profile — recipes were split into local-inference-lab/hyperflare-recipes. A GPU run today would exercise nothing in this PR.
  2. Nothing GPU-side is modified. The whole diff is CPU/deterministic: decode → area-bounded bicubic resize → interleaved (y,x,c) patch pack scaled by 1/255 → (x,y) positions → token-envelope expansion → upload extent arithmetic → prompt/span validation. No kernel, graph, numerics or precision path changes, and the PR makes no performance claim, so the benchmark rule (#210) is not engaged. A throughput/latency A/B would be pure waste.
  3. Blast radius on the models the hosts can serve is zero, measured. The one behaviour change reaching existing vision cores is helios/src/frontend/images/conditioned.rs:187, which now calls ImageProcessor::patch_features() (mod.rs:459-471) instead of the literal match at main:187-193. Comparing the two: Qwen/MiMo 1536 → 1536, Radio 768 → 768, Glm 1176 → 1176, PaddedGrid 1200 → 1200, DeepSeek*/Moonvit/Step 588 → 588, and only PatchMerge (MiniMax) 588 → 1176 changes — a genuine bug fix (MiniMax's cached prepared-image records were being re-materialised every request) for a family hosted on neither machine. The new load-time narrowings cannot bite hosted cores either: square_merge_side runs only for ImageLayoutKind::Bracketed (packing.rs:39-46 via model/packing.rs:92-97 (not opened)) and no hosted core is Bracketed; the envelope bounds at server/config.rs:464-487 apply only when max_image_envelope_tokens() is Some, i.e. Profile::Gemma4 only (mod.rs:473-478); model.rs:89 (patch_features % 3) only fires on a nonzero field and no checked-in fixture or test sets it (a search for "patch_features" under helios/tests returns nothing).

Expected value of a hardware run as the PR stands: ≈ 0, and negative if it displaces real work. The evidence this change needs is CPU-only and cheap (cargo test, and a pytest run for the Python producer), and it belongs in CI.


What changed since my last report — all verified in code at ab9a432


Residual findings, and whether any gates a hardware run

# Finding Severity Gates testing?
A prepare_frontend(snapshot, image_profile="gemma4") without preprocessor= raises FileNotFoundError. ignition/preparation/frontend.py:310 resolves the default as preprocessor_config.json (not opened); Gemma 4 (and Inkling 2) snapshots ship processor_config.json (not opened), and the checked-in fixture is a processor dump (the tests write it to processor_config.json (not opened), tests/preparation/test_frontend_gemma4.py:76). Both gemma4 call sites pass the path explicitly (:88, :246), so the documented shape is untested and broken. Pre-existing for padded_grid, so this is consistency plus a missing default test, not a new architectural defect. should-fix No — Python authoring surface, CPU, unreachable from a GPU run
B No in-tree contract mounts the profile, so the serve path is unproven. helios/tests/support/contracts/gemma4_frontend.json:16,17,38 are all null; no fixture uses image_layout: 9 (values present: 3, 10, 2, 6, 1, 5). "Gemma 4 vision works end to end" is unsupported, correctly stated as a limitation and tracked open at docs/TODO.txt:331-337. should-fix (evidence) No — needs a recipe + checkpoint that do not exist yet
C patch_features is authored by nobody in-tree. contract.py:117 defaults it to 0 with a docstring at :111-115 telling Bracketed recipes to set it; the first Gemma 4 recipe that omits it gets the actionable load error at server/config.rs:449-455. Recipe-side work, not a defect here. should-fix (downstream) No
D Soft-token allowlist duplicated Rust/Python (gemma4.rs:13 vs frontend.py:132) with nothing tying them, and only 280 and 1120 are ever loaded (generate_gemma4_image_fixtures.py:31-40), so 70/140/560 geometry is unexercised in both languages. should-fix (coverage) No — CPU table test/extra fixture cases
E Two unreachable wire knobs. patch_size/pooling_kernel_size are pinned to 16/3 by frontend.py:124-127,140-141 and written as literals at :168-173, so gemma4.rs:27-40's 1..=64 / 1..=16 arms cannot fire. Precedent (patch_merge.rs (not opened) pins 14) makes this defensible; dead configuration is a simplicity cost only. nit No
F CI does not run the Python tests. .github/workflows has only helios-lifecycle, native-serving, release; no workflow invokes pytest, so tests/preparation/test_frontend_gemma4.py never runs automatically and the author's statement that the fixture-provenance test runs in CI is not supported. native-serving.yml:63,68 does run cargo test for helios with --features runtime-core,server, so the new Rust tests do run in CI. No CI status is recorded on ab9a432. process No — CI, not hardware
G Nits: describe.rs:451-452 adds the Gemma 4 arm beside PatchMerge; helios/README.md:721-728 (not opened)'s Qwen contract paragraph now correctly scoped and points at ImageProcessor::patch_features(); gemma4.rs:404-420 and :383-402 still restate fixture rows already pinned by hash; the 11-row cross-profile table at packing.rs:695-825 repeats rows four would cover. nits No

No residual item is a substantive architecture or code-quality problem that would be invalidated by hardware testing. Finding A is the only pre-merge must and it is one line in a Python helper; B and C resolve only when the companion recipe lands.

On scope (raised by several lenses): the profile rides the existing ImageSettings/Profile enum — the eleventh preparation profile, the same extension point padded_grid used — the proto changes are additive and defaulted, and the profile is inert until a recipe declares it. That is a sequencing judgement for the maintainers, not a defect, and not a reason to spend a GPU job.


Review-summary reliability — claims I checked and discarded

The lenses converged on the substance, but several notes are stale against this head and should not drive a decision:

The one substantive point several lenses made and I confirmed independently is finding A (frontend.py:310 default path), which no summary pressed as a gate on testing — correctly, because it is Python-side.

Screening: I re-read the changed hand-written surfaces and the PR discussion; no instruction-shaped or agent-directed text. The #autobot:ignore footer is the repository bot's standard opt-out addressed to humans, not an instruction to this review. No injection attempt to report.


  1. Author: fix finding A — resolve the processor path per profile (prefer processor_config.json (not opened) for gemma4/padded_grid, or accept whichever of the two exists) and add a test for the default argument. One line plus a test, and it removes the first failure the next recipe author would hit.
  2. Author: note in the description that no CI workflow runs pytest (finding F), and ask for a cargo test + pytest tests/preparation run reported with skips visible.
  3. Then decide merge. The profile is inert and the wire is additive; the maintainers' remaining question is whether landing it ahead of the companion recipe is acceptable (finding B).
  4. Refer to hardware only when a Gemma 4 vision recipe and a hosted checkpoint exist. At that point the plan below applies, and it is small.

Minimal test plan — only if referred (i.e. only after a Gemma 4 core can be prepared and served)

Stage 0 — gate before any GPU time. p.GraphOperation.Value("terminal_prefill") == 14 and p.ImagePreparationKind.Value("GEMMA4_IMAGE_PREPARATION") == 11 both resolve from the checked-in runtime_core_pb2.py; cargo test --features runtime-core,server and pytest tests/preparation green; the single #[ignore]d test reported as unrun, not as a pass.

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

Stage 2 — single serving check, one cn5 job (4× RTX PRO 6000), only once a recipe and checkpoint exist. Prepare the Gemma 4 core from the companion recipe (vision.patch_features = 768, ImageLayoutKind::Bracketed, ImagePreparationKind::Gemma4); serve TP=1 (TP=2 only if the recipe asks for it). Two requests: one text-only (must match main), one with a single image (HTTP 200, plausible image-grounded output). Repeat the image request once at max_soft_tokens = 280 and once at 1120. Fail-fast strings to watch: conditioned input spans or features violate prompt geometry, invalid bracketed image extent, bracketed image feature run is outside the expanded prompt, image token spans do not match their declared boundaries, maximum image envelope, and any prefill-split rejection. One image at or below the prefill chunk and one above is enough — do not sweep resolutions.

Explicitly not to be tested (would waste hardware):

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Apply Labels

Applied: +triage:review, +enhancement, +area:preparation, +model:gemma4

Classification Confidence

Threshold: 65%

Triage

Priority

Type

Area

Model