Explore scratchpad · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/57be1864-d35d-4e86-a6d8-34fe647bd2bc.md

#1 [high] The change: what PR #483 does and its size

PR #483 (rickybrent, branch rickybrent:core/gemma4-image-frontend, head f2340e42, base main 6d6fe0c6), opened 2026-11-23, state open/"ready for review", no reviews, no CI checks, labels none, 13 files +732/-164.

Substance:

  1. New image preprocessing profile Gemma4: helios/src/frontend/images/gemma4.rs (new, 416 lines). Aspect-preserving resize to a multiple of patch_sizepooling (163=48) bounded by a target pixel area from max_soft_tokenspatch^2 (gemma4.rs:54-93); RGB-interleaved patch packing (y,x,channel) with 768 f32 per patch after /255 normalization (gemma4.rs:130-158); (x,y) 2-D patch positions (gemma4.rs:137); soft tokens = patches/9 (poolingkernel²).
  2. patch_merge::Processor split into a reusable Envelope (start/image/end token expansion) plus the existing patch-merge processor (patch_merge.rs:10-30, 83-133); Gemma4 reuses Envelope::expand.
  3. Bracketed packing: bracketed_patch_geometry maps patches_per_feature 4 -> (merge side 2, patch width 1176), 9 -> (3, 768) (packing.rs:16-22); tensor_layout and bracketed() now take/derive from config.contract.vision.patches_per_feature (packing.rs:26-45, 479-491) instead of hardcoded 1176 and patches_per_feature != 4 checks.
  4. helios/src/model/prompt.rs:137-151: fills prepared.data.spans from conditioned_inputs token_span when image_tokens.span is declared and spans are empty. These spans become the scheduler's atomic prefill spans via set_prefill_spans (server/runtime.rs:1460).
  5. Wire/contracts: proto adds GEMMA4_IMAGE_PREPARATION = 11 and ImageSettings.gemma4 tag 11 with Gemma4ImageSettings{patch_size, pooling_kernel_size, max_soft_tokens, image_token, start_token, end_token} (runtime_core.proto:386,519-522,532-541); Rust ImagePreparationKind::Gemma4 = 11 (contract.rs:68); encode/decode + describe (runtime_core/protobuf.rs:167-172, describe.rs:442-443); Python image_settings(profile="gemma4") validation returning the settings (ignition/preparation/frontend.py:113-137), regenerated runtime_core_pb2.py.

#2 [high] Recent activity: branch predates #479; regenerated pb2 drops TERMINAL_PREFILL and downgrades protobuf header

Verified by comparing refs:

#3 [high] The change: Bracketed packing generalization and patch_merge Envelope extraction

#4 [high] The change: atomic spans populated in prompt.rs — undeclared effect on existing Bracketed cores, untested

Verified: helios/src/model/prompt.rs:137-151 (PR head) fills prepared.data.spans from each conditioned_inputs[i].token_span if data.spans is empty and contract.frontend.image_tokens.span.is_some(). What those spans then do (all pre-existing machinery, verified on main & PR head):

#5 [high] The change: wire/contract/Python additions for the Gemma4 profile and what stays unvalidated

Verified by reading pr/483 vs main:

#6 [high] The why: Gemma 4 is already a supported text model here; only the image half was missing, and the recipe half now lives in another repo

#7 [high] Claims and evidence: the HF parity tests are environment-gated and skip silently in CI

Verified from the tree at PR head:

#8 [high] Process: ready-for-review, no CI, no reviewers, no docs, CPU-only self-run evidence

#9 [high] People: author is new to the repo, works across repos with #484, and the image-frontend owners have not engaged

#10 [high] Related work: #426/#479 proto+span overlap, #229 vision path, #405 fixture precedent, #386/#433/#8 precedents

Overlapping/related work found by search:

  1. #426 (open, original-el8, COLLABORATOR, priority contributor) "Add TERMINAL_PREFILL Operation Contract (v4) & Boundary-Aware Prefill Scheduling" — touches helios/proto/runtime_core.proto, helios/src/model/contract.rs, model/packing.rs, ignition/preparation/runtime_core_pb2.py and the scheduler's atomic-span machinery (set_prefill_spans, "Blocks prefix-checkpoint publication ... until TERMINAL_PREFILL completes"). It is the same proto file and the same "atomic input span" scheduling concept this PR newly feeds (prompt.rs:137-151 → runtime.rs:1460 → scheduler.set_prefill_spans). Its #479 part (merged as e091689b) already landed TERMINAL_PREFILL = 14 on main, so #426 and #483 both append to enum GraphOperation / ImagePreparationKind — additive, no field-number collision (11 vs 14), but #483's regenerated pb2 drops #479's enum value (see separate note).
  2. #229 (open, Raydius) "Muse Glimmer 30B NVFP4: single-GPU serving with images, DFlash2 drafting, and 1,048,576-token context" — shares 10 files with this PR per the packet, i.e. another vision enablement stacked on the same frontend/contract code. Competing-with/adjacent work in the image path.
  3. #314 (open) diffusion tensor execution for SDXL/PixArt, #404 (open) per-request activation steering, #472 (open) persistent-worker telemetry, #492/#486/#477 compression PRs — same-files matches only, not topical.
  4. #405 (merged, yatesdr) "Treat declared markers as controls and test literal tokens independently" added the inkling2_frontend.json, nemotron_h_frontend.json and gemma4_frontend.json per-recipe contract fixtures "checked against the recipes by tests/recipes/...". That is the established mechanism for landing a new frontend profile; #483 adds no gemma4 fixture update (gemma4_frontend.json still null image fields), so it does not follow the precedent #405 set.
  5. #386 (merged, PCCessna) "Add image input for Qwen3.8 27B" and #433 (merged, Nero) "Add Inkling 2 Mini text, vision, DSpark preparation" are the two nearest precedents for adding a vision profile; e9d509d6 also introduced Profile::PaddedGrid and ImagePreparationKind::PaddedGrid = 10, the exact shape #483 copies for Gemma4. #483 is therefore the third instance of a repeated pattern (Qwen3.8, Inkling2, now Gemma4), which is evidence for the charter's "solve it once" preference and against adding a fourth bespoke profile.
  6. #8 (closed) "runtime: share bounded image windows between requests" — "bounded by the prefill chunk size without splitting whole images or atomic spans"; the earlier origin of the atomic-span mechanism this PR now exercises.
  7. Geo: nothing in the local copy is superseded or undone by #483; nothing suggests #483 supersedes anything.

#11 [high] Research summary

Case file for PR #483 (rickybrent, core/gemma4-image-frontend, head f2340e42, base main 6d6fe0c6, 13 files +732/−164, open, "ready for review", zero comments, zero reviews, no CI on the head commit). Eight scratchpad entries cover the angles; the important findings:

The change. Four separable things: a new native Gemma 4 image profile (new helios/src/frontend/images/gemma4.rs, 416 lines: area-bounded resize to a multiple of 48, RGB-interleaved 768-float patches, (x,y) positions, patches/9 soft tokens); a refactor of patch_merge::Processor into a reusable Envelope + processor; generalization of ImageLayoutKind::Bracketed from a hard-coded 2×2/1176 to a 2-entry table 4→(2,1176), 9→(3,768) driven by vision.patches_per_feature; and model/prompt.rs:137-151 filling data.spans from conditioned inputs when image_tokens.span is declared. Proto/contract/Python wiring is additive (GEMMA4_IMAGE_PREPARATION = 11, ImageSettings.gemma4 tag 11, prepare_frontend(image_profile="gemma4")).

Undeclared effects and gaps. (1) The span fill is not Gemma-specific: any existing Bracketed core declaring an ImageSpan (which previously produced empty spans) starts feeding set_prefill_spans, so its image envelopes become indivisible prefill units and validate_prompt_data starts enforcing start/end-token boundaries — the description states the mechanism but not that it changes existing cores, and no test covers this branch. (2) The branch is 7 commits behind main and predates #479, so the checked-in ignition/preparation/runtime_core_pb2.py was regenerated without TERMINAL_PREFILL = 14 and downgrades the gencode header 7.36.2→7.36.1 while pyproject.toml:34 pins protobuf>=7.36.2,<8; merging as-is would drop a merged enum value from the Python bindings. On #426 the same defect was an explicit merge blocker for yatesdr. (3) The parity tests are environment-gated and return silently without FLARE_GEMMA4_TEST_SNAPSHOT and a repo .venv, so the claimed "45 passed … including Hugging Face parity" is reproducible only on the author's box and CI would report the same count without running them. (4) No gemma4 contract fixture (gemma4_frontend.json still null image fields) despite #405 setting that precedent; no docs touched.

Context. Gemma 4 text is already supported here; only the image half was missing, and the recipe half now lives in the split-out hyperflare-recipes repo, so this is by construction half a cross-repo change (the author also has #484 open on the recipes side). #479 (merged) landed the same proto enum this PR was branched before; #426 overlaps the proto and the atomic-span scheduler; #229/#386/#433 are the vision-path precedents this follows as the third instance of a bespoke profile, which cuts against the charter's model-agnosticism line.

#12 [high] Project fit: satisfies the enum-orthogonality rule, strains the model-agnostic and evidence rules

Charter (read in full) vs the change:

#13 [high] Reach: existing Bracketed cores gain atomic spans; operators unaffected; nothing servable without the recipe repo; docs untouched

Who and what the change touches, verified by reading:

#14 [medium] Community: no engagement at all — no comments, reviews, reactions or CI on a one-day-old "ready for review" PR

#15 [medium] Recent activity: #479/#430 landed after the branch point, the recipe split removed the other half, every orientation lead dispositioned

Recent activity in the three touched areas (60-day commit owners from the orientation packet, plus the commits themselves verified via search_history):