Explore scratchpad · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/238bea2d-5325-44f9-95e8-4a4d074ff13a.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:

#17 [high] Amendment 2026-11-25: #483 rebased and heavily revised — prior blockers largely addressed

PR #483 head is now 2b4a31e9 (author says rebased onto main 27716185), 36 files, +2269/−240 (was 13 files +732/−164 at f2340e42). Author comment 2026-11-25 08:11 (pr_comments) addresses every blocker/should-fix/nit from the autobot review of 2026-11-24 15:23.

Fixed since my previous report:

  1. pb2 drift gone: helios/proto/runtime_core.proto:401 has TERMINAL_PREFILL = 14 at pr/483; the pb2 descriptor now carries TERMINAL_PREFILL and PreparationManifest (runtime_core_pb2.py:27,92-93). Header is Protobuf Python Version: 7.36.1 (pb2:5) — but main's own checked-in file is also 7.36.1 (read at ref main, line 5), so it is no longer a downgrade against main; pyproject.toml:34 still pins protobuf>=7.36.2,<8, a pre-existing main-line inconsistency, not a #483 defect. My earlier "main has 7.36.2" claim was wrong.
  2. Hard-coded geometry table deleted. packing.rs now: bracketed_patch_features(vision) reading new VisionCapacity.patch_features = 6 (proto:282, #[serde(default)] via helios/build.rs), square_merge_side() over any positive square patches_per_feature, legacy 1176 default, checked arithmetic. ImageProcessor::patch_features() in frontend/images/mod.rs unifies per-profile widths (Qwen/MiMo 1536, Radio 768, Glm 1176, PatchMerge 1176, PaddedGrid 1200, Gemma4 768, DeepSeek family 588) and conditioned.rs:187 uses it.
  3. Atomic spans moved to layouts/bracketed.rs: new atomic_spans: bool argument, flush_span gated on image_tokens.span.is_some() and validating both envelope markers (bracketed.rs:52-70). model/prompt.rs now only passes the flag. New test bracketed_layout_emits_atomic_spans_only_when_contract_declares_them (prompt.rs:1170-1284) covers span==conditioned_input.token_span, span.len()==262, 256-chunk rejection, and MiniMax-style no-span → empty.
  4. HF parity is now unconditional for the geometry/pixels: tests/frontend/gemma4_images.json (8 cases, SHA-256 of resized RGB, pixels, positions across max_soft_tokens 280 and 1120) + generator tests/frontend/generate_gemma4_image_fixtures.py, consumed by canonical_processor_pixels_positions_and_resize (gemma4.rs:268-330). The two live-checkpoint tests are now #[ignore] (gemma4.rs:375, and the .venv one).
  5. Load-time validation added: gemma4::Processor::load requires patch_size ≤64, pooling ≤16, pooling²==limits.patches_per_feature, max_soft_tokens∈{70,140,280,560,1120}, max_soft_tokens*pooling² ≤ max_patches_per_image (gemma4.rs:23-45); server::config::validate_loaded_image_processor (config.rs:443-489) checks patch width vs vision.patch_features (with re-export hint), envelope ≤ prefill_chunk_size and ≤ span.max_tokens, plus test loaded_gemma4_image_processor_validates_patch_width_and_envelope_chunk_bounds.
  6. Ignition image_settings(profile="gemma4") no longer pins the 31B tower: accepts any model_type: gemma4 / vision_config.model_type: gemma4_vision, rejects gemma4_unified (12B), reads image/boi/eoi tokens from tokenizer_config.json and cross-checks them against tokenizer.json and optional config IDs, fails closed without tokenizer_config/snapshot (frontend.py:92-172). New tests/preparation/test_frontend_gemma4.py (216 lines) incl. three cached checkpoints (google/gemma-4-31B-it, nvidia/Gemma-4-31B-IT-NVFP4, google/gemma-4-E2B-it) that pytest.skip when not cached.
  7. Docs now updated: helios/README.md:706-719 (Gemma 4 paragraph), docs/runtime-core-design.md:181-196 (patch_features + bootstrap agreement), helios/model-contract.md:82 (vision row), docs/TODO.txt:331-338 (new end-to-end qualification entry for E2B/E4B/26B-A4B/31B + partial-span prefix-cache audit).

Net: this is now a substantially different, much larger PR (~3x), and the four items I called blockers are closed or converted into load-time errors/tests.

#18 [high] Amendment 2026-11-25: residual gaps and newly introduced narrowings after the fix round

Things that remain true or are newly true at head 2b4a31e9:

#19 [high] Research summary

The event changes the report substantially, so I amended it rather than re-iterating.

Headline amendment: the case file must be re-based. PR #483 is no longer the 13-file, +732/−164 change against f2340e42. The author rebased onto main (27716185) and pushed 2b4a31e9: 36 files, +2269/−240, and posted a point-by-point reply to the autobot "Changes Requested" review. Four of the findings that carried my previous report are now closed in code, so the report's "three behaviours do more than the description says, and one headline claim has no reproducible evidence" framing no longer holds.

Specific amendments to previous findings (entries #17 and #18 in my scratchpad). (1) The stale-bindings blocker is gone — TERMINAL_PREFILL = 14 is present in both the proto and the regenerated pb2, and the pb2 gencode header at 7.36.1 is identical to main's own checked-in file, so my earlier claim that #483 downgrades it against main was wrong; the protobuf>=7.36.2 pin mismatch (pyproject.toml:34) is a pre-existing main-line inconsistency. (2) The hard-coded 4→1176 / 9→768 geometry table is deleted and replaced by a new prepared field VisionCapacity.patch_features = 6 plus square_merge_side() over any positive square patches_per_feature, with ImageProcessor::patch_features() unifying all 11 profiles. (3) Atomic spans moved out of shared model/prompt.rs into layouts/bracketed.rs, gated on image_tokens.span, with a real span-bearing test. (4) The silent-skip parity tests are gone: an unconditional 8-case SHA-256 fixture (tests/frontend/gemma4_images.json + generator) now runs under plain cargo test, and the two live-checkpoint tests are #[ignore]d. (5) Load-time validation now covers pooling² == patches_per_feature, patch width vs patch_features with a re-export hint, and envelope ≤ prefill_chunk_size / ≤ span.max_tokens. (6) The Ignition profile no longer pins the 31B tower and reads envelope tokens from the tokenizer. (7) Docs (README, runtime-core-design, model-contract, TODO.txt) were added.

What still stands, and what is newly true. There is still zero maintainer engagement (only the autobot review and the author's reply) and no CI on the head; the evidence is still self-run CPU-only. helios/tests/support/contracts/gemma4_frontend.json still has image_preparation/image_layout/image_tokens null, so the #405 per-recipe fixture precedent is still not followed — the one review item the author did not claim to fix. docs/runtime-core-design.md:233-240 still enumerates only Qwen/MiMo/DeepSeek image settings, so the doc fix is partial. Nothing is servable without the companion hyperflare-recipes PR, now tracked in docs/TODO.txt:331-338. New narrowings the report should name: VisionCapabilities::validate() now rejects nonzero patch_features not divisible by 3 (model.rs:79); the Bracketed packing error text changed; and a Gemma-4-in-name core prepared without patch_features now fails at load by design. Related-work amendment: #426 merged on 2026-11-25 (da578c5c), which retires the proto-collision concern and makes the surviving overlap purely the disjoint VisionCapacity/scheduler fields.

#20 [high] Amendment: how the previous report's sections must be replaced

The prior report is entry #16 ("Report of 2026-11-24, run 79"). The new event (author push 2b4a31e9 + reply comment) means the report must be re-issued as amendments, not re-stated. Section-by-section replacement map:

Overall verdict shift to state plainly: the four blockers were closed or converted into load-time errors and tests, so the previous "changes requested" posture should become "scope and evidence substantially improved; residual blockers are the missing contract fixture, the still-unengaged owners, and cross-repo unserviceability."

#21 [high] Amendment: citation sheet for the re-based PR head

Facts to cite verbatim in the amended report, all re-read at head 2b4a31e9 unless marked main:

#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):