Value proposition report · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/1cc9437d-a084-4a4b-8bef-520ae6bec3b9.md

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.