#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.
-
packing.rsmodel-identity table — fixed.bracketed_patch_geometry(4=>1176, 9=>768)is gone. Nowpacking.rs:16-24bracketed_patch_features(vision)readsvision.patch_featureswith0-> 1176 legacy, andpacking.rs:26-32square_merge_sidederives the stride frompatches_per_feature.isqrt()with a square check. Untyped arithmetic, no model names.tensor_layoutgained a&VisionCapabilitiesargument (packing.rs:34-39), threaded from its one callermodel/packing.rs:92-97. -
gemma4::Processor::loadcontract check — fixed.gemma4.rs:25-52:pooling_area != Some(limits.patches_per_feature)andmax_patches <= limits.max_patches_per_imageare both rejected, pluspatch_size/pooling/max_soft_tokensbounds. Tested negatively atgemma4.rs:219-264(patches_per_feature 4 rejected, budget 2519 rejected, unsupported soft tokens rejected). -
Patch width unification — fixed.
ImageProcessor::patch_features()(mod.rs:459-474) covers all 11 profiles;conditioned.rs:187now calls it instead of its own match;PatchMergederives3*2*14*14 = 1176(patch_merge.rs:124-126),PaddedGrid=padded_grid::FEATURES(mod.rs:465). Cross-profile test:packing.rs:690-826assertsprocessor.patch_features() == tensor_layout(...).1for 11 profile/layout pairs. -
Atomic spans moved into the layout — fixed, shape noted in entry #6. The
prompt.rs:137-151fallback block is gone;layouts/bracketed.rs:52-107now emits spans.model/prompt.rsdiff has no span-population logic left. Testprompt.rs:1171-1284covers span-bearing (2 spans, len 262, marker ids), 64-aligned chunk too small (256 vs 262 rejected), and no-span MiniMax (empty spans). -
Envelope bound at load — fixed.
server/config.rs:465-488rejectsmax_image_envelope_tokens > prefill_chunk_sizeand> span.max_tokens;gemma4.rs:58-60max_image_envelope_tokens() = max_soft_tokens + 2. Boundary testserver/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 inBootstrap::load(server/config.rs:290-298), which is the correct layer. -
runtime_core_pb2.pyversion — not a finding.main's ownruntime_core_pb2.py:5,16already declares7.36.1/1; the PR's file declares the same.pyproject.toml:34pinsprotobuf>=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. -
Ignition single-checkpoint pinning — fixed.
frontend.py:114-173now asserts onlymodel_type,vision_config.model_type,patch_size,pooling_kernel_size, the processor flags, andmax_soft_tokens; the 27-layer/1152-hidden/16-head/72-dim/4304-FFN block is gone. Envelope tokens are read fromtokenizer_config.json(image_token/boi_token/eoi_token), validated to encode as one token each againsttokenizer.json, and cross-checked against optionalconfig.json*_token_id.tests/preparation/test_frontend_gemma4.pycovers E2B-sized towers,gemma4_unifiedrejection on all three surfaces, and three cached checkpoints. -
Docs — fixed.
helios/README.md:706-717lists Gemma 4 among profiles and describes the processor;docs/runtime-core-design.md:184-194documentspatch_featuresand the bootstrap cross-check;helios/model-contract.md:82documents the field;docs/TODO.txt:330-337tracks 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):
ignition/preparation/contract.py:112— themodel_contractdefaultvisiondict omitspatch_features, the only carrier of the Bracketed patch width this PR adds. A Gemma 4 recipe authored through it gets0→ legacy 1176 → rejected atflare runbyserver/config.rs:456-464, never at export. The writer side of the layering was not updated. MiniMax is unaffected (PatchMerge yields 1176 and has no envelope).helios/src/frontend/images/layouts/bracketed.rs:23+prompt.rs:52-65—atomic_spans: boolis caller-derived contract state threaded into the layout;layouts::deepseekneeds no such flag becausevalidate_prompt_data(model.rs:457-458) already gates it. It also makes the marker-presence check conditional.tests/frontend/gemma4_images.json— the fixture carriesprocessorandmodelblocks that no test reads;gemma4.rs:266-333consumes onlycases. Envelope/token parity and the charter's #74 "more than one checkpoint" therefore rest on#[ignore]d tests andpytest.skips only.
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)
- Blocker 1 (model-identity table in shared packing) — fixed. The
4 => 1176, 9 => 768match is gone.packing.rs:16-24bracketed_patch_features(vision)readsvision.patch_features,0→ legacy 1176;packing.rs:26-32square_merge_sidederives the stride frompatches_per_feature.isqrt()with a square check. This is the right fix: patch width is now prepared metadata, not an inference from a merge count.tensor_layoutthreads&VisionCapabilitiesfrom its one caller,model/packing.rs:92-97. - Blocker 2 (silent pass-by-skip parity tests) — fixed.
tests/frontend/generate_gemma4_image_fixtures.py+tests/frontend/gemma4_images.json(8 cases acrossmax_soft_tokens280 and 1120) run unconditionally ingemma4.rs:266-333; the checkpoint tests are#[ignore]with explicit assertions (gemma4.rs:375-451) instead of early returns. (Residual evidence gap: entry #5.) - Blocker 3 (spans in shared code) — fixed. The
prompt.rsfallback is deleted; spans are emitted inlayouts/bracketed.rs:52-107, gated on the contract'sImageSpan, with both envelope markers validated. Tests atprompt.rs:1171-1284. (Shape nit: entry #6.) - Should-fix:
Processor::loadvs. packing contract — fixed.gemma4.rs:25-52rejectspooling_area != Some(limits.patches_per_feature)andmax_patches > limits.max_patches_per_image; negative testsgemma4.rs:219-264. - Should-fix: patch width authored three times — fixed.
ImageProcessor::patch_features()(mod.rs:459-474) covers all 11 profiles;conditioned.rs:187uses it;PatchMergederives 1176 (patch_merge.rs:124-126),PaddedGridusespadded_grid::FEATURES. Eleven-pair consistency test atpacking.rs:690-826. - Should-fix: 1,120-soft-token envelope vs.
prefill_chunk_size— fixed.server/config.rs:465-488rejectsmax_image_envelope_tokens > prefill_chunk_sizeand> span.max_tokens, at bootstrap (server/config.rs:290-298), with 64-aligned boundary tests (server/config.rs:985-1023). - Should-fix: Ignition pinned one vision tower — fixed.
frontend.py:114-173asserts onlymodel_type,vision_config.model_type,patch_size,pooling_kernel_size, processor flags,max_soft_tokens; the 27-layer/1152/16-head/72-dim/4304 block is gone; envelope tokens come fromtokenizer_config.json, are verified to encode as one token againsttokenizer.json, and are cross-checked against optionalconfig.jsonids.gemma4_unifiedrejected on all three surfaces. - Should-fix: stale docs — fixed.
helios/README.md:706-717,docs/runtime-core-design.md:184-194,helios/model-contract.md:82,docs/TODO.txt:330-337. - My
runtime_core_pb2.pyversion concern was wrong.main's own file already declares7.36.1;pyproject.toml:34(protobuf>=7.36.2) bounds the runtime, not the generator header. Withdrawn.
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:
- S2 authoring surface:
ignition/preparation/contract.py:109-119— default vision dict now carries"patch_features": 0and the docstring at :111-115 tells Bracketed recipes with a non-1176 width to set it. (Residual: width still not derived — see report.) - S1 second half (existing cores still load):
helios/src/model/tests.rs:1279-1452legacy_bracketed_core_omitting_patch_features_loads_and_stages_1176_wide_pixels— serializes a Bracketed contract, removespatch_features(json at :1335-1338), asserts decode→0,Inputs::newok with a 1176-wide buffer,packing::preparestages 1611764 bytes (:1438-1443), and rejects a 768-wide buffer (:1446) and non-squarepatches_per_feature(:1447-1451). Sotensor_layout(packing.rs:39-46) now exercises the load path in-tree. - S3 opaque load error:
helios/src/frontend/images/gemma4.rs:25-84— per-condition messages naming field and both values (patch_size :27-33, pooling :34-40, soft tokens :41-47, pooling area vs patches_per_feature :52-60, patch budget :61-71), with the1..=64/1..=16caps commented as defensive wire caps (:26). Matches theserver/config.rs:443-489style. - Width helper:
gemma4.rs:86-88patch_features()used at :164 for both capacity and reserve, so no re-inlined3*patch*patch. - Fixture dead data:
tests/preparation/test_frontend_gemma4.py:187-225test_checked_in_gemma4_fixture_provenance_matches_image_settingsnow readsfixture["model"]andfixture["processor"]fromtests/frontend/gemma4_images.json, builds a tokenizer from the recorded image/boi/eoi ids, runsimage_settingsand asserts the resolved settings equal patch_size 16 / pooling 3 / max_soft_tokens 280. The blocks are no longer unread (Rust consumer still reads onlycases, gemma4.rs:321). - Superseded test deleted:
gemma4.rsnow 505 lines; nonative_pixels_and_positions_match_the_checkpoint_processor. Temp template guarded byDrop(:443-448, drop at :469). - Docs:
docs/runtime-core-design.md:180-194(patch_features), :233-242 (Gemma 4 image settings enumerated);helios/model-contract.md:82;docs/TODO.txt:330-337.
NOT CHANGED (see report):
atomic_spans: boolstill threaded (bracketed.rs:23, prompt.rs:52-65). Verified why unconditional emission is wrong:helios/src/model.rs:467-469rejects non-empty spans when the contract declares no ImageSpan, and MiniMax Bracketed cores declare none (helios/src/model/prompt.rs:478-484setsspan: Nonefor non-Deepseek layouts). So my earlier "drop the flag" advice was wrong on the premise; only the shape (passOption<&ImageSpan>) survives as a nit.patch_size/pooling_kernel_sizewire knobs remain (proto :599-602, mod.rs:334-341), unreachable from the only producer (frontend.py:127-141 fixes 16/3).- Soft-token allowlist still duplicated:
gemma4.rs:13andignition/preparation/frontend.py:132, no test tying them.
#13 [high] No Gemma 4 core exists in-tree: contract fixtures cover ten layouts, none Bracketed+Gemma4
Verified by reading every fixture:
helios/tests/support/contracts/gemma4_frontend.json(full file, 39 lines):"image_preparation": null(:16),"image_layout": null(:17),"image_tokens": null(:38). The only Gemma 4-named contract fixture declares no image layout, so it cannot load an image processor at all.search_code gemma4|Gemma4overhelios/tests/support/contracts/→ no matches.search_code gemma4|Gemma4overhelios/tests/→ only chat-template/reasoning fixtures (message_boundaries.rs:191,ordinary_tokens.rs:450#[ignore],reasoning_delimiters.rs:213#[ignore]), none of them image contracts.- Contract fixtures present: deepseek4.json, deepseek41.json, gemma4_frontend.json, glm53.json, inkling2_frontend.json, mimo_v2.json, nemotron_h_frontend.json, qwen38.json, step5_frontend.json — layouts in use are Deepseek 3, DeepseekRowMajor 7, Glm 8, Mimo 2, Qwen 1, ClassToken 10. No
Bracketed(9) with Gemma 4 anywhere on disk. - The only contract-level Gemma 4 coverage is constructed in Rust inside a unit test:
helios/src/model/prompt.rs:1171-1284buildsVisionCapabilities { patches_per_feature: 9, patch_features: 768, .. }(:1217) plusImageSpan { max_tokens: 282 }and asserts two 262-token spans and the 64-aligned rejection.helios/src/server/config.rs:935-1023likewise builds a model in Rust. - Ignition knows the profile (
ignition/preparation/frontend.py:114-174,{"gemma4": {...}}) andtests/preparation/test_frontend_gemma4.pyexercises it, but nothing in this repository writes a core.
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):
ignition/preparation/contract.py:109-119now defaultsvisionto include"patch_features": 0, and the docstring at :111-115 tells aBracketedrecipe with a non-1176 width to set it.helios/src/model/tests.rs:1279-1452mounts aBracketedcontract withpatch_featuresstripped from the JSON (:1335-1338), asserts the decode is 0, loads throughInputs::new, stages16 * 1176floats (:1438-1443), and rejects a 768-wide buffer (:1446) and a non-squarepatches_per_feature(:1447-1451). The load-path claim is now evidence.gemma4.rs:25-84returns per-condition errors naming the field and both values, with the1..=64/1..=16caps documented as defensive at :26.gemma4.rs:86-88patch_features()is the single width expression, used at :164 for capacity and reserve.tests/preparation/test_frontend_gemma4.py:187-225reads the fixture'sprocessorandmodelblocks including the recordedimage_token_id/boi_token_id/eoi_token_id, so that data is no longer dead.- The superseded
#[ignore]d pixel test is deleted; the temp chat template isDrop-guarded (gemma4.rs:443-448, dropped at :469). - Docs:
docs/runtime-core-design.md:180-194and:233-242;helios/model-contract.md:82;docs/TODO.txt:330-337.
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
atomic_spans: bool(layouts/bracketed.rs:23, computed atmodel/prompt.rs:52-65) is correct but should passOption<&ImageSpan>, the prepared field, so the derivation sits with its use, asclass_tokenreceives its token.Envelopenow lives inpatch_merge.rs:10-17, 84-136but is shared by two profiles; move it tofrontend/images/envelope.rs. The extraction itself is genuine de-duplication with no MiniMax behaviour change (token-uniqueness validation moved verbatim,expand_promptdelegates).gemma4.rs:384-402repeats 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-815repeatspatch_features: 0ten 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
- Whether any published
Bracketedcore declares a non-squarepatches_per_featureor omitspatch_features; the manifests live inlocal-inference-lab/hyperflare-recipes, and a sweep there settles the blast radius. - Whether landing the profile ahead of its recipe had explicit maintainer sign-off. The author's answer (recipes were extracted, the core profile must land first) is plausible; only a maintainer can confirm, and the charter lists new formats under "What gets merged".
- Verification limits: read-only. No
cargo test,cargo checkorpytestwas run; the PR's test counts are the author's own evidence and nothing above depends on them. Live-checkpoint runs are outside CI by the description's own note.
What to do next
- S1 — one Bracketed+Gemma 4 contract fixture, or state that serving is unqualified.
- S2 — resolve the processor file per profile, with a test for the default argument.
- S3 — tie the two soft-token allowlists, or drop one.
- 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:
- The fixture does not pin envelope/token behaviour at all — envelope coverage now rests on
patch_merge.rs::envelope_expands_image_placeholders_and_rejects_mismatcheswith a synthetic BPE tokenizer, which is a different tokenizer from the checkpoint's. - 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 intests/preparation/test_frontend_gemma4.py:187-200pytest.skips when the snapshot is not inHF_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:
- The
boolis a caller-computed projection of contract state, so a second caller (helios/tests/..., future layouts) must re-derive the same expression; the siblinglayouts::deepseek(deepseek.rs:127-150) does not take a flag at all and always populatesdata.spans, becausevalidate_prompt_data(model.rs:457-458) rejects non-empty spans when the contract declares noImageSpan. That existing check means the flag is not needed for correctness anywhere: populating unconditionally would fail-loud exactly as Deepseek does. flush_span(bracketed.rs:57-65) only rejects a missing envelope marker whenatomic_spansis true, so the "span is missing envelope markers" invariant is checked only on the path that would have failedvalidate_prompt_dataanyway. Withatomic_spans == falsea Bracketed prompt whose expanded token stream does not carry the markers still passes.
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.