Architecture scratchpad · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/2e34d35d-e27a-4a03-8d45-e04f6ff0b552.md

#1 [high] [should fix] Bracketed patch geometry is a count-keyed model allowlist in shared packing

Lens B (architecture/scope). helios/src/frontend/images/packing.rs:16-22 (new bracketed_patch_geometry):

4 => Ok((2, 1176)),
9 => Ok((3, 768)),
_ => Err("unsupported bracketed patches_per_feature")

Used at packing.rs:39-42 (tensor_layout) and packing.rs:480-481,486,497 (bracketed). Why it matters: the patch vector width is 3*patch_size*patch_size (1176 = 321414 for the existing temporal patch-merge, 768 = 316*16 for Gemma 4), i.e. a property of the preparation profile's patch size, while the merge stride is sqrt(patches_per_feature). The table collapses two independent quantities into one lookup keyed on a bare count in shared upload packing. That is a model-identity allowlist expressed as arithmetic: patches_per_feature == 9 is "Gemma 4" here. AGENTS.md (architecture bullet, ~l.358-364) requires "Every member must have a meaning independent of model identity, and its consumers must implement shared behavior from actual data, geometry, and dependencies"; design-review.md principle 1 and 3 say the same (limit native specialization to cache storage/graph bindings; express differences through prepared layout metadata). Third copy of the same knowledge: helios/src/frontend/images/conditioned.rs:192 Profile::Gemma4(_) => 768, plus gemma4.rs patch_size, plus this table. Fix: declare the patch feature width (patch_size, or features-per-patch) in the prepared vision/frontend metadata and derive both merge_side (from patches_per_feature, e.g. isqrt with a divisibility check) and patch_width (from patch_size) from actual declared data, with one owner. At minimum, compute both from declared fields instead of a match on a count.

#2 [high] [should fix] Gemma4ImageSettings never validated against vision.patches_per_feature

helios/src/frontend/images/gemma4.rs:23-38 (Processor::load): validates patch_size != 0, <= 64, pooling_kernel_size != 0, <= 16, and max_soft_tokens membership, then stores limits. ImageLimits carries patches_per_feature (frontend/images/mod.rs:54) but it is never compared with pooling*pooling. max_patches() (l.48-50) and geometry() derive tokens/patches purely from pooling.

Consequence, checkable in code: a Gemma 4 core prepared with pooling 2 (patches_per_feature = 4) but patch_size 16 emits 768 floats per patch; bracketed_patch_geometry(4) returns patch_width 1176, so packing.rs:497 slices pixel_values.get(start*1176..end*1176) and returns "truncated vision pixels" at request time — a request-time failure instead of a load-time one, and Inputs::new (model/packing.rs:92-102) accepts the buffer because the table value is larger than the packed extent. Conversely pooling 4 would emit 3072 floats/patch and the table rejects the core at load with a misleading message. Both padded_grid and glm hardcode their merge (padded_grid.rs:31,186) and are cross-checked by validate_conditioned_inputs (model/prompt.rs:171); the new profile is the only one whose merge is data-driven and unchecked. Fix: reject in Processor::load unless pooling*pooling == limits.patches_per_feature and 3*patch_size*patch_size equals the packed feature width the layout will expect (once finding 1 gives the latter a declared owner).

#4 [high] Should fix: Ignition's contract helper cannot author vision.patch_features, so the new load-time error is the first a recipe sees

Lens B (architecture / layering). Verified in code.

ignition/preparation/contract.py:109-113:

def model_contract(*, vocabulary, input_vocabulary=None, vision=None, ...):
    return dict(version=3, vocabulary=vocabulary, ...
        vision={"feature_slots": 0, **(vision or dict(features_per_request=0, max_images=0,
               patches_per_feature=0, patch_capacities=[]))},

patch_features — the field this PR adds (helios/proto/runtime_core.proto:280-281) as the sole carrier of the Bracketed patch width — is absent from both the default dict and the documented shape. A recipe that passes the four historical vision keys gets patch_features = 0, which on the Rust side decodes as 0 (helios/build.rs:53-56 field attribute, model.rs:51-53) and therefore as the legacy 1176 width (packing.rs:16-24 bracketed_patch_features).

Then server::config::validate_loaded_image_processor (helios/src/server/config.rs:456-464) rejects it: "bracketed image layout patch width (1176) differs from image processor (768); re-export the core with vision.patch_features". server/config.rs:290-298 runs this inside Bootstrap::load, i.e. at flare run, after weights are selected — not at export and not at contract.model_contract time.

Why it matters: the PR's own story is that patch_features makes Bracketed model-agnostic, but the Ignition-side authoring surface never learned the field. The only discoverable mention of it is docs/TODO.txt (the companion-recipe line) and an error message. That is "solve the right problem in the right place" failing on the writer side: a recipe author has no default, no docstring, and no schema hint.

Fix: add patch_features=0 to the default vision dict in contract.py:112 (and note in the docstring that Bracketed vision cores must declare it), so the key exists in every exported contract and a Gemma 4 recipe only has to set 768.

Confirming non-regression that I did verify: a MiniMax Bracketed core keeps loading — processor.patch_features() for Profile::PatchMerge is 3*2*14*14 = 1176 (patch_merge.rs:124-126), vision.patch_features == 0 skips the first comparison, bracketed_patch_features yields 1176, and max_image_envelope_tokens() is None for PatchMerge (mod.rs:475-480) so the envelope bound does not apply.

#8 [high] Verification of previous findings at head 2b4a31e — blockers 1-3 and should-fixes 1-5 and 7 all fixed

Verified against the head commit (2b4a31e) and against main, lens B only.

  1. packing.rs model-identity table — fixed. bracketed_patch_geometry(4=>1176, 9=>768) is gone. Now packing.rs:16-24 bracketed_patch_features(vision) reads vision.patch_features with 0 -> 1176 legacy, and packing.rs:26-32 square_merge_side derives the stride from patches_per_feature.isqrt() with a square check. Untyped arithmetic, no model names. tensor_layout gained a &VisionCapabilities argument (packing.rs:34-39), threaded from its one caller model/packing.rs:92-97.

  2. gemma4::Processor::load contract check — fixed. gemma4.rs:25-52: pooling_area != Some(limits.patches_per_feature) and max_patches <= limits.max_patches_per_image are both rejected, plus patch_size/pooling/max_soft_tokens bounds. Tested negatively at gemma4.rs:219-264 (patches_per_feature 4 rejected, budget 2519 rejected, unsupported soft tokens rejected).

  3. Patch width unification — fixed. ImageProcessor::patch_features() (mod.rs:459-474) covers all 11 profiles; conditioned.rs:187 now calls it instead of its own match; PatchMerge derives 3*2*14*14 = 1176 (patch_merge.rs:124-126), PaddedGrid = padded_grid::FEATURES (mod.rs:465). Cross-profile test: packing.rs:690-826 asserts processor.patch_features() == tensor_layout(...).1 for 11 profile/layout pairs.

  4. Atomic spans moved into the layout — fixed, shape noted in entry #6. The prompt.rs:137-151 fallback block is gone; layouts/bracketed.rs:52-107 now emits spans. model/prompt.rs diff has no span-population logic left. Test prompt.rs:1171-1284 covers span-bearing (2 spans, len 262, marker ids), 64-aligned chunk too small (256 vs 262 rejected), and no-span MiniMax (empty spans).

  5. Envelope bound at load — fixed. server/config.rs:465-488 rejects max_image_envelope_tokens > prefill_chunk_size and > span.max_tokens; gemma4.rs:58-60 max_image_envelope_tokens() = max_soft_tokens + 2. Boundary test server/config.rs:985-1023: 1122 fits in 1152, fails at 1088; span.max_tokens 1121 fails, 1122 passes. Note this is a load-time check in Bootstrap::load (server/config.rs:290-298), which is the correct layer.

  6. runtime_core_pb2.py version — not a finding. main's own runtime_core_pb2.py:5,16 already declares 7.36.1 / 1; the PR's file declares the same. pyproject.toml:34 pins protobuf>=7.36.2, which bounds the runtime, not the generator's emitted header. My earlier concern was wrong; the diff is now descriptor-only plus the two new fields. Drop this.

  7. Ignition single-checkpoint pinning — fixed. frontend.py:114-173 now asserts only model_type, vision_config.model_type, patch_size, pooling_kernel_size, the processor flags, and max_soft_tokens; the 27-layer/1152-hidden/16-head/72-dim/4304-FFN block is gone. Envelope tokens are read from tokenizer_config.json (image_token/boi_token/eoi_token), validated to encode as one token each against tokenizer.json, and cross-checked against optional config.json *_token_id. tests/preparation/test_frontend_gemma4.py covers E2B-sized towers, gemma4_unified rejection on all three surfaces, and three cached checkpoints.

  8. Docs — fixed. helios/README.md:706-717 lists Gemma 4 among profiles and describes the processor; docs/runtime-core-design.md:184-194 documents patch_features and the bootstrap cross-check; helios/model-contract.md:82 documents the field; docs/TODO.txt:330-337 tracks the recipe wiring, E2B/E4B/26B-A4B/31B qualification, and partial-span prefix-cache audit.

Note on the diff scope: the PR head diff also contains a large amount of unrelated main churn (banner removal, flare doctor, parallax, download rewrites, RebuildManifest->PreparationManifest). Those are base-branch commits between the old base and main; they are not this PR's changes (the pr_files list against the merge base shows only the 36 files in the orientation packet). Do not report them.

#9 [high] Research summary

Verdict: should-fix issues only. No blockers remain — every blocker and every should-fix from my previous review is fixed at head 2b4a31e, verified in code (scratchpad entry #8 has the per-finding citations).

Confirmed fixed: the patches_per_feature → width model-identity table is gone from shared packing (packing.rs:16-32 now reads vision.patch_features and derives the stride from isqrt); gemma4::Processor::load enforces pooling² == limits.patches_per_feature and the patch budget (gemma4.rs:25-52); ImageProcessor::patch_features() unifies all 11 profiles (mod.rs:459-474) with a cross-profile test (packing.rs:690-826); atomic spans moved out of prompt.rs into layouts/bracketed.rs:52-107 with span-bearing / small-chunk / no-span tests (prompt.rs:1171-1284); the envelope fits check runs at bootstrap (server/config.rs:465-488) with 64-aligned boundary tests; Ignition now asserts only consumed fields and reads envelope tokens from the tokenizer (frontend.py:114-173); docs and TODO.txt updated. My earlier protobuf-version concern was wrong — main itself declares 7.36.1, so that item is dropped.

Should fix (new, this lens):

Nit/evidence: the positive-square Bracketed narrowing is enforced at model load, not per request — correct place, but the description should say so.

I could not open the recipe manifests (they live in local-inference-lab/hyperflare-recipes), which is what would settle whether any published Bracketed core has a non-square patches_per_feature.

#10 [high] Report of 2026-11-25 (run at head 2b4a31e) — supersedes #3. Verdict: should-fix only, no blockers

Review of PR #483 — Gemma 4 image prep profile, bracketed patch-width metadata, atomic spans

Lens B: architecture & scope. Reviewed at head 2b4a31e against main 27716185. This supersedes scratchpad entry #3 (my 2026-11-24 report, written against the pre-rebase head). Do not report the unrelated churn visible in the raw head diff (banner removal, flare doctor, parallax, download rewrites, RebuildManifest→PreparationManifest); those are base-branch commits, not this PR's files.

Verdict: should-fix issues only. No blocking findings.

Everything from my previous review is fixed (verified in code, see entry #8)

Should fix

1. Ignition's contract helper cannot author the new field — ignition/preparation/contract.py:112. (entry #4) The default vision dict is dict(features_per_request=0, max_images=0, patches_per_feature=0, patch_capacities=[]) — no patch_features, the only carrier of the Bracketed patch width added by helio/proto/runtime_core.proto:280-281. A Gemma 4 recipe that fills in the historical four keys exports patch_features = 0, which bracketed_patch_features reads as the legacy 1176, and server/config.rs:456-464 then rejects it at flare run: "bracketed image layout patch width (1176) differs from image processor (768); re-export the core with vision.patch_features". The failure is at serve time, not export time, and the only authoring hint is that error plus a TODO.txt line. This is the "right problem, wrong layer" pattern on the writer side: the PR made Bracketed model-agnostic in Rust but left the Ignition surface that must declare the width unchanged. Fix: add patch_features=0 to the default dict and note in the docstring that Bracketed vision cores must set it. Compatibility is otherwise intact — MiniMax keeps loading because PatchMerge::patch_features() is 3*2*14*14 = 1176 and max_image_envelope_tokens() is None for non-Gemma4 profiles (mod.rs:475-480).

2. atomic_spans: bool is derived contract state threaded into the layout — layouts/bracketed.rs:23, model/prompt.rs:52-65. (entry #6) The caller computes .image_tokens.as_ref().and_then(|layout| layout.span.as_ref()).is_some() and passes a bool down. layouts::deepseek needs no flag: it always populates data.spans (deepseek.rs:149) because validate_prompt_data already rejects non-empty spans when the contract declares no ImageSpan (model.rs:457-458). So the flag is not needed for correctness, only it also makes the "span is missing envelope markers" check (bracketed.rs:57-65) conditional on the flag. Fix: drop the parameter, populate spans unconditionally as Deepseek does, and let model.rs:457-458 be the gate — this returns prompt.rs to one line per layout.

3. The checked-in fixture pins pixels only; its model/token block is dead data — tests/frontend/gemma4_images.json, gemma4.rs:266-333. (entry #5) generate_gemma4_image_fixtures.py:81-86 writes processor, model, cases; the Rust consumer reads only cases. So the fixture pins no envelope or token behaviour, and the token-level parity lives entirely in #[ignore]d tests (gemma4.rs:375-451) plus test_frontend_gemma4.py:195-200, which pytest.skips without HF_HOME. On a clean CI node the charter's "more than a single checkpoint" requirement (#74) is shown by nothing but prose. Fix: consume the model block in Rust (assert the configured envelope token strings map to the recorded image_token_id/boi_token_id/eoi_token_id, and that the processor settings round-trip through Gemma4ImageSettings); state in the description that the live runs are not run in CI.

Nit / evidence gap

4. The positive-square Bracketed narrowing is enforced at model load, not per request. (entry #7) square_merge_side is now called from tensor_layout (packing.rs:49-56), which Inputs::new (model/packing.rs:92-102) runs while validating any core whose graph binds vision_pixel_values — so a Bracketed core with a non-square patches_per_feature fails to load even if it never serves an image. That is the right place per "existing data, artifacts, and exported cores still load", but the description frames it as a load-path impact on MiniMax specifically; it should say load-time for any Bracketed core. Whether any published Bracketed core is affected cannot be settled here: the recipes live in local-inference-lab/hyperflare-recipes. Checking that repo's MiniMax vision vision.patches_per_feature would settle it.

Scope: does this belong here?

Yes. helios/src/frontend/images/ already owns nine preparation profiles; adding Gemma4 behind the existing ImageSettings enum (mod.rs:257-260, 389) is the established extension point, not a new mechanism. The proto addition is additive (runtime_core.proto:280-281, 449, 585, 598-606; contract.rs:68), decode is one arm (protobuf.rs:168-172), describe is one arm (describe.rs:451-453) and omits patch_features when 0 (describe.rs:465-468). The Envelope extraction from patch_merge::Processor (patch_merge.rs:10-31, 84-136) is genuine de-duplication with no behaviour change for MiniMax: token-uniqueness validation moved verbatim and expand_prompt delegates. No performance or memory claim is made, so the "#210 benchmarks" rule is not engaged — the description already states no serving-path timing was measured.

What I checked and found clean

Overflow guards in gemma4.rs (checked_mul for patch_features, try_fold for patch totals, pooling_area/max_patches as Option); VisionCapabilities::validate() now rejects non-multiples-of-3 widths and accepts 0 (model.rs:72-92); tensor_layout overflow-checks the Bracketed extent (packing.rs:52-54); the protobuf round-trip test (protobuf.rs:812-866) confirms tag 11 selects only image preparation; bracketed() rejects any grid not divisible by the derived merge side and any token/patch mismatch (packing.rs:494-517).

#12 [high] Verification at head ab9a432: prior should-fixes fixed; two remain

Head ab9a432 (36 files, +2269/−240 vs main 27716185).

FIXED, verified in code:

NOT CHANGED (see report):

#13 [high] No Gemma 4 core exists in-tree: contract fixtures cover ten layouts, none Bracketed+Gemma4

Verified by reading every fixture:

Consequence for the lens: the PR's claimed result ("Helios natively ... packs, and validates Gemma 4 images ... emits atomic spans from the Bracketed layout") rests on unit fixtures that feed ImageProcessor and prepare_input directly. No prepared core — checked-in or generated by a test — takes the flare run path from Bootstrap::load (server/config.rs:290-298) through validate_loaded_image_processor to a served image request. AGENTS.md:155-169 ("New model recipes, aliases, or formats: ... prove they export and serve cleanly from the PR branch") and :182-186 ("verify that existing data, artifacts, and exported cores still load") are only half satisfied: the compatibility half is now tested (model/tests.rs:1279), the export/serve half is deferred to the unlanded local-inference-lab/hyperflare-recipes PR and recorded open in docs/TODO.txt:330-337.

What would settle it: one contract JSON (like qwen38.json) with image_layout: 9, image_preparation: 11, image_tokens.span, vision { patches_per_feature: 9, patch_features: 768 }, loaded through the same helper the other fixtures use. Alternatively an explicit statement that Gemma 4 serving is unqualified — the description's limitations paragraph already says no serving-path timing/memory was measured, but it does not say the profile has never been served.

#15 [high] Report of 2026-11-25, run at head ab9a432 — supersedes #11. Verdict: should-fix only, no blockers

Final report text for PR #483, lens B (architecture & scope), head ab9a432, base main 27716185, 36 files +2269/−240. Supersedes entry #11.

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

Verdict: should-fix issues only. No blocking findings.

Key findings

Every blocker and should-fix from my previous round is fixed at this head, verified in code (entry #12):

Correction to my own prior review. My earlier "drop atomic_spans, let model.rs gate it" advice was wrong on its premise: helios/src/model.rs:467-469 rejects non-empty spans when the contract declares no ImageSpan, and MiniMax Bracketed cores declare none (helios/src/model/prompt.rs:478-484 sets span: None for every non-Deepseek layout). Emitting unconditionally would break existing MiniMax cores. The flag is required; only its shape survives as a nit.

Should fix

S1 — No Gemma 4 core exists in the tree; the served path is unexercised (entry #13)

helios/tests/support/contracts/gemma4_frontend.json is the only Gemma 4-named contract and declares "image_preparation": null (:16), "image_layout": null (:17), "image_tokens": null (:38) — it cannot load an image processor. No fixture under helios/tests/support/contracts/ uses Bracketed (9) or preparation 11; layouts in use are 1, 2, 3, 7, 8, 10. Gemma 4 coverage is Rust-constructed only: helios/src/model/prompt.rs:1171-1284 (two 262-token spans, patch_features: 768, 64-aligned rejection) and helios/src/server/config.rs:935-1023 (bootstrap bounds); the Ignition side is ignition/preparation/frontend.py:114-174 with tests/preparation/test_frontend_gemma4.py. Nothing takes a Gemma 4 core from Bootstrap::load (server/config.rs:290-298) through validate_loaded_image_processor to a served image request. AGENTS.md:155-169 asks a new format to "prove they export and serve cleanly from the PR branch, and support more than a single checkpoint"; the compatibility half (:182-186) is now tested, the export/serve half is deferred to the unlanded recipe PR and open at docs/TODO.txt:330-337. Fix (cheap): one contract fixture shaped like qwen38.json with image_layout: 9, image_preparation: 11, a declared image_tokens.span, and vision { patches_per_feature: 9, patch_features: 768 }. Or say plainly in the description that Gemma 4 serving is unqualified — the limitations paragraph covers missing timing/memory but not that the profile has never been served.

S2 — The Gemma 4 processor file is not where the default path looks (entry #14)

ignition/preparation/frontend.py:310 reads snapshot / "preprocessor_config.json" when preprocessor is omitted. Gemma 4 snapshots ship processor_config.json — the checked-in fixture is a processor dump and every test passes the path explicitly (tests/preparation/test_frontend_gemma4.py:88, :246). A recipe calling prepare_frontend(snapshot, image_profile="gemma4"), the documented shape used for the other profiles, raises FileNotFoundError; no test covers the default. Pre-existing for padded_grid too, so this is consistency plus a missing test. Fix: pick the file per profile, or require preprocessor for those profiles and say so in the docstring.

S3 — Two unreachable wire knobs and a duplicated allowlist (entry #12)

Gemma4ImageSettings.patch_size/pooling_kernel_size (helios/proto/runtime_core.proto:599-602, frontend/images/mod.rs:334-341) travel proto → serde → Python, but the only producer fixes them at frontend.py:127-141, which makes the caps at gemma4.rs:27-40 unreachable. The soft-token allowlist exists twice, in Rust (gemma4.rs:13) and Python (frontend.py:132), with no test tying them. AGENTS.md:188-193 forbids configuration switches without a concrete requirement. The author's stated reason — matching PatchMergeImageSettings.patch_size, likewise fixed to 14 at patch_merge.rs:92 — is a real precedent, so accept the fields if it holds; but the two allowlists should be tied by a test or reduced to one (preparation is the right home for the checkpoint gate; Rust can accept any positive budget).

Nits

  1. atomic_spans: bool (layouts/bracketed.rs:23, computed at model/prompt.rs:52-65) is correct but should pass Option<&ImageSpan>, the prepared field, so the derivation sits with its use, as class_token receives its token.
  2. Envelope now lives in patch_merge.rs:10-17, 84-136 but is shared by two profiles; move it to frontend/images/envelope.rs. The extraction itself is genuine de-duplication with no MiniMax behaviour change (token-uniqueness validation moved verbatim, expand_prompt delegates).
  3. gemma4.rs:384-402 repeats seven of nine fixture rows already pinned by SHA-256 at :315-381; only (100,3000)/(3000,100) are unique. pixels_interleave_rgb_and_positions_are_xy (:405-420) restates the 91×37 case. packing.rs:685-815 repeats patch_features: 0 ten times where three rows cover every distinct outcome.

Scope: does this belong here?

Yes. helios/src/frontend/images/ already owns ten preparation profiles; Gemma4 goes behind the existing ImageSettings enum (mod.rs:249-261, :389, :274-289), the established extension point rather than a new mechanism. The proto change is additive and optional (VisionCapacity.patch_features tag 6, #[serde(default)] at model.rs:51-53, 0 = legacy via bracketed_patch_features at :74-80); decode is one arm (runtime_core/protobuf.rs:168-172); describe is one arm that omits the field when 0 (describe.rs:466-468); the round-trip test (protobuf.rs:813-866) confirms tag 11 selects only image preparation; VisionCapabilities::validate() accepts 0 and rejects non-multiples of 3 (model.rs:86-101). Envelope bounds are enforced at bootstrap (server/config.rs:464-487), the right layer. No performance claim is made, so the #210 benchmark rule is not engaged. The one real narrowing is unchanged: square_merge_side (packing.rs:16-22) runs inside tensor_layout from Inputs::new (model/packing.rs:92-97), so a Bracketed core with a non-square nonzero patches_per_feature now fails to load. Zero is already rejected earlier (model.rs:88), so only non-square nonzero values are newly affected — and the new test covers that. The description should say the narrowing is load-time for any Bracketed core, not only a MiniMax load-path change.

Checked and found clean

Overflow guards in gemma4.rs (checked_mul at :49-51/:62-64, try_fold at :157-162, check_batch before and after geometry at :152/:163); bracketed() rejects grids not divisible by the derived merge side and any token/patch mismatch (packing.rs:491-497) — the author is right that divisibility is not implied by tokens * patches_per_feature == patches; layouts/bracketed.rs:89-93 cross-checks image and feature counters against processed geometry; validate_conditioned_inputs (prompt.rs:153-191) still enforces per-span feature ownership.

Open questions / could not establish

What to do next

  1. S1 — one Bracketed+Gemma 4 contract fixture, or state that serving is unqualified.
  2. S2 — resolve the processor file per profile, with a test for the default argument.
  3. S3 — tie the two soft-token allowlists, or drop one.
  4. Nits 1-3, batchable in one pass.

#5 [medium] Should fix: the checked-in Gemma 4 fixture pins pixels only; its model/token block is dead data, so envelope parity has no CI evidence

Lens B (evidence vs. claim, charter "Bring real evidence" + "New model recipes … must list supported checkpoints … and support more than a single checkpoint (#74)").

Verified: tests/frontend/generate_gemma4_image_fixtures.py:81-86 writes three top-level keys — processor, model (subset of vision_config/model_type/image_token_id/boi_token_id/eoi_token_id), cases. The consumer, helios/src/frontend/images/gemma4.rs:266-333, reads only fixture["cases"] (width/height/seed/max_soft_tokens/grid/tokens/patches/resized/pixels/positions). Nothing in the repository reads fixture["processor"] or fixture["model"] (grep for gemma4_images.json returns only gemma4.rs:270).

Consequences:

  1. The fixture does not pin envelope/token behaviour at all — envelope coverage now rests on patch_merge.rs::envelope_expands_image_placeholders_and_rejects_mismatches with a synthetic BPE tokenizer, which is a different tokenizer from the checkpoint's.
  2. The token-level checkpoint tests are #[ignore = "requires FLARE_GEMMA4_TEST_SNAPSHOT"] (gemma4.rs:375-447) and #[ignore = "requires .venv with transformers Gemma4ImageProcessor"] (gemma4.rs:450-451); the third-checkpoint evidence in tests/preparation/test_frontend_gemma4.py:187-200 pytest.skips when the snapshot is not in HF_HOME. So on a clean CI node "more than a single checkpoint" (#74) is still shown by nothing but prose.

Fix: consume the fixture's model block (assert the configured image_token/start_token/end_token ids match the recorded image_token_id/boi_token_id/eoi_token_id and that the processor settings round-trip through Gemma4ImageSettings), which is pure Rust and needs no checkpoint; and state in the description that the live runs are unrun-in-CI rather than counting them as passing.

#6 [medium] Should fix: the atomic_spans flag is a caller-derived projection of contract state, not layout state

Lens B (right place / smallest footprint). Verified.

helios/src/frontend/images/layouts/bracketed.rs:23 adds an atomic_spans: bool parameter to prepare_input, and model/prompt.rs:52-65 computes it by digging the flag out of the contract on the caller's side:

Some(ImageLayoutKind::Bracketed) => layouts::bracketed::prepare_input(
    frontend, processor, rendered, &images,
    config.contract.frontend.image_tokens.as_ref()
        .and_then(|layout| layout.span.as_ref()).is_some(),
)?,

The callee already receives everything needed to decide. processor.expand_prompt -> patch_merge::Envelope::expand (patch_merge.rs:33-81) produces the start/end marker ids; the layout has rendered, the expanded tokens, and images. What it does not have is the declared ImageSpan (start_token/end_token/max_tokens), which is config.contract.frontend.image_tokens.

Two smaller consequences worth naming, both visible in the code:

Fix: drop the parameter; populate spans unconditionally in the layout (the Deepseek pattern), and let validate_prompt_data's existing "image layout does not declare atomic spans" branch (model.rs:457-458) be the gate. That keeps layout state owned by the layout, removes the flag from the shared signature, and makes the marker-presence check unconditional.

Not a defect, just what to cite: with the flag removed, prompt.rs returns to one line per layout, which is the pre-PR shape (git show main:helios/src/model/prompt.rs:53-55 is a single-line call).

#7 [medium] Nit/evidence: the positive-square Bracketed narrowing is enforced at model load, not per request; description should say so

Lens B (compatibility with existing artifacts). Verified that this narrowing is real and check its blast radius.

helios/src/frontend/images/packing.rs:26-32 square_merge_side is now called from tensor_layout for every ImageLayoutKind::Bracketed pixel tensor (packing.rs:49-56), i.e. from model/packing.rs:92-102 while loading (validating) any core with a Bracketed vision graph. Before the PR, Bracketed did not inspect patches_per_feature here at all (main: (ImageLayoutKind::Bracketed, "vision_pixel_values") => (Float32, patches * 1176)).

Also packing.rs:503: || geometry.tokens.checked_mul(patches_per_feature) != Some(geometry.patches) replaces the old geometry.tokens != geometry.patches/4 || vision.patches_per_feature != 4.

So a core whose vision.patches_per_feature is not a perfect square — or a Bracketed core that declares, say, patches_per_feature = 2 — now fails at model load with "bracketed patches_per_feature must be a positive square" / "invalid bracketed image extent". The description discloses this ("Bracketed now requires a positive-square patches_per_feature"). What it does not disclose is that the check moved earlier: square_merge_side in tensor_layout runs during Inputs::new for any graph binding vision_pixel_values, so a Bracketed core that never serves an image request still fails to load. Under the charter's "Supported matrix & compatibility … verify that existing data, artifacts, and exported cores still load", that is the right place for it (fail at load), but the description should say load-time, not request-time.

I could not check whether any in-tree or published Bracketed core has a non-square patches_per_feature: the only Bracketed core in this repository is the MiniMax one exercised in layouts/bracketed.rs:124-200 and patch_merge.rs:143, which uses the default ImageLimits (patches_per_feature: 1 from mod.rs:65) — note 1 is a square (side 1) so it passes, but it also means the packing tests at packing.rs:600-690 are the only ones exercising a real square. Recipes live in local-inference-lab/hyperflare-recipes. Checking that repo's MiniiMax vision vision.patches_per_feature would settle it; I could not open it.

Not a finding on its own; record as a description-evidence gap for the compatibility statement.

#14 [medium] Should fix: gemma4 image settings default to a processor file Gemma 4 snapshots do not have

ignition/preparation/frontend.py:310: path = snapshot / "preprocessor_config.json" if preprocessor is None else Path(preprocessor).

The new gemma4 branch (:114-174) validates a Gemma4Processor dict read from that path, and the comment at :115-117 plus the doc for padded_grid (:100, "Inkling 2 ships the processor in processor_config.json") show the project already knows some families put it in processor_config.json. Gemma 4 snapshots ship processor_config.json (the fixture file tests/frontend/gemma4_images.json is a processor dump, and every test passes it explicitly: tests/preparation/test_frontend_gemma4.py:88 preprocessor=tmp_path/"processor_config.json", :246 preprocessor=snapshot/"processor_config.json").

So a recipe that calls prepare_frontend(snapshot, image_profile="gemma4") — the documented shape, matching how the other profiles are called — raises FileNotFoundError on preprocessor_config.json. No test covers the default path for gemma4, so nothing catches it in CI.

Severity: should fix (small). Fix: resolve the processor path per profile (try processor_config.json for gemma4/padded_grid, or accept whichever of the two exists), or make preprocessor required for the profiles that need it and say so in the docstring. Note it is pre-existing for padded_grid, so this is consistency plus a missing test rather than a new defect.