#1 [high] PR #483 overview, files, charter hooks
PR #483 "Add Gemma 4 image prep profile, bracketed 3x3 packing & atomic spans" by rickybrent, head f2340e42, base 6d6fe0c6, +732/−164, 13 files. No human review yet (only autobot case-file comment). Files: helios/proto/runtime_core.proto (+10), helios/src/frontend/images/{gemma4.rs new +416, mod.rs +20, conditioned.rs +9, packing.rs +45/−5, patch_merge.rs +61/−38}, helios/src/model/{contract.rs +1/−1, packing.rs +1, prompt.rs +15}, helios/src/runtime_core/{describe.rs +2, protobuf.rs +5}, ignition/preparation/frontend.py +25, ignition/preparation/runtime_core_pb2.py +122/−120. Claims: native Gemma 4 image prep with "exact f32 pixel and (x,y) position parity" vs HF Gemma4ImageProcessor; Bracketed now derives stride/width from patches_per_feature ("orthogonal, no model-identity branching"); atomic spans populated; "existing cores and non-Gemma image profiles remain wire-compatible and unaffected". Evidence claimed: 45 passed frontend::images (with FLARE_GEMMA4_TEST_SNAPSHOT=google/gemma-4-31B-it 842da379), 53 passed model::, cargo check flare-cli, 15 pytest. Charter (read_charter): "Keep the runtime small and model-agnostic… shouldn't accumulate per-model branches (#267, #334)"; "Bring real evidence"; "Be explicit and pin everything (#215)"; "New model recipes… must list supported checkpoints… and support more than a single checkpoint (#74)". design-review.md:38-52: input packing/frontend processing stays shared; "Enums, callbacks, schema names, and metadata fields cannot serve as alternative model allowlists"; admission/eviction must not branch on model identity. AGENTS.md:72-140 (required PR description: why/what/result/evidence; "Keep material failures, skipped checks… visible. Test counts and labels cannot stand in for the tested contract and result"; :306 "Report a skipped test as an unrun check"), AGENTS.md:188-199 (no churn/unsupported configuration switches; tests must exercise behavior), :431-444 (additive protobuf).
#2 [high] FULL REPORT — PR #483 Blockers / Should Fix / Nits
FULL REPORT CONTENT (for the case file / final write-up).
=== BLOCKERS ===
B1. Bracket patch width is looked up from patches_per_feature — a model allowlist in shared input packing.
- Finding: helios/src/frontend/images/packing.rs:16-22 fn bracketed_patch_geometry(ppf) { 4 => (2, 1176), 9 => (3, 768), _ => Err } used from tensor_layout (packing.rs:39-42) and bracketed() (packing.rs:479-481).
- Why it is wrong: patch width is 3·patch_size², a vision-tower property; the merge count is unrelated. The key is provably ambiguous in-tree: DeepSeek runs patches_per_feature = 9 with 588 floats/patch (packing.rs:35-38, and helios/src/frontend/images/deepseek*.rs produce 588), so
9 => 768is model identity, not geometry. docs/design-review.md:38-52 requires input packing to "stay shared; use prepared metadata", and states "Enums, callbacks, schema names, and metadata fields cannot serve as alternative model allowlists"; charter line "Keep the runtime small and model-agnostic … shouldn't accumulate per-model branches (#267, #334)". Every other arm of tensor_layout derives its width from a named constant/profile (qwen() packing.rs:123-134; class_token() uses padded_grid::FEATURES packing.rs:515). - It also contradicts the PR description's own claim ("derived … directly from patches_per_feature so ImageLayoutKind and ImagePreparationKind remain orthogonal with no model-identity branching in upload packing").
- Request: carry the vision patch width in prepared metadata (e.g.
VisionCapabilities.patch_size, validated next to patches_per_feature in helios/src/model.rs:68-87) and compute merge_side = ppf.isqrt(), patch_width = 3*patch_size²; or declare the per-layout feature width on the frontend/vision contract the way padded_grid::FEATURES is declared. Delete the table. - Evidence that nothing in-tree breaks: only PatchMerge/Minimax uses ImageLayoutKind::Bracketed today with patches_per_feature = 4 (helios/tests/message_boundaries.rs:494; layouts/bracketed.rs:104-180); Step's 16 (helios/tests/tools/test_step_images.rs:82) is a different layout.
B2. The headline HF-parity evidence cannot fail, and is not reproducible or checked in.
- Finding: helios/src/frontend/images/gemma4.rs:236-244 and :253-256 (checkpoint_tokens_expand_the_image_envelope) return silently unless FLARE_GEMMA4_TEST_SNAPSHOT and ../.venv/bin/python exist; :281-283 returns silently if the template subprocess fails; :336-339 (native_pixels_and_positions_match_the_checkpoint_processor) returns silently without ../.venv/bin/python. A silent return is a pass, so the reported "45 passed" is identical whether the Hugging Face comparison ran or not (AGENTS.md:103-109, :306 "Report a skipped test as an unrun check").
- Repo precedent is a checked-in fixture: helios/src/frontend/images/glm.rs:147-199 compares SHA-256 of resized bytes/pixels/positions from tests/frontend/glm53_images.json with generator tests/frontend/generate_glm_image_fixtures.py; Qwen does the same (qwen38_images.json). This PR adds no such fixture.
- Also: the parity inputs are synthetic rasters ((x%256) as u8, gemma4.rs:378-383) and only 3 sizes.
- Request: add tests/frontend/gemma4_images.json + a generator script (width, height, grid, tokens, hashes of resized/pixel_values/position_ids) and reduce the test to the glm.rs shape; or mark both snapshot-dependent tests #[ignore = "..."] and report them as unrun checks in the description. Either way, say in the description that plain
cargo testdoes not execute the parity comparison.
B3. Atomic spans are produced by shared code for every span-declaring layout, are untested, and their compatibility impact is undisclosed.
- Finding: helios/src/model/prompt.rs:137-151 fills prepared.data.spans from conditioned_inputs whenever
data.spans.is_empty()and the contract declares an ImageSpan — a profile-independent condition. Consumers: validate_prompt_data (helios/src/model.rs:436-451) and Scheduler::set_prefill_spans via helios/src/server/runtime.rs:1458-1465 → helios/src/scheduler.rs:1912-1936 (spans become unsplittable prefill units). - Precedent says the layout owns its spans: helios/src/frontend/images/layouts/deepseek.rs:149 pushes data.spans next to the token block it emitted; after this PR, layouts/bracketed.rs:82-91 still returns PromptData::default() (empty spans), so one field is owned centrally and the rest by the layout. The span is also re-derived from
additional + 1(prompt.rs:129-131, bracketed.rs:77-81), which equals the envelope length only by coincidence of howadditionalis defined. - No test covers the new branch: the only in-tree Gemma 4 contract fixture has "image_tokens": null (helios/tests/support/contracts/gemma4_frontend.json:38), and the layout matrix in helios/src/model/prompt.rs:481-487 declares a span only for Deepseek and DeepseekRowMajor (which already fill their own spans, so the new code never fires under test). No new test in the diff touches prompt.rs.
- The description's "Existing cores and non-Gemma image profiles remain wire-compatible and unaffected" is therefore unbacked and imprecise: any core whose layout declares a span and returns none previously failed validate_prompt_data ("image token spans do not match their declared boundaries") and now succeeds with atomic prefill.
- Request: emit the span in layouts/bracketed.rs beside the envelope it builds (deepseek.rs:149 pattern) and delete prompt.rs:137-151; add a Bracketed contract fixture with image_tokens.span set plus a test that the span is produced, accepted by validate_prompt_data, and rejected/truncated when it exceeds prefill_chunk_size. In the description, state the before/after for existing cores.
=== SHOULD FIX ===
S1. gemma4::Processor::load accepts settings that neither the packer nor the cache validator can represent.
- helios/src/frontend/images/gemma4.rs:23-31 only checks patch_size ∈ 1..=64, pooling_kernel_size ∈ 1..=16, and the max_soft_tokens allowlist; it never requires pooling² == limits.patches_per_feature (which prompt.rs:171 and packing.rs:488 both use) nor that 3·patch_size² equals the packing stride. With patch_size = 14, pooling = 3 the profile loads, emits 588 floats/patch (gemma4.rs:116) and packing.rs:497 slices at the 768-wide stride → silently misaligned tensors or "truncated vision pixels"; conditioned.rs:192's hard-coded 768 makes the cached-record check fail with no error (cache recomputed forever).
- Request: validate in load() that pooling_kernel_size² == limits.patches_per_feature and that 3·patch_size² equals the declared patch width, and that max_soft_tokens·pooling² ≤ limits.max_patches_per_image. (If B1 is done via a declared patch width, this becomes a single cross-check.)
S2. The patch width is authored three times with no compile-time link.
- packing.rs:19 (9 => 768), conditioned.rs:192 (Profile::Gemma4(_) => 768), gemma4.rs:116 (3·patch_size²). conditioned.rs:191 already shows the better pattern for PaddedGrid (padded_grid::FEATURES).
- Request: one shared constant/helper derived from the profile+contract metadata, used by conditioned.rs, bracketed() and gemma4::process. (Subsumed by B1's fix; list so the fix is complete.)
S3. Largest supported image cannot be prefilled atomically at a small chunk size, and nothing checks it.
- max_soft_tokens 1120 (gemma4.rs:11) expands to an envelope of tokens+2 = 1122 (expand: start + tokens image tokens + end, patch_merge.rs:58-69; test asserts start+261 for 260 tokens, gemma4.rs:318-320). validate_prompt_data rejects spans longer than config.limits.prefill_chunk_size (model.rs:421-423) and set_prefill_spans rejects s.end - s.start > capacity (scheduler.rs:1922-1930), and the server turns that into a failed request (runtime.rs:1458-1465). Nothing in load()/geometry() checks max_soft_tokens + 2 ≤ prefill_chunk_size.
- Request: reject the combination at load with a named error (or clamp max_soft_tokens to the largest value whose envelope fits), and add a boundary test. Note prefill_chunk_size must be 64-aligned ≥ 64 (scheduler.rs:67-73), so 1024-chunk deployments hit this.
S4. Ignition's Gemma 4 gate pins one vision tower and derives nothing from the checkpoint.
- ignition/preparation/frontend.py:126-129 asserts num_hidden_layers 27 / hidden_size 1152 / num_attention_heads 16 / head_dim 72 / intermediate_size 4304 — an architecture variant, not a preprocessor fact; the image tokens are literals (:134-136) rather than checked against the checkpoint's added tokens. Consequence: an otherwise identical Gemma 4 checkpoint with a different tower is rejected by preparation with "unsupported … vision configuration", and a checkpoint with different token spellings fails later at request time ("image envelope marker must encode one token", patch_merge.rs:46).
- Charter: "New model recipes … must list supported checkpoints from an official or widely used source … and support more than a single checkpoint (#74)". The evidence names one snapshot (google/gemma-4-31B-it 842da379) while docs/model-preparation.md:345 lists gemma-4-e2b/e4b/12b/26b-a4b/31b.
- Request: assert only the fields the preprocessor consumes (patch_size, pooling_kernel_size, max_soft_tokens, rescale/normalize/convert flags) and the vision model_type/patch/pooling; take the three token strings from the tokenizer config and assert each encodes to one added token; show a second checkpoint in the evidence or narrow the claim to one checkpoint.
S5. Documentation the change makes stale was not updated.
- helios/README.md:702-704 ("Profiles cover Qwen, MiMo, patch-merge, DeepSeek, DeepSeek row-major, Moonvit, Step, RADIO, and GLM inputs") — Gemma 4 missing.
- docs/runtime-core-design.md:226-233 (image settings enumeration per profile) — no Gemma 4 entry, nothing about Bracketed deriving its stride.
- helios/model-contract.md:251-254 (image token layout declares feature IDs and atomic spans; custom image layout code produces token positions) — a new preparation kind with geometry/pooling settings belongs here.
- docs/TODO.txt holds unrun checks and pending measurements (AGENTS.md:57-59); the recipe dependency ("end-to-end multimodal serving requires the companion recipe PRs") is exactly such an entry.
- Request: add Gemma 4 to the three enumerations (16×16 patches, 3×3 pooling, soft-token set) and record the recipe dependency in docs/TODO.txt.
S6. Description corrections (AGENTS.md:72-140).
- The orthogonality claim is contradicted by packing.rs:16-22 (see B1).
- The evidence bullet cites
Execution.persistent_workers(helios/proto/runtime_core.proto:739), which comes from #430 and is not in this diff. - "Existing cores … unaffected" is a process assurance with no check: state that Bracketed acceptance at core load is now narrower (patches_per_feature must be 4 or 9; model/packing.rs:92-97 calls tensor_layout during Inputs::new), and say which cores were swept.
- "Why" describes absences rather than the failing workflow: name the serve-time error without the profile (Helios cannot admit a Gemma 4 multimodal request) and without spans ("prefill splits an atomic image span", helios/src/model/packing.rs:624), and give the dataflow argument that makes the stride derivation model-agnostic.
- Say that no serving-path timing/memory was measured, and that the parity comparison does not run in a plain
cargo test.
S7. Regenerated Python bindings went backwards in generator version.
- ignition/preparation/runtime_core_pb2.py:5 "Protobuf Python Version: 7.36.2" → 7.36.1 and the ValidateProtobufRuntimeVersion minor arg 2 → 1, while pyproject.toml:34 pins "protobuf>=7.36.2,<8". Not a runtime break (the check rejects an older runtime, not an older gencode), but the checked-in artifact now records a generator older than the pin, and the description calls the change additive without mentioning it.
- Request: regenerate with the tree's pinned protoc (command documented in helios/manifest.md:465-472) so only the descriptor bytes change, or state the intended version change.
=== NITS ===
N1. packing.rs:494-502 turns the one-line staging.put into a six-line call whose only real change is 1176 → patch_width; keep the original line and change the constant (AGENTS.md:188-193 on churn).
N2. packing.rs:574-585 asserts the table (4→161176, 9→630768, 16 errors) — it will keep passing through the B1 mistake. Test the behavior instead: bracketed() at patches_per_feature = 9 (tokensppf == patches identity, truncated-pixel error, odd-grid rejection), or assert the metadata path once B1 lands. Note bracketed() itself is untested at 9.
N3. packing.rs:486 h % merge_side / w % merge_side is redundant with the geometry the only producer emits (gemma4.rs:46-48, :63-64 floor to multiples of patch_sizepooling); if the profile keeps that guarantee, bracketed_patch_geometry collapses to a width and this check can go.
N4. Soft-token allowlist is written twice with no citation: gemma4.rs:11 SUPPORTED_SOFT_TOKENS = [70,140,280,560,1120] and ignition/preparation/frontend.py:123 not in (70, 140, 280, 560, 1120). The Python producer rejects everything else first, so the Rust copy is unreachable; keep one authority and name the upstream field (image_processor.max_soft_tokens) at both sites.
N5. Missing protobuf round-trip test for the new tag: helios/src/runtime_core/protobuf.rs:167-171 mirrors the PatchMerge arm correctly, but GLM and padded-grid each have serialized_*_selects_only_image_preparation tests (protobuf.rs:726, :749). Add serialized_gemma4_profile_selects_only_image_preparation — it is the only automated evidence for the additive wire claim.
N6. Small prose: conditioned.rs:192's bare 768 wants a comment ("3×3 pooling over 16×16×3 = 768 floats per feature"); patch_merge.rs:10's doc "shared by enveloped image layouts" is self-referential (say which layouts and what the three fields mean); the new frontend.py:113-137 branch has no comment saying the fixed dimensions/tokens are the checkpoint's canonical processor values validated by _expected below (siblings document themselves, e.g. :99); packing.rs:491's "bracketed patch-merge" mixes the enum name with the README's "patch-merge" label — pick one.
N7. Duplicated base commit in the description ("Branch logistics" and "Verified on base 6d6fe0c6").
=== CHECKED AND CLEAN (do not report as findings) ===
- Proto additions are additive and preserve wire ids: ImagePreparationKind::Gemma4 = 11 (contract.rs:68, runtime_core.proto:383-387), ImageSettings.gemma4 = 11 (runtime_core.proto:522), new Gemma4ImageSettings message (:535-542); decode/describe arms mirror PatchMerge (protobuf.rs:167-171, describe.rs:442-444); JSON uses deny_unknown_fields snake_case like neighbours (mod.rs:332-341).
- Envelope extraction from patch_merge::Processor is real de-duplication; Envelope::load keeps the token-uniqueness checks (patch_merge.rs:19-30) and expand keeps the one-token/marker-count checks (:38-57).
- gemma4 geometry arithmetic is self-consistent and overflow-guarded (checked_add/checked_mul/try_fold, gemma4.rs:103-129), resize reuses the shared resize::resize, and limits.check_batch/check_image_patches are applied on the new path.
- All non-Gemma widths and layouts are unchanged; no existing graph shape is resized.
- Wire compatibility direction: a core prepared on this branch is not readable by an older binary (expected), older cores still load.
#3 [high] SUMMARY REPORT (GitHub post) — PR #483
SUMMARY REPORT (for the GitHub post; 10 bullets max, kept short).
This PR is on the right track — the proto/contract additions are additive, the patch_merge::Envelope extraction is genuine de-duplication, and the Gemma 4 resize/pack arithmetic is self-consistent and overflow-guarded. Three blockers keep it from being mergeable, and the case file has the detail.
Blockers
Bracketedpatch width is keyed onpatches_per_feature(packing.rs:16-22:4 => 1176,9 => 768). Patch width is3·patch_size²; DeepSeek already runs 9 patches per feature at 588 floats, so9 => 768is model identity inside shared packing — the patterndocs/design-review.md:38-52forbids. → Put the patch width in prepared metadata (e.g.VisionCapabilities.patch_size) and derivemerge_side = ppf.isqrt(),width = 3·patch_size².- The HF-parity evidence cannot fail. Both snapshot tests return silently without
FLARE_GEMMA4_TEST_SNAPSHOT/../.venv/bin/python(gemma4.rs:236-256, 281-283, 336-339), so "45 passed" is the same whether parity ran. → Check in atests/frontend/gemma4_images.jsonfixture + generator likeglm.rs:147-199, or#[ignore]both and report them as unrun. - Atomic spans are added in shared code with no test and no stated blast radius.
prompt.rs:137-151fires for any layout declaring anImageSpan, feedingvalidate_prompt_dataandset_prefill_spans; no fixture exercises it (gemma4_frontend.json:38has"image_tokens": null). → Emit the span inlayouts/bracketed.rsbeside the envelope (deepseek.rs:149pattern), delete the shared block, add a span-bearing Bracketed fixture/test.
Should Fix
Processor::loadaccepts settings the packer cannot represent (gemma4.rs:23-31allows anypatch_size ≤ 64,pooling ≤ 16): requirepooling² == limits.patches_per_featureand reject the rest at load, not per request.- Patch width authored three times (
packing.rs:19,conditioned.rs:192,gemma4.rs:116);conditioned.rs:191already shows the right pattern. → One shared constant/helper. - A 1,120-soft-token image (1,122-token envelope) cannot be prefilled atomically at small chunk sizes;
model.rs:421-423andscheduler.rs:1922-1930turn it into a failed request. → Reject or clamp at load, with a boundary test. - Ignition pins one vision tower (
frontend.py:126-129: 27 layers/1152 hidden/16 heads/…), so an identical-preprocessor checkpoint is rejected, and the charter asks for more than one checkpoint (#74). → Assert only consumed fields; take the tokens from the tokenizer; show a second checkpoint. - Docs left stale —
helios/README.md:702-704,docs/runtime-core-design.md:226-233,helios/model-contract.md:251-254all enumerate profiles and omit Gemma 4; the recipe dependency belongs indocs/TODO.txt.
Nits
runtime_core_pb2.py:5regenerated with 7.36.1 whilepyproject.toml:34pins>=7.36.2— regenerate with the tree's protoc.- The new
packing.rs:574-585test asserts the lookup table, not the behavior;bracketed()at 9 is untested, and aserialized_gemma4_profile_selects_only_image_preparationround-trip test (likeprotobuf.rs:726, :749) is missing.
#4 [high] Caveats and verified details for B1/B2/B3
Caveats to state honestly when presenting B1/B3 (verified this pass):
- B1: only PatchMerge/Minimax uses ImageLayoutKind::Bracketed in-tree today, always with patches_per_feature = 4 (helios/tests/message_boundaries.rs:479-495 sets patches_per_feature: 4 with patch_merge settings; layouts/bracketed.rs:104-180). So
9 => 768has exactly one consumer (Gemma 4) and the table is a de-facto single-model branch — which is the objection, not a live bug for other models. Step's patches_per_feature = 16 (helios/tests/tools/test_step_images.rs:82) is ImageLayoutKind::Step, untouched. - B2: glm.rs:147-199 is the reference pattern (include_str! fixture + SHA-256 of resized/pixels/positions; generator tests/frontend/generate_glm_image_fixtures.py). Confirmed the PR adds no tests/frontend/gemma4* fixture.
- B3: because model.rs:441-451 rejects any scoped image token that no span covers, a span-declaring layout that returned no spans previously failed prompt validation — so the new prompt.rs:137-151 block is likely a strict improvement for any such core, and possibly a no-op for every in-tree core except Gemma 4. Report it as "untested behaviour change in shared scheduling code with undisclosed blast radius", not as a proven regression. The requested fix (span in layouts/bracketed.rs + span-bearing fixture/test) is small.
- Envelope length: Envelope::expand pushes start_id + tokens image tokens + end_id (patch_merge.rs:58-69), and prompt.rs uses start..start+additional+1 with additional = tokens+1 (bracketed.rs:77-81), so the span is tokens+2 = 1,122 at max_soft_tokens 1,120. Two of the earlier lenses said 1,121; 1,122 is correct.
- prefill_chunk_size must be ≥64 and 64-aligned (scheduler.rs:67-73); a 1024 chunk cannot hold a 1,122-token envelope.
Execution.persistent_workerscomes from commit 66bf6d03 "Add Execution.persistent_workers green-context lifecycle (#430)", not this PR — confirms the description's stale evidence bullet.- AGENTS.md:57-59 confirms unrun checks/pending measurements go in docs/TODO.txt (existing entries at docs/TODO.txt:1-30 are in that style).
#5 [high] Amendments — severity framings for S3, B2, B1
Amendments after verification (use these framings in the report):
-
S3 (envelope vs prefill chunk) is a latent, not live, defect at repository defaults: ignition/preparation/bootstrap.py:36 defaults prefill_chunk_size = 4096, and scheduler limits require ≥64 and 64-alignment (helios/src/scheduler.rs:67-73). So 1,122 ≤ 4096 passes today; the failure needs a deliberately small prefill chunk (e.g. 1024) on a Gemma 4 core. Frame it as "the invariant is unenforced and undocumented, so it breaks silently for a small-chunk deployment", with the fix being a load-time rejection or clamp plus a boundary test — not as a blocker.
-
B2 severity framing: the parity tests are honest in intent (they compare against HF when the environment is present) and the skipped-return pattern is precedent in this repo (helios/src/frontend/images/layouts/bracketed.rs:104-111 uses the same FLARE_MINIMAX_M3_SNAPSHOT skip-return). What makes it blocking here is that (a) "45 passed" is presented as evidence for a headline parity claim that plain
cargo testnever executes, and (b) every other profile's parity evidence is a checked-in fixture (glm.rs:147-199 + tests/frontend/generate_glm_image_fixtures.py; qwen38_images.json). So the ask is "make the parity evidence reproducible/CI-visible or mark it unrun", not "the tests are dishonest". -
B1 note: today
ImageLayoutKind::Bracketedhas exactly one in-tree producer (patch_merge / MiniMax M3, patches_per_feature = 4). The9 => 768arm therefore has a single real consumer, Gemma 4 — i.e. it is a model branch wearing a geometry name, and it contradicts the description's orthogonality claim. It is not currently a correctness bug for other models.
#6 [high] Research summary
Reviewed PR #483 (Gemma 4 image prep profile, bracketed 3×3 packing, atomic spans) against its diff, the four prior lenses, and the charter/design-review/AGENTS rules, and prepared both deliverables.
Full report (scratchpad entry 2) is organised into Blockers / Should Fix / Nits, each with finding, file:line evidence, and the requested change. Three blockers: (B1) packing.rs:16-22 keys the Bracketed patch width off patches_per_feature (9 => 768), which is model identity inside shared packing and contradicts the PR's own orthogonality claim — DeepSeek already runs 9 patches per feature at 588 floats; (B2) the headline HF-parity evidence cannot fail, because both snapshot tests return silently without FLARE_GEMMA4_TEST_SNAPSHOT / ../.venv/bin/python, so "45 passed" is identical whether parity ran, and unlike every other profile there is no checked-in fixture; (B3) prompt.rs:137-151 populates atomic spans in shared code for any span-declaring layout, with no test (the only Gemma 4 contract fixture has image_tokens: null) and no disclosure of the scheduling blast radius — the span should be emitted by layouts/bracketed.rs as deepseek.rs:149 does. Six Should Fix cover the missing profile/contract cross-checks, the thrice-authored 768 width, the unenforced max_soft_tokens + 2 ≤ prefill_chunk_size invariant, ignition pinning a single vision tower (charter #74 wants more than one checkpoint), stale docs (helios/README.md:702-704, docs/runtime-core-design.md:226-233, helios/model-contract.md:251-254, docs/TODO.txt), description corrections, and the protobuf gencode regenerated with 7.36.1 under a >=7.36.2 pin. Seven nits cover churn, the table-only test, a missing protobuf round-trip test, the duplicated soft-token allowlist, and prose.
Summary for the GitHub post (scratchpad entry 3) is 10 bullets: 3 blockers, 5 should-fix, 2 nits, each one line of finding plus a tldr request.
Verified caveats are in entry 5: S3 is latent rather than live at the repo's 4096 default chunk, B2's skip-return pattern has in-repo precedent (the MiniMax test does the same) so the ask is reproducibility rather than honesty, and Bracketed currently has only one in-tree producer so B1 is a design violation rather than a present correctness bug. Envelope length is tokens+2 = 1,122 at the 1,120 setting.
#7 [high] Report assembly notes: ordering, exact edit sites, request one-liners
Assembly notes for the final report (entries 1-5 hold the content; this entry holds order + exact imperative requests).
Order the full report: Blockers B1, B2, B3 → Should Fix S1-S7 → Nits N1-N7 → short "verified clean" paragraph (from entry 2's last section) so the author knows what not to re-litigate. Every bullet keeps three parts: Finding (file:line), Request (imperative), Why (rule or failing workflow). Nits may omit Why.
Imperative one-liners to paste as the "Request" for each item:
B1 — "Move the Bracketed patch width into prepared metadata: add patch_size to VisionCapabilities (helios/src/model.rs:44-51), validate it beside patches_per_feature in VisionCapabilities::validate (helios/src/model.rs:68-87), then in packing.rs compute merge_side = patches_per_feature.isqrt() and patch_width = 3 * patch_size * patch_size; delete bracketed_patch_geometry (packing.rs:16-22) and thread the width from config, as class_token() already reads padded_grid::FEATURES (packing.rs:515)."
B2 — "Replace the subprocess parity comparison with a checked-in fixture: add tests/frontend/gemma4_images.json + tests/frontend/generate_gemma4_image_fixtures.py (width, height, grid, tokens, SHA-256 of resized bytes / pixel_values LE / position_ids LE) and assert them in gemma4.rs the way glm.rs:147-199 does. Keep a snapshot test only if it is #[ignore = "..."], and report the ignore in the description."
B3 — "Emit the span where the envelope is built: layouts/bracketed.rs:82-91 should push data.spans for the range it expanded (mirror layouts/deepseek.rs:149), delete helios/src/model/prompt.rs:137-151, add a Bracketed contract fixture with image_tokens.span set and a test that the span is produced, passes validate_prompt_data, and is rejected when longer than prefill_chunk_size."
S1 — "In gemma4::Processor::load (gemma4.rs:23-31) reject unless pooling_kernel_size * pooling_kernel_size == limits.patches_per_feature, 3 * patch_size * patch_size equals the packing patch width, and max_soft_tokens * pooling² <= limits.max_patches_per_image."
S2 — "Replace the three literals with one shared constant/helper derived from profile+contract metadata, used by conditioned.rs:192, bracketed() (packing.rs:479-481) and gemma4::process (gemma4.rs:116)."
S3 — "Reject (or clamp with a named error) at load when max_soft_tokens + 2 > prefill_chunk_size, and add a boundary test at exactly the chunk size."
S4 — "In ignition/preparation/frontend.py:113-137, assert only what the preprocessor consumes (image processor fields, model_type: gemma4_vision, patch_size, pooling_kernel_size, max_soft_tokens) and the three token strings taken from the tokenizer config with an assertion that each encodes to one added token; drop the 27/1152/16/72/4304 pin or move it to the recipe."
S5 — "Add Gemma 4 to helios/README.md:702-704, docs/runtime-core-design.md:226-233, helios/model-contract.md:251-254 (16×16 patches, 3×3 pooling, soft-token set) and record the recipe dependency in docs/TODO.txt (style: docs/TODO.txt:1-30)."
S6 — "Fix four description items: delete the orthogonality sentence or reword it to describe what packing.rs actually does; drop Execution.persistent_workers (it is #430 / commit 66bf6d03, not this diff); replace 'existing cores unaffected' with the concrete load-path narrowing (patches_per_feature must now be 4 or 9 at model/packing.rs:92-97) and say which cores were swept; state that no serving-path timing was measured and that the parity comparison does not run under plain cargo test."
S7 — "Regenerate ignition/preparation/runtime_core_pb2.py with the tree's protoc (protoc --proto_path=helios/proto --python_out=ignition/preparation helios/proto/runtime_core.proto, helios/manifest.md:465-472) so the header returns to 7.36.2 and only descriptor bytes change."
Tone: the review is a request for changes, not a rejection; lead the summary with what is already good (additive proto, Envelope extraction, overflow-guarded geometry) before the blockers.
#9 [high] FULL REPORT — PR #483 round 3 (head 2b4a31e)
Review — PR #483, "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans"
Head 2b4a31e, base main 27716185. 36 files, +2269/−240. Third round.
Verdict: no blockers. Every blocker and should-fix from the previous round is fixed in code at this head (verified, list below). What remains is one scope/compatibility question that needs an answer before merge, four quality items, and nits.
Verified resolved — do not re-litigate
- B1 model-identity table gone:
packing.rs:16-32(bracketed_patch_featuresfrom prepared metadata,0→ legacy 1176;square_merge_sidewithisqrt+ square check). - B2 parity evidence runs unconditionally:
tests/frontend/gemma4_images.json(8 cases,max_soft_tokens280/1120) read bygemma4.rs:266-333; live tests are#[ignore]with hard assertions, not silent returns (gemma4.rs:374-385,:449-457). - B3 spans moved into the layout:
layouts/bracketed.rs:52-88, sharedprompt.rsfallback deleted, gated onatomic_spans. - S1 load contract:
gemma4.rs:25-39(pooling² ==limits.patches_per_feature, patch budget,checked_mul). - S2 one width authority:
mod.rs:459-471ImageProcessor::patch_features(), used byconditioned.rs:187; also fixesmain's_ => 588bug forPatchMerge(1176) andPaddedGrid(1200). - S3 envelope bounds at bootstrap:
server/config.rs:465-488vsprefill_chunk_sizeandspan.max_tokens. - S4 ignition tower pins gone; envelope tokens validated against
tokenizer.jsonandconfig.jsonids (frontend.py:114-173); three cached checkpoints intests/preparation/test_frontend_gemma4.py:187-216. - S5/S7 docs updated (
helios/README.md:709,713-719,runtime-core-design.md:181-197,model-contract.md:82,TODO.txt:331-337). runtime_core_pb2.pyheader concern withdrawn::5,12-16read7.36.1on both this head andmain(:5at ref=main), descriptor-only diff.
Blockers
None.
Should Fix
S1 — The Gemma 4 profile lands with no in-tree consumer and no export/serve proof (scope; charter #74)
Finding: the PR's own Limitations section defers end-to-end serving to a companion local-inference-lab/hyperflare-recipes PR, and docs/TODO.txt:331-337 records the qualification work as open. No core fixture under helios/tests/support/contracts/*.json uses the profile, and image_profile="gemma4" has only test callers (tests/preparation/test_frontend_gemma4.py:204). Charter: new model recipes must "prove they export and serve cleanly from the PR branch, and support more than a single checkpoint (#74)". Also nothing exercises the compatibility claim in the same section: tensor_layout runs during Inputs::new (model/packing.rs:65,92-97), so an existing Bracketed core now hits square_merge_side (packing.rs:26-32) at load, and a legacy core with patch_features == 0 must still pack at 1176 — search finds no Bracketed mount test anywhere under helios/tests/.
Request: state in the description whether a maintainer signed off on landing the profile ahead of its recipe (or split the branch: the shared half — patch_features, contract-driven Bracketed packing, Bracketed spans, envelope bounds — stands on its own), and add one load test proving (a) a legacy Bracketed core without patch_features still loads and stages 1176-wide pixels and (b) a non-square patches_per_feature fails at load with the new message.
Why: the charter makes export+serve the bar for a new profile, and separately requires "verify that existing data, artifacts, and exported cores still load". Today both are asserted in 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) and never mentions patch_features; a repo-wide search for the name in ignition/ returns only the generated runtime_core_pb2.py. A recipe that fills in 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. 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 frontend.py:169-170, so the width is derivable (3 · patch_size² = 768).
Request: derive patch_features in Ignition from the preparation settings it already validated (explicit only where the width is not 3 · patch_size², i.e. temporal-merge Bracketed), and add the key plus a "Bracketed vision cores must set this" note to contract.py:112.
Why: "solve the right problem in the right place" — the width is preparation metadata, and the first feedback a recipe author gets should not be a serve-time error whose only other hint is a docs/TODO.txt line.
S3 — Processor::load collapses seven rejections into 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 max_patches > limits.max_patches_per_image (:36). The last two compare settings against captured capacity, and the capacity comes from the export's vision.patch_capacities (server/config.rs:497-502), not from the checkpoint — so an operator cannot tell a bad core from a bad checkpoint. server/config.rs:449-463 already shows the actionable style.
Request: split by condition, naming the failing field and both values.
Why: "Bug fixes need to address the root cause; don't just swallow … an unexplained error". A load path that only says "invalid settings" pushes the diagnosis into the operator's head.
S4 — Dead wire knobs and duplicated constants
Finding: Gemma4ImageSettings.patch_size / pooling_kernel_size (runtime_core.proto:599-600, mod.rs:335-336, gemma4.rs:18-19) are configurable across 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. That makes the patch_size > 64 / pooling > 16 arms at gemma4.rs:32-33 unreachable. The width 768 is also spelled four ways: computed at gemma4.rs:55, via patch_features() at conditioned.rs:187, the legacy 1176 at packing.rs:16, and the literal 3 * 16 * 16 at gemma4.rs:364. Separately 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 glm.rs:13 does, reserve proto tags 1-2, drop the fields, serde keys, validation arms and the two Python literals; keep the Python soft-token gate (preparation is the right place) and let Rust accept any positive budget, or vice versa — not both.
Why: AGENTS.md:188-193 forbids configuration switches without a concrete requirement, and these tags become permanent once a core ships. Doing it now costs ~25 lines; doing it later costs a reserved-tag migration.
S5 — Superseded and dead test scaffolding, and 124 unread fixture lines
Finding: (a) gemma4.rs:449-533 (native_pixels_and_positions_match_the_checkpoint_processor, ~85 lines, #[ignore]d) uses exactly fixture seeds 1/5/6 — (91,37), (10,3000), (3000,10) — which gemma4.rs:266-333 already asserts by SHA-256 for grid, tokens, patches, resized RGB, pixels and positions, unconditionally. It carries a bespoke struct.pack('<qqqq') IPC with a hand-computed pixel_offset = 32.
(b) gemma4.rs:394-413 writes and hashes a Jinja chat template the test never renders (frontend.encode at :425 is not a template render), then removes it after several unwraps, so a failure leaks it.
(c) tests/frontend/gemma4_images.json:2-125 — 124 of 257 lines — is a processor snapshot and a trimmed model block that nothing reads: the sole consumer iterates fixture["cases"] (gemma4.rs:270-273) and the generator writes them at generate_gemma4_image_fixtures.py:81-86. The model block is precisely where image_token_id/boi_token_id/eoi_token_id live, i.e. the recorded ids that would make the envelope claim testable.
Request: delete (a) and the template plumbing in (b); for (c), either consume the model block in Rust — assert the configured ImageSettings envelope strings map to the recorded ids and that processor round-trips into Gemma4ImageSettings — or trim both blocks to a small provenance object.
Why: AGENTS.md:194-199 ("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.
Nits
- Duplicate width checks.
server/config.rs:449-455and:456-464fire on the same condition for aBracketedcore, sincebracketed_patch_featuresreturnsvision.patch_featuresverbatim when nonzero (packing.rs:18-24); the second has the better message. Keep theBracketedcheck (it also covers0→ 1176) and fold the!= 0case into it — one error per defect. - Two documentation contradictions.
helios/README.md:721-728states, unqualified, thatprocessproducespixel_values[N,1536], 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 at:713-719(768, no temporal copy, 3×3). Scope it to Qwen/MiMo and point per-profile width atpatch_features().docs/runtime-core-design.md:233-240enumerates 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. - The new fixtures have no provenance record.
helios/README.md:772-789documents onlytests/frontend/qwen38_images.jsonand its generator;gemma4_images.jsonandgenerate_gemma4_image_fixtures.pyappear in no document (search: the only reference in the tree is theinclude_str!atgemma4.rs:270). The generator depends on a Transformers release that shipsGemma4ImageProcessor(:14) and on the snapshot'sprocessor_config.json/config.json(:28-29), 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. Related, in the description: the--ignoredrepro command uses a placeholder (FLARE_GEMMA4_TEST_SNAPSHOT=<gemma-4-31B-it@842da379>) where the code needs a directory holdingtokenizer.json(gemma4.rs:377-385) and.venv/bin/pythonwith transformers/torch (:452-457) —AGENTS.md:110-112requires the inputs be identified. - Redundant guards and over-long tests.
packing.rs:501's grid-divisibility guard is implied by:503(tokens * patches_per_feature == patches) and by every producer's rounding, somerge_sidegoes unused there.geometry_matches_the_hugging_face_processor(gemma4.rs:335-354) repeats seven of its nine rows from the fixture; only(100,3000)and(3000,100)are unique — keep those and thetokens * 9 == patchesinvariant.pixels_interleave_rgb_and_positions_are_xy(:356-372) restates what the 91×37 fixture case pins by hash. The cross-profile table (packing.rs:694-825, ~130 lines) repeatspatch_features: 0ten times; three rows (PatchMerge 1176, PaddedGrid 1200, Gemma4 768) cover every distinct outcome.gemma4.rs:132re-inlines3 * self.patch_size * self.patch_sizeinstead of callingself.patch_features(), so the value validated atserver/config.rs:448and the value sizing the buffer are two expressions. - Small shape and wording.
atomic_spans: bool(bracketed.rs:23, computed atprompt.rs:53-65) must stay — emitting unconditionally would makemodel.rs:457-458reject every existingBracketedcore that declares no span — but passingOption<&ImageSpan>(the prepared layout field, asclass_tokenreceives its token) keeps the derivation next to its use.bracketed.rs:60's message says "missing envelope markers" for a bounds test (start == 0 || end >= len); marker identity is enforced atmodel.rs:444-445, so reword to "bracketed image span run is outside the expanded prompt".Envelopeis now a general frontend construct homed inpatch_merge(patch_merge.rs:10-17); move it tofrontend/images/envelope.rs.server/config.rs:457reaches intopacking::bracketed_patch_features, while its neighbours useImageProcessor/VisionCapabilitiesaccessors — expose an accessor. The scheduler truncatesendtospan.startfor a straddling span (policy.rs:343-350), so any captured capacity below the envelope length contributes no work for span-bearing requests; the bootstrap bound makes this unreachable today, but no test advertises a sub-envelope capacity. The description's "libprotoc 36.1" does not match the artifact'sProtobuf Python Version: 7.36.1(runtime_core_pb2.py:5, identical onmain) — name the generator release or drop the version.
Verified clean
Additive wire format (ImagePreparationKind::Gemma4 = 11, ImageSettings.profile tag 11, VisionCapacity.patch_features tag 6 with #[serde(default)] at helios/build.rs:54-56; describe.rs:466-468 omits 0; round-trip test). Envelope extraction is real de-duplication with no MiniMax behaviour change. Gemma 4 arithmetic is overflow-guarded (gemma4.rs:125-138 checked_add/checked_mul/try_fold, check_batch before and after geometry, shared resize::resize). Contract validation accepts 0 and rejects non-multiples of 3 (model.rs:72-92). Bootstrap bounds have 64-aligned boundary tests (server/config.rs:985-1023). Ignition accepts any gemma4/gemma4_vision tower and rejects gemma4_unified (frontend.py:114-141).
Open questions
- Did a maintainer sign off on landing the profile ahead of its recipe?
- Does any published
Bracketedcore declare a non-square (or zero)patches_per_feature? The manifests live inlocal-inference-lab/hyperflare-recipes, outside this repository; this decides whether S1's load-time narrowing is a regression or a guard. - Should a prefix-cache endpoint restored mid-envelope fail the request or back off to the envelope boundary (
TODO.txt:336-337)? No test pins it.
#10 [high] SUMMARY REPORT (GitHub post) — PR #483 round 3
Gemma 4 image preparation and Bracketed packing — ready to merge after one answer
PR #483 at 2b4a31e. Every blocker and should-fix from the last review is fixed and verified in code: 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, 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. Nice work — the remaining items are about scope and cleanup, not correctness on the served path.
Should Fix
- The profile has no exporter or server yet. End-to-end serving waits on an unlanded
hyperflare-recipesPR (docs/TODO.txt:331-337) and no core fixture uses it, while the charter requires a new profile to prove it exports and serves (#74). → Say whether a maintainer approved landing it ahead of the recipe, or split the shared half out, and add one load test proving a legacyBracketedcore withoutpatch_featuresstill stages 1176-wide pixels. - Nothing on the Python side authors
patch_features.ignition/preparation/contract.py:112defaultsvisionto the four historical keys, so a recipe that fills them exportspatch_features = 0and its core is rejected atflare run(server/config.rs:456-463) — even though Ignition already validatedpatch_size=16/pooling=3(frontend.py:124-127). → Derive the width in Ignition from the settings it validated, and document the key oncontract.py:112. - One error message for seven rejections.
gemma4.rs:30-38returns"invalid Gemma 4 image settings"for the pooling/capacity mismatches too, and the capacity comes from the export, not the checkpoint. → Split by condition and name the field and both values, asserver/config.rs:449-463already does. - Dead wire knobs, duplicated constants.
patch_size/pooling_kernel_sizeare proto/serde/Python fields that no exporter can vary (frontend.py:124-127,169-170), making three validation arms unreachable; 768 is spelled four ways; the soft-token allowlist lives in two languages. →const PATCH/POOLING/FEATURESlikeglm.rs:13, reserve tags 1-2, keep one allowlist. Doing it now costs ~25 lines; later costs a reserved-tag migration. - Superseded tests and unread fixture data. The
#[ignore]dnative_pixels_and_positions_match_the_checkpoint_processor(gemma4.rs:449-533) covers the same three sizes the unconditional fixture covers by SHA-256;gemma4.rs:394-413hashes a chat template it never renders (and leaks it on early return);tests/frontend/gemma4_images.json:2-125is 124 lines nothing reads, including theimage_token_id/boi_token_id/eoi_token_idthat would make the envelope claim testable. → Delete the first two; consume themodelblock or trim it.
Nits
- Duplicate width check.
server/config.rs:449-455and:456-464fire together for aBracketedcore; the second has the better message. Fold them. - Two docs contradict the code.
helios/README.md:721-728still sayspixel_values[N,1536], temporal copies and 2×2 merge directly below the Gemma 4 paragraph (:713-719) that says 768, no temporal copy, 3×3;docs/runtime-core-design.md:233-240omits the new kind from the image-settings enumeration. - New fixtures undocumented, repro command a placeholder.
helios/README.md:772-789pins only the Qwen fixture set — add the Gemma 4 one, its Transformers/Torch/Torchvision versions and the snapshot; the description'sFLARE_GEMMA4_TEST_SNAPSHOT=<…@842da379>needs to be a directory path withtokenizer.jsonplus a.venv. - Four tests restate the fixture. Seven of nine geometry rows,
pixels_interleave_rgb_and_positions_are_xy, and ten of eleven cross-profile rows are already covered;gemma4.rs:132re-inlines3 * patch_size²instead ofself.patch_features(). - Small shape items. Keep
atomic_spans(emitting unconditionally would reject every existing span-lessBracketedcore atmodel.rs:457) but passOption<&ImageSpan>; rewordbracketed.rs:60("missing envelope markers" is a bounds test); moveEnvelopeout ofpatch_merge; expose an accessor instead of reaching intopackingfromserver::config.
#11 [high] Corrections to the full report — load path and existing coverage
Corrections and verification confirmations for entry #9 (full report).
-
patches_per_feature == 0is NOT a new load-time hole.PreparedContract::validatecallsself.vision.validate()(helios/src/model/contract.rs:376), which rejectspatches_per_feature == 0for any enabled vision core (helios/src/model.rs:78), andInputs::newrunsconfig.contract.validate(manifest)atmodel/packing.rs:66beforetensor_layoutat:92. So the new narrowing fromsquare_merge_side(packing.rs:26-32) is only the non-square nonzero value. Entry #9's open question should read "non-square (not zero)". -
The legacy
patch_features == 0path IS test-covered.packing.rs:660-670(bracketed_packs_3x3_metadata_widths_and_rejects_invalid_extents) assertstensor_layout(Bracketed, …, 16) == (Float32, 16 * 1176)forbracketed_config(4, 0), and:671-680asserts a non-squarepatches_per_feature = 3errors. That is the packing half of the compatibility claim. What is still missing is a core-load mount (no.jsonunderhelios/tests/support/contracts/usesImageLayoutKind::Bracketed;gemma4_frontend.json:16-17,38hasimage_preparation: null,image_layout: null,image_tokens: null). So S1's request should be scoped: add a mount/load test, not "prove the staging arithmetic", which is already proven. -
VisionCapabilities::validatealso rejects!patch_features.is_multiple_of(3)(model.rs:79); 768 and 1176 both pass, so no legacy core is affected by that clause. -
conditioned.rs:367derivespatches_per_featureaspooling_kernel_size * pooling_kernel_sizefrom the settings — a second place the Gemma 4 pooling value is computed outsidegemma4.rs, worth folding into S4's "one source of truth" request. -
Test-count sanity: the PR's "47 passed" for
frontend::imagesand "3 passed" forserver::configare plausible against what I read (gemma4.rshas 5 tests,packing.rsthe profile table + bracketed behaviour test,config.rs:937one new test) but were not executed here; nothing in the report depends on the counts.
#12 [high] FULL REPORT v2 — PR #483 round 3 (supersedes #9)
Review — PR #483, "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans"
Head 2b4a31e, base main 27716185. 36 files, +2269/−240. Third round. Supersedes entry #9 (this version applies the corrections in entry #11).
Verdict: no blockers. Every blocker and should-fix from the previous round is fixed and verified in code at this head. What remains is one scope/compatibility question that needs an answer before merge, four quality items and a set of nits.
Verified resolved — do not re-litigate
- The
patches_per_feature → widthmodel-identity table is gone:packing.rs:16-32now hasbracketed_patch_featuresreading prepared metadata (0→ legacy 1176) andsquare_merge_sideusingisqrtwith a square check. - The parity evidence runs unconditionally:
tests/frontend/gemma4_images.json(8 cases,max_soft_tokens280/1120) is read bygemma4.rs:266-333under plaincargo test; the live-checkpoint tests are#[ignore]with hard assertions instead of silent returns (gemma4.rs:374-385,:449-457). - Atomic spans moved into the layout that builds the envelope (
layouts/bracketed.rs:52-88), the sharedprompt.rsfallback is deleted, and markers are validated at both ends. gemma4::Processor::loadenforces the packing contract (gemma4.rs:25-39):pooling_area == Some(limits.patches_per_feature), patch budget, andchecked_mulso overflow fails closed.- Patch width has one authority across 11 profiles (
mod.rs:459-471, used atconditioned.rs:187), which also fixesmain's_ => 588bug forPatchMerge(1176) andPaddedGrid(1200). - The maximum envelope is bounded at bootstrap against
prefill_chunk_sizeandspan.max_tokens(server/config.rs:465-488), with 64-aligned boundary tests (:985-1023). - Ignition no longer pins one vision tower; envelope tokens come from
tokenizer_config.json, are validated to encode as single tokens againsttokenizer.json, and cross-checked againstconfig.json(frontend.py:114-173), with three cached checkpoints intests/preparation/test_frontend_gemma4.py:187-216. - Docs updated (
helios/README.md:709,713-719,docs/runtime-core-design.md:181-197,helios/model-contract.md:82,docs/TODO.txt:331-337). - The earlier
runtime_core_pb2.pyversion concern is withdrawn::5and:12-16read7.36.1on this head and byte-identically onmain(read atref=main); the diff is descriptor-only plus the new fields.
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 PR's Limitations section defers end-to-end serving to an unlanded local-inference-lab/hyperflare-recipes PR, and docs/TODO.txt:331-337 records the qualification work 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 a repo-wide search for Bracketed under helios/tests/ returns nothing. The charter requires a new model profile 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 staging arithmetic for a legacy core is tested (packing.rs:660-670 asserts 16 × 1176 for patch_features == 0, :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:65,92-97), 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, contract-driven Bracketed packing, Bracketed spans, envelope bounds) onto its own, since it stands alone. Either way add one core-load test with a Bracketed contract JSON that omits patch_features, asserting it 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) 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". 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 :169-170, so the width is derivable as 3 · patch_size² = 768.
Request: derive patch_features in Ignition from the settings it already validated, and add the key (plus a note that Bracketed vision cores must set it) to contract.py:112.
Why: "solve the right problem in the right place". 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.
Request: split the condition, naming the failing field and both values.
Why: "Bug fixes need to address the root cause; don't just swallow … an unexplained error". A load path that only says "invalid settings" moves the diagnosis onto the operator.
S4 — Dead wire knobs and constants spelled several ways
Finding: Gemma4ImageSettings.patch_size / pooling_kernel_size (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, the legacy 1176 at packing.rs:16, and the literal 3 * 16 * 16 at gemma4.rs:364; 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 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 glm.rs:13 does, reserve proto tags 1-2, drop the struct fields, serde keys, validation arms and the two Python literals; 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 forbids configuration switches without a concrete requirement, and these tags become permanent once a core ships. Removing them now costs ~25 lines; later it costs a reserved-tag migration.
S5 — Superseded test scaffolding and 124 unread fixture lines
Finding: (a) gemma4.rs:449-533 (native_pixels_and_positions_match_the_checkpoint_processor, ~85 lines, #[ignore]d) uses exactly fixture seeds 1/5/6 — (91,37), (10,3000), (3000,10) — which gemma4.rs:266-333 already pins by SHA-256 for grid, tokens, patches, resized RGB, pixels and positions, unconditionally; it also carries a bespoke struct.pack('<qqqq') IPC with a hand-computed pixel_offset = 32. (b) gemma4.rs:394-413 writes and hashes a Jinja chat template the test never renders (frontend.encode at :425 is not a render), then removes it after several unwraps, so a panic leaks it. (c) tests/frontend/gemma4_images.json:2-125 — 124 of 257 lines — is a processor snapshot and a trimmed model block that nothing reads: the sole consumer iterates fixture["cases"] (gemma4.rs:270-273) and the generator writes them at generate_gemma4_image_fixtures.py:81-86. The model block is exactly where image_token_id/boi_token_id/eoi_token_id live — the recorded ids that would make the envelope claim testable.
Request: delete (a) and the template plumbing in (b); for (c) 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 say in the description that the live-checkpoint runs are not part of CI.
Why: AGENTS.md:194-199 ("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.
Nits
- Duplicate width checks.
server/config.rs:449-455and:456-464fire on the same condition for aBracketedcore, becausebracketed_patch_featuresreturnsvision.patch_featuresverbatim when nonzero (packing.rs:18-24); the second carries the better message. Keep theBracketedcheck (it also covers0→ 1176) and fold the!= 0case into it — one error per defect. - Two documentation contradictions.
helios/README.md:721-728states, unqualified, thatprocessproducespixel_values[N,1536], 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, no temporal copy, 3×3). Scope it to Qwen/MiMo and point per-profile width atpatch_features().docs/runtime-core-design.md:233-240enumerates 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. - The new fixtures have no provenance record, and the repro command is a placeholder.
helios/README.md:772-789documents onlytests/frontend/qwen38_images.jsonand its generator;gemma4_images.jsonandgenerate_gemma4_image_fixtures.pyappear in no document (the only reference in the tree is theinclude_str!atgemma4.rs:270), yet the generator depends on a Transformers release shippingGemma4ImageProcessor(:14) and on the snapshot'sprocessor_config.json/config.json(:28-29), 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 holdingtokenizer.json(gemma4.rs:377-385) plus.venv/bin/pythonwith transformers/torch (:452-457) —AGENTS.md:110-112requires the inputs be identified. - Redundant guards and over-long tests.
packing.rs:501's grid-divisibility guard is implied by:503(tokens * patches_per_feature == patches) and by every producer's rounding, leavingmerge_sideunused there.geometry_matches_the_hugging_face_processor(gemma4.rs:335-354) repeats seven of nine rows from the fixture — only(100,3000)and(3000,100)are unique; keep those plus thetokens * 9 == patchesinvariant.pixels_interleave_rgb_and_positions_are_xy(:356-372) restates what the 91×37 fixture case pins by hash. The cross-profile table (packing.rs:694-825, ~130 lines) repeatspatch_features: 0ten times; three rows (PatchMerge 1176, PaddedGrid 1200, Gemma4 768) cover every distinct outcome. - Small shape and wording. Keep
atomic_spans: bool(bracketed.rs:23, computed atprompt.rs:53-65) — emitting unconditionally would makemodel.rs:457-458reject every existingBracketedcore that declares no span — but passingOption<&ImageSpan>(the prepared layout field, asclass_tokenreceives its token) puts the derivation next to its use.bracketed.rs:60's "missing envelope markers" is a bounds test (start == 0 || end >= len); marker identity is enforced atmodel.rs:444-445, so reword to "bracketed image span run is outside the expanded prompt".Envelopeis now a general frontend construct homed inpatch_merge(patch_merge.rs:10-17); move it tofrontend/images/envelope.rs.server/config.rs:457reaches intopacking::bracketed_patch_featureswhile its neighbours useImageProcessor/VisionCapabilitiesaccessors — expose an accessor. The scheduler truncatesendtospan.startfor a straddling span (policy.rs:343-350), 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. The description's "libprotoc 36.1" does not match the artifact'sProtobuf Python Version: 7.36.1(runtime_core_pb2.py:5, identical onmain) — name the generator release or drop the version.
Verified clean
Additive wire format: ImagePreparationKind::Gemma4 = 11 and ImageSettings.profile tag 11 (runtime_core.proto:585), VisionCapacity.patch_features tag 6 with #[serde(default)] (helios/build.rs:54-56), describe.rs:466-468 omits 0 so legacy describe JSON is byte-identical, and a round-trip test covers the new tag (protobuf.rs:813). Envelope extraction is real de-duplication with no MiniMax behaviour change. Gemma 4 arithmetic is overflow-guarded (gemma4.rs:125-138: checked_add/checked_mul/try_fold, check_batch before and after geometry, shared resize::resize rather than a new kernel). Contract validation accepts 0 and rejects non-multiples of 3 (model.rs:72-92). Ignition accepts any gemma4/gemma4_vision tower and rejects gemma4_unified (frontend.py:114-141).
Open questions
- Did a maintainer sign off on landing the profile ahead of its recipe?
- Does any published
Bracketedcore declare a non-squarepatches_per_feature? Zero is already rejected for any enabled vision core (model.rs:78, reached fromcontract.rs:376beforetensor_layout), so only a non-square nonzero value would newly fail to load. The manifests live inlocal-inference-lab/hyperflare-recipes, outside this repository. - Should a prefix-cache endpoint restored mid-envelope fail the request or back off to the envelope boundary (
TODO.txt:336-337)? No test pins the behaviour.
#13 [high] SUMMARY REPORT v2 (GitHub post) — PR #483 round 3 (supersedes #10)
Replace the first Should Fix bullet of entry #10 with this corrected wording (zero patches_per_feature is already rejected at model.rs:78 via contract.rs:376, so the new narrowing is only the non-square value; the legacy 1176 staging path is already tested at packing.rs:660-670).
Gemma 4 image preparation and Bracketed packing — ready to merge after one answer
PR #483 at 2b4a31e. Every blocker and should-fix from the last review is fixed and verified in code: 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, 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. Nice work — the remaining items are about scope and cleanup, not correctness on the served path.
Should Fix
- The profile has no exporter or server yet, and no test mounts a
Bracketedcore. End-to-end serving waits on an unlandedhyperflare-recipesPR (docs/TODO.txt:331-337) and no core fixture uses the profile, while the charter requires a new profile to prove it exports and serves (#74) and existing cores to still load. The 1176 staging arithmetic is already tested (packing.rs:660-670), buttensor_layoutnow runs at core load (model/packing.rs:65,92-97) and nothing mounts such a core. → Say whether a maintainer approved landing it ahead of the recipe or split the shared half out, and add one load test with aBracketedcontract JSON that omitspatch_features. - Nothing on the Python side authors
patch_features.ignition/preparation/contract.py:112defaultsvisionto the four historical keys, so a recipe that fills them exportspatch_features = 0and its core is rejected atflare run(server/config.rs:456-463) — even though Ignition already validatedpatch_size=16/pooling=3(frontend.py:124-127). → Derive the width in Ignition from the settings it validated, and document the key oncontract.py:112. - One error message for seven rejections.
gemma4.rs:30-38returns"invalid Gemma 4 image settings"for the pooling and patch-budget mismatches too, and the capacity comes from the export, not the checkpoint. → Split by condition and name the field and both values, asserver/config.rs:449-463already does. - Dead wire knobs, duplicated constants.
patch_size/pooling_kernel_sizeare proto/serde/Python fields no exporter can vary (frontend.py:124-127,169-170), making three validation arms unreachable; 768 is spelled four ways andgemma4.rs:132re-inlines3 * patch_size²instead ofself.patch_features(); the soft-token allowlist lives in two languages. →const PATCH/POOLING/FEATURESlikeglm.rs:13, reserve tags 1-2, keep one allowlist. Now costs ~25 lines; later costs a reserved-tag migration. - Superseded tests and unread fixture data. The
#[ignore]dnative_pixels_and_positions_match_the_checkpoint_processor(gemma4.rs:449-533) covers the same three sizes the unconditional fixture covers by SHA-256;gemma4.rs:394-413hashes a chat template it never renders (and leaks it on early return);tests/frontend/gemma4_images.json:2-125is 124 lines nothing reads, including theimage_token_id/boi_token_id/eoi_token_idthat would make the envelope claim testable. → Delete the first two; consume themodelblock or trim it.
Nits
- Duplicate width check.
server/config.rs:449-455and:456-464fire together for aBracketedcore; the second has the better message. Fold them. - Two docs contradict the code.
helios/README.md:721-728still sayspixel_values[N,1536], temporal copies and 2×2 merge directly below the Gemma 4 paragraph (:713-719) that says 768, no temporal copy, 3×3;docs/runtime-core-design.md:233-240omits the new kind from the image-settings enumeration. - New fixtures undocumented, repro command a placeholder.
helios/README.md:772-789pins only the Qwen fixture set — add the Gemma 4 one, its Transformers/Torch/Torchvision versions and the snapshot; the description'sFLARE_GEMMA4_TEST_SNAPSHOT=<…@842da379>needs to be a directory path withtokenizer.jsonplus a.venv. - Four tests restate the fixture. Seven of nine geometry rows,
pixels_interleave_rgb_and_positions_are_xy, and ten of eleven cross-profile rows are already covered by hash;packing.rs:501's divisibility guard is implied by:503. - Small shape items. Keep
atomic_spans(emitting unconditionally would reject every existing span-lessBracketedcore atmodel.rs:457) but passOption<&ImageSpan>; rewordbracketed.rs:60("missing envelope markers" is a bounds test); moveEnvelopeout ofpatch_merge; expose an accessor instead of reaching intopackingfromserver::config.
#14 [high] Research summary
Reviewed PR #483 at head 2b4a31e (rebased onto main 27716185) against the four prior lens reports, the charter, and the code itself. The full report is scratchpad entry #12 and the ready-to-post summary is entry #13 (both supersede #9/#10 after the corrections in #11).
Verdict: no blockers. Every blocker and should-fix from the previous round is genuinely fixed at this head — I verified each in code rather than taking the author's reply: the patches_per_feature → width model-identity table is replaced by prepared metadata (packing.rs:16-32), the Hugging Face parity fixture runs unconditionally (gemma4.rs:266-333 over tests/frontend/gemma4_images.json), atomic spans moved into layouts/bracketed.rs:52-88 with the shared prompt.rs fallback deleted, patch width has one authority across 11 profiles (mod.rs:459-471, which also fixes main's _ => 588 bug for PatchMerge/PaddedGrid), the maximum envelope is bounded against prefill_chunk_size and span.max_tokens at bootstrap (server/config.rs:465-488), and the Ignition tower pins are gone (frontend.py:114-173). I also confirmed the earlier runtime_core_pb2.py version concern was wrong and withdrew it — 7.36.1 is byte-identical on main.
Two corrections I made to the incoming lens findings, both material to severity:
patches_per_feature == 0is not a new load-time hole:PreparedContract::validaterunsvision.validate()(contract.rs:376(not opened)) which rejects zero for any enabled vision core (model.rs:78), beforetensor_layoutis reached. So theBracketednarrowing covers only a non-square nonzero value.- The legacy
patch_features == 0→ 1176 staging path is already tested (packing.rs:660-670). What is missing is only a core-load mount, so I scoped the S1 request to that instead of asking for arithmetic coverage that exists.
Five should-fix items remain, the first of which needs an answer rather than a code change: the Gemma 4 profile lands with no in-tree consumer and no export/serve proof (charter #74 requires one), so the author should either say a maintainer approved that ordering or split the shared half onto its own branch. The others: nothing on the Python side authors patch_features, so a recipe filling the historical four keys exports 0 → legacy 1176 → rejected at flare run (contract.py:112 vs server/config.rs:456-463); seven load rejections share one opaque message (gemma4.rs:30-38); patch_size/pooling_kernel_size are dead wire knobs that duplicate the 768 constant four ways and the soft-token allowlist twice; and one #[ignore]d test duplicates the unconditional fixture, one ignores a template it never renders, and 124 fixture lines (including the token ids) are read by nothing.
The summary is organized into Should Fix (5) and Nits (5) only, per the instruction to drop the Blockers section when nothing blocks, and each bullet carries a one-line finding plus an imperative request.
#15 [high] Post-writing context: thread state, withdrawn items, tone, verification limits
Context for whoever writes the final report from entries #12 (full) and #13 (summary). Nothing here contradicts them; it records the surrounding decisions.
Thread state
- PR #483,
core/gemma4-image-frontend→main, head2b4a31e, base27716185, 36 files, +2269/−240, open, no human review. - Three discussion entries: bot case-file notice (2026-11-24 14:33), the previous bot review "Changes Requested" (2026-11-24 15:23), and the author's reply (2026-11-25 08:11) claiming all blockers/should-fix/nits addressed after a rebase.
- This is the third round. Since the last review the author rebased onto
mainand pushed2b4a31e. The head diff also contains large unrelated base-branch churn (banner removal,flare doctor,parallax, download rewrites,RebuildManifest→PreparationManifest) that landed onmainin the interim — not this PR's files and not reported by any lens.pr_filesagainst the merge base lists only the 36 PR files. Do not attribute that churn to the author.
Withdrawn prior findings — must NOT be re-raised
runtime_core_pb2.pyat 7.36.1 under aprotobuf>=7.36.2pin. The previous review made this a should-fix. It is withdrawn:main's ownruntime_core_pb2.py:5,12-16already declares 7.36.1, this head matches byte-for-byte, and the pin bounds the runtime rather than the generator header. The only residue is a nit — the description says "libprotoc 36.1" while the artifact records 7.36.1.- "Make
atomic_spansunconditional / drop the bool." The architecture lens recommended dropping the parameter and emitting spans unconditionally, citinglayouts/deepseek.rs. That advice is wrong at this head:helios/src/model.rs:457-458rejects a non-emptydata.spanswhen the contract declares noImageSpan, so emitting unconditionally would fail prompt validation for every existingBracketedcore without a span (MiniMax). Entry #12 and #13 keep the bool and only suggest passingOption<&ImageSpan>instead. patches_per_feature == 0as a new load-time regression. Rejected:PreparedContract::validate→vision.validate()(model/contract.rs:376→model.rs:78) already rejects zero for any enabled vision core, and runs beforetensor_layout. Only a non-square nonzero value newly fails to load.- Legacy 1176 staging arithmetic as untested. It is tested (
packing.rs:660-670). Only a core-load mount is missing.
Format and tone decisions for the post
- The instruction was to include Blockers/Should Fix/Nits and to say so plainly when nothing blocks. Reported as: no Blockers section, verdict stated up front ("no blockers / ready to merge after one answer"), then Should Fix (5) and Nits (5).
- Summary budget: ≤10 bullets, ≤5 per section — used 5 + 5.
- Lead with what the author fixed and verified (one dense paragraph), because the previous post was "Changes Requested" and this one is not; then the remaining items. Do not repeat the resolved list item by item in the summary — the full report and case file hold it.
- The one item that is a question rather than an instruction (S1: was landing the profile ahead of its recipe approved?) should read as a question, with the split-the-branch option offered as the alternative, not as an ultimatum.
Author reply accuracy (checked)
Every specific code claim in the 2026-11-25 reply holds at this head: patch_features tag 6 additive with serde(default) (build.rs:54-56); Bracketed reads width from prepared metadata; gemma4::Processor::load checks pooling² and the patch budget; ImageProcessor::patch_features() covers all profiles; bootstrap bounds exist; spans moved to layouts/bracketed.rs; ignition tower pins dropped and three checkpoints covered; docs and TODO.txt updated; libprotoc claim matches main. No claim in the reply was false — the remaining items are things it did not address (Python-side patch_features, dead knobs, superseded tests) and one scope question it did not raise itself.
Verification limits to state honestly
- Read-only review: no
cargo test,cargo checkorpytestwas run. All behavioural claims come from reading code and callers. The PR's reported counts (47 infrontend::images, 54 inmodel::, 28 inruntime_core::protobuf, 3 inserver::config, 22/22 intests/preparation, 3/3 in the external recipes repo) are the author's own evidence and are plausible against the test bodies I read, but nothing in the report depends on them. - Out-of-repository unknowns, stated as open questions rather than findings: whether any published
Bracketedcore declares a non-squarepatches_per_feature(manifests live inlocal-inference-lab/hyperflare-recipes), and whether a prefix-cache endpoint restored mid-envelope should fail or back off to the envelope boundary (TODO.txt:336-337). - Serving-path timing and memory were not measured by the author either, and the description says so; no performance claim is being made, so the "#210 benchmarks" rule is not engaged.
#17 [high] FULL REPORT — PR #483 round 4 (head ab9a432) — Blockers / Should Fix / Nits
Review — PR #483 "Add Gemma 4 image preparation, Bracketed patch-width metadata, and atomic spans"
Head ab9a432b (branch rickybrent:core/gemma4-image-frontend), base main 27716185. Round 4 (supersedes entries #12/#13, which reviewed 2b4a31e).
Verified read-only against the head: I re-read every cited site. No cargo test / cargo check / pytest was run, and the head commit reports no CI checks, so every behavioural claim below comes from code and callers.
Verdict: no blockers. Every should-fix from the previous round is fixed and verified in code (list below). What remains is one scope/evidence question that needs an answer from a maintainer, three small code/test items, and ten nits.
Verified resolved this round — do not re-litigate
- Legacy
Bracketedcore-load test added and does exactly what was asked.helios/src/model/tests.rs:1279-1452: serializes aBracketedcontract, removespatch_featuresfrom the JSON (:1334-1338), asserts decode is0(:1338), loads throughInputs::new(:1415), stages16 * 1176floats (:1416-1443), and rejects a 768-wide manifest (:1446) and a non-squarepatches_per_feature(:1447-1451). - Per-condition load errors now name the field and both values:
helios/src/frontend/images/gemma4.rs:25-84(patch_size:27-33, pooling:34-40, soft tokens:41-47, pooling area vspatches_per_feature:52-60, patch budget:61-71), with the1..=64/1..=16caps commented as defensive wire caps at:26. - Patch width has one expression:
gemma4.rs:86-88patch_features(), used at:164for capacity and reserve; no table left inpacking.rs. - Ignition authors the key:
ignition/preparation/contract.py:109-119puts"patch_features": 0in the vision default with a docstring (:111-115) telling aBracketedrecipe with a non-1176 width to set it. - Fixture provenance is consumed, not dead data:
tests/preparation/test_frontend_gemma4.py:187-225reads theprocessorandmodelblocks oftests/frontend/gemma4_images.jsonand asserts the resolved settings (patch 16 / pooling 3 / 280), including the three recorded token ids (:191-196). - Superseded
#[ignore]d test deleted; nonative_pixels_and_positions_match_the_checkpoint_processorremains (gemma4.rs is 505 lines). The remaining ignored test's temp chat template isDrop-guarded (gemma4.rs:443-455, dropped at:469). - Duplicate bootstrap width check folded into one
Bracketedbranch:helios/src/server/config.rs:449-463(else if vision.patch_features != 0at:457). - Docs:
helios/README.md:721-724now scopes the[N,1536]/ temporal-copy / 2×2 text to Qwen and points per-profile width atImageProcessor::patch_features();:798-807documents the Gemma 4 fixture with pinned Transformers 5.23.0 / PyTorch 2.14.1+cu132 / Torchvision 0.29.1+cu132 and revision842da379…;:713-719the Gemma 4 paragraph;docs/runtime-core-design.md:181-194,234-242;helios/model-contract.md:82;docs/TODO.txt:330-337. runtime_core_pb2.pyremains descriptor-only and byte-consistent withmain's generator header — the old concern stays withdrawn.
Blockers
None.
Should Fix
S1 — The profile lands ahead of the exporter that can use it, and nothing mounts it end to end
Finding: end-to-end serving is deferred to an unlanded companion PR in local-inference-lab/hyperflare-recipes, and docs/TODO.txt:330-337 records the qualification (E2B/E4B/26B-A4B/31B export + serving, plus the partial-span prefix-cache audit) as open. No prepared contract exercises the profile: helios/tests/support/contracts/gemma4_frontend.json:16-17,38 declares image_preparation: null, image_layout: null, image_tokens: null, and no contract JSON under helios/tests/support/contracts/ uses layout 9 (Bracketed) or preparation 11 — the layouts present are 1, 2, 3, 5, 6, 10. Gemma 4 is covered only by Rust-constructed configs (model/prompt.rs:1172-1281, server/config.rs:935-1023, frontend/images/gemma4.rs) and by Ignition-side tests, none of which goes through Bootstrap::load (server/config.rs:288-298) → served image request. The charter ("New model recipes, aliases, or formats: … prove they export and serve cleanly from the PR branch, and support more than a single checkpoint", #74) and "verify that existing data, artifacts, and exported cores still load" both apply. The compatibility half is now genuinely tested; the export/serve half is prose.
Request: state in the description whether a maintainer approved landing the profile ahead of its recipe (the author's stack-order argument — recipes were extracted, so the core profile must land first — is plausible and needs only one line of confirmation), 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 contract fixture shaped like qwen38.json with image_layout: 9, image_preparation: 11, a declared image_tokens.span, vision { patches_per_feature: 9, patch_features: 768 }, loaded through the helper the other fixtures use; otherwise say plainly that Gemma 4 serving is unqualified.
Why: the charter makes export-and-serve the bar for a new format. The author's own limitations paragraph covers unmeasured timing/memory but not that the profile has never been served. Also note the head has no CI checks, so even the author's unit evidence has not run in CI.
S2 — The Gemma 4 processor file is not where the default path looks
Finding: ignition/preparation/frontend.py:310 resolves the processor as snapshot / "preprocessor_config.json" when preprocessor is None. Gemma 4 snapshots ship processor_config.json — the fixture generator reads snapshot / "processor_config.json" (tests/frontend/generate_gemma4_image_fixtures.py:28) and every test passes the path explicitly (tests/preparation/test_frontend_gemma4.py:76,88,239,246). So the documented call shape prepare_frontend(snapshot, eos_token_ids=[…], image_profile="gemma4") raises FileNotFoundError, and no test covers the default argument, so CI cannot catch it. Pre-existing for padded_grid too (see the comment at frontend.py:100), so this is consistency plus a missing test rather than a new defect.
Request: 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 those profiles and document it; add one test that calls prepare_frontend without preprocessor against a snapshot holding processor_config.json.
Why: the first recipe author to follow the documented shape gets a FileNotFoundError instead of a prepared contract, and the failure is invisible to CI.
S3 — Only two of the five allowlisted soft-token budgets are ever loaded
Finding: helios/src/frontend/images/gemma4.rs:13 accepts [70, 140, 280, 560, 1120] and frontend.py:132 accepts the same five, but the fixture generator's specs are only 280 and 1120 (tests/frontend/generate_gemma4_image_fixtures.py:31-40), so processor_with_budget is only ever constructed with 280 (gemma4.rs:246-248) and 1120. max_soft_tokens drives max_patches() (:98-100), the target pixel budget (:106), the aspect-clamp branches (:118-123) and max_envelope_tokens() (:90-92), which feeds the new load-time bound against prefill_chunk_size and span.max_tokens (server/config.rs:464-487). Budget 70 in particular is what the checkpoint's own video_processor declares (fixture tests/frontend/gemma4_images.json, video_processor.max_soft_tokens), so the small-budget clamp branches are the untested edge.
Request: add (91, 37, 70), (10, 3000, 140) and one 560 case to the generator specs and regenerate, or add a table test that constructs a processor for each SUPPORTED_SOFT_TOKENS entry and asserts geometry for one fixed shape.
Why: a budget-specific geometry or parity defect would first appear at flare run on a real checkpoint rather than in cargo test.
S4 — The new legacy-core test hand-builds a manifest the shared builder could emit
Finding: helios/src/model/tests.rs:1343-1411 is a 68-line local build_manifest closure that repeats the descriptor/stride/address walk of helios/src/model/testing.rs:307-337 and the binding assembly of :368-377, plus nine hand-written ValueBindings at tests.rs:1304-1332. It exists because testing::manifest sends GraphOperation::Vision to _ => unreachable!() (testing.rs:354) and fixes every ImageTensor width to 1 (testing.rs:257), so a vision graph cannot be described. Line tests.rs:1450 (base_manifest = build_manifest(1176);) then rebuilds a manifest it already holds.
Request: add GraphOperation::Vision => GraphKind::Vision at testing.rs:344-355 and let the width for vision_pixel_values come from vision.bracketed_patch_features(); the test then overrides one buffer extent to (16, pixel_width) and the local closure, the hand-written bindings and the :1450 rebuild all disappear.
Why: ~110 lines of duplicated manifest arithmetic is a second source of truth for graph layout; when ExecutionManifest changes this test breaks for reasons unrelated to the behaviour it checks (a legacy core without patch_features loads and stages 1176-wide pixels).
Nits
- Per-profile patch width is still authored twice, over two different enums.
frontend/images/packing.rs:32-49mapsImageLayoutKind→ float width (Qwen|Mimo → 1536,Deepseek*|Moonvit|Step → 588,Bracketed → vision.bracketed_patch_features(),Radio → 768,Glm → 1176,ClassToken → 1200), whilefrontend/images/mod.rs:459-471mapsProfile→ the same numbers. They are linked only by the test atpacking.rs:685-814. Fix: pass the processor width (orpatches_per_frame+width) intotensor_layoutfromInputs::new(model/packing.rs:92-97), soProfilestays the single authoring point. - Duplicated and repeated test rows.
gemma4.rs:386-396repeats seven of the nine rows the fixture already pins by SHA-256 viacanonical_processor_pixels_positions_and_resize(:314-381); only(100,3000)and(3000,100)are unique — keep those plus thetokens * 9 == patchesinvariant (:400).gemma4.rs:404-420restates the 91×37 fixture case by hand; keep only the(x, y)ordering assertion (:413-418), which the hash cannot express.packing.rs:685-814(~130 lines) repeatspatch_features: 0ten times where four rows (Gemma 4 9/768, PatchMerge 4→1176, PaddedGrid 1200, one of 588/1536) cover every distinct outcome. - Two documentation/wording items.
helios/README.md:806regenerates the Gemma 4 fixture with"$SNAPSHOT", but the only prior definition of that name is the Qwen3.8 command at:787-789pointing at a different checkpoint — useGEMMA4_SNAPSHOTor name the directory. The description's "decodes, resizes, normalizes, packs, and validates" overstates: the profile rescales by1/255only (gemma4.rsprocess loop;frontend.py:124-127requiresdo_normalize: False,image_mean0,image_std1), ashelios/README.md:716correctly says — change to "rescales by 1/255". - Duplicated or doubled constants. The soft-token allowlist exists twice in two languages (
gemma4.rs:13andfrontend.py:132) with nothing tying them; the Rust comment says the duplication is deliberate, so add a cross-reference in both directions and a table test over the Rust list, or carry the set in the prepared settings.max_patchesis computed twice — checked atgemma4.rs:61-64and unchecked at:98-100— so haveloadcallmax_patches()on the constructed value. - Shape items.
Envelopeis now a shared frontend construct but is homed infrontend/images/patch_merge.rs:13with the doc "shared byPatchMergeandGemma4" — move it tofrontend/images/envelope.rs.atomic_spans: bool(layouts/bracketed.rs:23, derived atmodel/prompt.rs:58-64) is correct and must stay gated (emitting unconditionally would makemodel.rs:451-469reject every span-lessBracketedcore), but passOption<&ImageSpan>so the derivation sits with its use. Also:helios/src/model.rs:89applies!patch_features.is_multiple_of(3)to every enabled vision core while onlyBracketedconsumes the field, and reports it through the generic"invalid prepared vision capabilities"(:99) — scope the rule toBracketedor name the field; andscheduler/policy.rs:343-350truncatesendback tospan.startfor a straddling span, which the new bootstrap bound makes unreachable but no test documents — one sub-envelope capacity case would.
Accepted as-is (do not re-raise): Gemma4ImageSettings::patch_size / pooling_kernel_size staying on the wire. The author's reasoning holds — PatchMergeImageSettings.patch_size is likewise pinned (patch_merge.rs:92), the caps are documented as wire-level defence in depth (gemma4.rs:26), and removing the fields pre-merge would churn downstream recipe tests. The remaining ask is only the cross-reference for the allowlist and one test tying the two languages (nit 4).
Checked and clean
Additive wire format (ImagePreparationKind::Gemma4 = 11, ImageSettings.profile tag 11, VisionCapacity.patch_features tag 6 with #[serde(default)] at helios/build.rs:53-56, describe omitting 0, round-trip test); bracketed_patch_features() mapping 0 → 1176 (model.rs:72-80) with validate() accepting 0 (model.rs:82-102); envelope bounds checked at bootstrap where they belong (server/config.rs:464-487); bracketed() rejecting non-divisible grids and any token/patch mismatch (packing.rs bracketed arm); overflow guards (checked_mul gemma4.rs:48-51,61-64, try_fold :157-162, check_batch before and after geometry :152,:163); layout-owned spans validated at both ends (layouts/bracketed.rs:57-65,86-88) plus the image/feature counter cross-check (:89-93); Envelope extraction preserving MiniMax semantics (patch_merge.rs:13-136); mechanical patch_features: 0 struct fills across server/scheduler/flare-cli tests.
Open questions / cannot establish
- Whether any published
Bracketedcore declares a non-squarepatches_per_feature, which the newsquare_merge_sideguard now rejects at load. Manifests live inlocal-inference-lab/hyperflare-recipes; a sweep there settles the blast radius. - Whether a prefix-cache endpoint restored mid-envelope should fail the request or back off to the envelope boundary (
docs/TODO.txtopen item;scheduler/checkpoints.rskeeps published endpoints span-aligned today). - Verification limits: read-only. No build or test run; no CI checks on the head commit. The author's reported counts are unverified here and nothing above depends on them. The live-checkpoint paths (
FLARE_GEMMA4_TEST_SNAPSHOT,.venv, cached HF snapshots) are outside CI by construction, and the cached-checkpoint pytest cases skip unless the snapshot is present.
#18 [high] SUMMARY REPORT (GitHub post) — PR #483 round 4 (head ab9a432)
Gemma 4 image preparation + Bracketed patch width — no blockers, four small items before merge
PR #483 at ab9a432b. Every should-fix from the last round is fixed and verified in code this time: per-condition load errors naming both values (gemma4.rs:25-84), one patch_features() authority (gemma4.rs:86-88), patch_features authored in the Ignition contract default with a docstring (contract.py:109-119), the fixture's processor/model blocks now consumed by a CI test (test_frontend_gemma4.py:187-225), the duplicate bootstrap width check folded into one Bracketed branch (server/config.rs:449-463), the superseded #[ignore]d test deleted with the temp template Drop-guarded, and the README/docs contradictions scoped and filled in. Nice work — nothing here is wrong on the served path.
Should Fix
- Landing ahead of the exporter, and nothing mounts the profile end to end. Serving waits on an unlanded
hyperflare-recipesPR (docs/TODO.txt:330-337); no contract fixture uses layout 9 / preparation 11 (helios/tests/support/contracts/gemma4_frontend.json:16-17,38is null), so nothing goesBootstrap::load→ served image request, and the head runs no CI. → Confirm the stack order in one line (or split the shared half out), and add oneBracketed+Gemma 4 contract fixture loaded through the existing helper. prepare_frontend(snapshot, image_profile="gemma4")cannot find the processor. The default path ispreprocessor_config.json(frontend.py:310) but Gemma 4 shipsprocessor_config.json— the generator and every test read/pass that name explicitly, so the documented default raisesFileNotFoundErrorand no test covers it. → Resolve the filename per profile (or accept either) and test the default argument.- Only 2 of the 5 allowlisted budgets are ever loaded. The fixture covers 280 and 1120 (
generate_gemma4_image_fixtures.py:31-40), yetmax_soft_tokensdrives geometry, the clamp branches (gemma4.rs:118-123) and the envelope bound. → Add 70/140/560 cases (regenerate) or a table test overSUPPORTED_SOFT_TOKENS. - The new legacy-core test hand-builds a manifest.
tests.rs:1304-1411duplicatestesting.rs:307-337/:368-377becausetesting::manifestcannot emit aVisiongraph (testing.rs:354), andtests.rs:1450rebuilds a manifest it already holds. → One arm intesting.rs:344-355plus a width override removes ~110 lines.
Nits
- Patch width authored twice over two enums —
packing.rs:32-49andmod.rs:459-471, tied only by a test. → Pass the processor width intotensor_layout. - Repeated test rows — 7 of 9 geometry rows and
pixels_interleave_rgb_and_positions_are_xyrestate fixture cases already pinned by hash; the 11-row profile table repeatspatch_features: 0ten times. - Two doc/wording fixes —
helios/README.md:806reuses$SNAPSHOTfrom the Qwen command at:787-789; the description says "normalizes" where the profile only rescales by1/255. - Duplicated/doubled expressions — the soft-token allowlist lives in Rust and Python (
gemma4.rs:13,frontend.py:132) with nothing tying them;max_patchesis computed checked (:61-64) and unchecked (:98-100). - Shape — move the now-shared
Envelopeout ofpatch_merge.rs:13; passOption<&ImageSpan>instead ofatomic_spans: bool(the gate itself is correct and must stay);model.rs:89's% 3rule applies to non-Bracketedcores that never read the field;scheduler/policy.rs:343-350's sub-envelope truncation is unreachable but untested.
Accepted as-is: keeping patch_size/pooling_kernel_size on the wire — precedent (patch_merge.rs:92), documented defence in depth, and removal would churn downstream recipe tests. Only the allowlist cross-reference is still asked for.
#19 [high] Amendments for round 4 — S2 acceptance, resolved and withdrawn nits
Two items that were should-fix in round 3 and are now downgraded/accepted — record them so the report does not silently drop them.
-
Round-3 S2 ("Ignition derives
patch_features") is now accepted as-is, with one residual nit. The author added"patch_features": 0to the vision default dict and a docstring (ignition/preparation/contract.py:109-119) documenting thatBracketedrecipes with a non-1176 width must set it, but declined to derive the width insidecontract.py, on the grounds that width belongs withpatches_per_feature/patch_capacitiesin the recipe. That is defensible (the earlier complaint — no authoring surface at all — is fixed), and the residual failure mode is one actionable load-time error, not a silent wrong result:server/config.rs:449-455prints "bracketed image layout patch width (1176) differs from image processor (768); re-export the core with vision.patch_features". Report this as an accepted trade-off in the Nits "duplicated/doubled expressions" bullet or in the "Accepted as-is" paragraph, with the ask limited to naming the remedy in the recipe-author docs (e.g. alongsidedocs/TODO.txt:330-337or the companion recipe PR). Do not present it as an open should-fix. -
Round-3 nits 1 and 5 are resolved and must not be re-raised: the duplicate bootstrap width check is folded into one
Bracketedbranch (server/config.rs:449-463), andVisionCapabilities::bracketed_patch_features()is now the accessor used there (model.rs:74-80) instead of reaching intopacking.
Also: round-3 nit about packing.rs's h % merge_side != 0 || w % merge_side != 0 guard is withdrawn — it is not implied by tokens * patches_per_feature == patches (h=2, w=9, ppf=9 satisfies the identity but is not a 3×3 tiling), and the author's rebuttal is correct.
#20 [high] Research summary
Reviewed PR #483 at its new head ab9a432b against the five lens reports, the charter, and the code itself, then rewrote both deliverables for this round.
Round-4 verdict: no blockers. Every should-fix from round 3 is fixed and verified in code this time — split load errors naming both values (gemma4.rs:25-84), single patch_features() authority (:86-88), patch_features authored in the Ignition contract default with a docstring (contract.py:109-119), the fixture's processor/model blocks now consumed by a CI test (test_frontend_gemma4.py:187-225), the legacy Bracketed core-load test the last round asked for (model/tests.rs:1279-1452), the duplicate bootstrap width check folded into one branch (server/config.rs:449-463), the superseded #[ignore]d test deleted with the temp template Drop-guarded, and the README/docs contradictions scoped and filled in.
Four should-fix remain, all small and none on the served path: (1) the profile still lands ahead of its exporter and no contract fixture uses layout 9 / preparation 11, so nothing is exercised from Bootstrap::load to a served image request — needs either a one-line maintainer confirmation of the stack order or one Bracketed+Gemma 4 fixture; (2) prepare_frontend(snapshot, image_profile="gemma4") looks for preprocessor_config.json (not opened) while Gemma 4 ships processor_config.json (not opened), so the documented default raises FileNotFoundError and no test covers it; (3) only 2 of the 5 allowlisted soft-token budgets are ever loaded, leaving the small-budget clamp branches untested; (4) the new legacy-core test hand-builds ~110 lines of manifest that one arm in testing::manifest would remove.
Ten nits are grouped into five bullets: patch width authored over two enums, repeated test rows, two documentation/wording fixes, duplicated allowlist and doubled max_patches, and shape items (Envelope's home, Option<&ImageSpan> instead of a bare bool, the over-broad % 3 rule, the untested sub-envelope prefill path).
I also recorded the author's counter-argument as accepted as-is: keeping patch_size/pooling_kernel_size on the wire (PatchMerge precedent, documented defence in depth, downstream churn) and leaving width authoring to the recipe rather than deriving it inside contract.py — the residual ask there is only a cross-reference naming the remedy. Two round-3 nits are marked resolved and the packing.rs divisibility-guard nit is withdrawn, so the next report cannot re-raise them.
Full report is scratchpad entry #17; the ready-to-post summary is #18; the acceptance/withdrawal notes are #19. Verification was read-only — no cargo test or pytest, and the head commit reports no CI checks, which is stated in the report.
#21 [high] Final assembly instructions for the round-4 report and post
Where the deliverables live: entry #17 = full report (Blockers / Should Fix / Nits + verified-resolved + clean list + open questions), entry #18 = ready-to-post summary, entry #19 = acceptance, resolved-nits and withdrawal notes. Use #17/#18 verbatim where possible; #19 prevents re-raising closed items.
Diff facts for the header: PR #483, rickybrent:core/gemma4-image-frontend → main, head ab9a432b, base main 27716185, 38 files, +2490/−251 (lens reports agree on 36–38 files because two of them counted before the last push; prefer "38 files, +2490/−251" and do not attribute base-branch churn to the author — the head diff also carries unrelated main churn: banner removal, flare doctor, parallax, download rewrites, RebuildManifest → PreparationManifest).
Required shape of the output:
- Full report: the finding, the request, and a short "why" for each item, in three sections — Blockers, Should Fix, Nits. Blockers must be explicitly declared none (say so, don't omit the section). Keep every file:line citation from #17.
- Summary report (the GitHub post): ≤10 bullets total, ≤5 per section, each bullet = finding + tldr of the requested change. Lead with the verdict and the verification of what the author fixed (this round is not "changes requested" in spirit — nothing is wrong on the served path), then the four should-fix items, then the five grouped nit bullets. End with the one-paragraph "accepted as-is" (wire knobs, recipe-side width authoring) so the author knows those debates are closed.
- State the verification limits once, briefly: read-only review, no
cargo test/pytest, and no CI checks on the head commit. - Tone: treat the author's rebuttals as answered where they were right; S1 is a question (was the stack order approved?) with the split-the-branch option as the alternative, not an ultimatum.
Order of the should-fix items is deliberate and should be preserved: S1 scope/evidence (decides whether the rest matters now), S2 the processor_config.json default (first thing a recipe author hits), S3 budget coverage, S4 the manifest duplication.