Pre test report scratchpad · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/20994d93-0802-43f3-bc54-19d6ea54a567.md

#1 [high] Merge blocker: PR pb2 drops TERMINAL_PREFILL and downgrades gencode

Verified: on pr/483 head, TERMINAL_PREFILL has zero matches anywhere in the tree (search_code pattern TERMINAL_PREFILL on ref pr/483 → no matches), including helios/proto/runtime_core.proto (line 337-339 ends after SCORED_PREFILL = 12) and ignition/preparation/runtime_core_pb2.py. On main: helios/proto/runtime_core.proto:338 TERMINAL_PREFILL = 14; (from #479, commit e091689b, Nov 23 "optional TerminalPrefill"), ignition/preparation/contract.py:29 lists "terminal_prefill", and runtime_core_pb2.py descriptor blob contains it (search matched main pb2). The PR diff to runtime_core_pb2.py is +122/−120 and replaces the whole serialized descriptor; it does not touch contract.py (unchanged by PR), so a merge yields main's contract.py calling p.GraphOperation.Value("terminal_prefill") (contract.py:82) against a binding with no such enum value → preparation of any core with terminal_prefill graphs fails. tests/direct/test_scheduler.py:720 on main asserts p.TERMINAL_PREFILL == 14 → AttributeError. Also header regressed Protobuf Python Version: 7.36.2 → 7.36.1 and ValidateProtobufRuntimeVersion arg 2→1 (pb2:5, :16) while pyproject.toml:34 pins protobuf>=7.36.2,<8; regeneration command is helios/manifest.md:468-471. Base commit is 6d6fe0c6; PR head f2340e42 dated Nov 22, older than #479. Branch is stale.

#2 [high] No hardware-reachable path: no Gemma 4 checkpoint or recipe

Hardware: cn5 (4× RTX PRO 6000 Blackwell, amd64) has facebook/dinov2-base, local-inference-lab/GLM-5.3-Flash-NVFP4, nvidia/GLM-5.3-Flash-NVFP4, timm/vit_base_patch14_dinov2.lvd142m. cn7 (1× GB10, arm64) has incoai/Qwen3.8-27B-DFlash2, nvidia/Qwen3.8-27B-NVFP4, nvidia/Qwen3.8-Flash-Next-FP4-Local. No Gemma 4 checkpoint on either host. No in-tree recipe selects the profile: search_code gemma-4|gemma4 over ignition/ returns only ignition/preparation/frontend.py:113-137 and the pb2 blob — no recipe registries (recipes were split out per commit 17bb3c4a/da037284 "Remove extracted hyperflare_recipes ... from core Flare"). helios/tests/support/contracts/gemma4_frontend.json:16-17,38 has image_preparation/image_layout/image_tokens all null. So serving a Gemma 4 vision request requires a companion PR in local-inference-lab/hyperflare-recipes plus a checkpoint download that is not on the hardware. The changed logic (resize/patch interleave/positions/envelope/packing widths) is CPU-side and deterministically testable without a GPU.

#3 [high] Should-fix: count-keyed patch width table in shared packing

helios/src/frontend/images/packing.rs:16-22:

fn bracketed_patch_geometry(patches_per_feature: usize) -> Result<(i64, usize)> {
    match patches_per_feature { 4 => Ok((2, 1176)), 9 => Ok((3, 768)), _ => Err(...) }
}

Patch width is 3patch_size^2 (16→768), a vision-tower property; patches_per_feature is a merge factor. Key is ambiguous in-tree: DeepSeek uses ppf=9 with 588 floats/patch (packing.rs:32-34 Deepseek arm → patches588; helios/tests/support/contracts/deepseek4.json:9 "patches_per_feature": 9). So 9→768 is model identity in a geometry name. Three copies of 768: packing.rs:19, conditioned.rs:192 (Profile::Gemma4(_) => 768, used by valid_processed cache predicate), gemma4.rs:116 (3*self.patch_size*self.patch_size). Load-time behavior change: model/packing.rs:92-97 calls tensor_layout from Packing::new during core load with config.contract.vision.patches_per_feature; before this PR Bracketed was fixed 2×1176. Any core declaring Bracketed with ppf != 4 or 9 now fails at load; with ppf=9 and 588-wide patches it would be silently mis-strided. Note gemma4::Processor::load (gemma4.rs:23-44) accepts any patch_size 1..=64 / pooling 1..=16, so profile/contract can disagree (e.g. patch_size=14,ppf=4 → load OK, packing slices 1176 stride over 588-float patches). Mitigation check: class_token still asserts ppf==4 (packing.rs:527). Prompt validation cross-checks tokens*ppf==patches (prompt.rs:171, packing.rs:488).

#4 [high] Should-fix: untested shared-behaviour span fill in prompt.rs

helios/src/model/prompt.rs:137-151 (new, +15 lines) fills prepared.data.spans from conditioned_inputs token spans when prepared.data.spans.is_empty() AND config.contract.frontend.image_tokens.span is Some. This is profile-independent shared code, not Gemma-4-only: consumers are validate_prompt_data (model.rs:420-454) and Scheduler::set_prefill_spans, i.e. it converts an image envelope into an unsplittable prefill unit. Precedent is the layout owning spans: layouts/deepseek.rs:149 pushes spans beside tokens.extend; Bracketed's layouts/bracketed.rs:82-91 returns PromptData{vision_token_indices, ..Default::default()} (empty spans) and conditioned_inputs: vec![]. Coverage: zero. gemma4_frontend.json image_tokens is null (line 38); in-tree span fixture only deepseek4.json:56 and the synthetic spans at prompt.rs:481-487,699 (Deepseek/DeepseekRowMajor only). search_code spans|span over prompt.rs shows no new test for lines 137-151. Known-affected existing cores: none demonstrated in-tree — no in-tree contract declares image_layout Bracketed with a non-null image_tokens (deepseek4.json image_layout 3 = Deepseek; mimo 2; qwen 1; step 5; nemotron 6; inkling 10). Minimax patch_merge fixtures are the patch_merge profile, not Bracketed. So blast radius is a recipe-repo question, unresolved. Secondary: envelope span = max_soft_tokens+1 (gemma4.rs:11 allows 1120 → 1121) vs validate_prompt_data rejecting len > prefill_chunk_size (model.rs:422) and scheduler set_prefill_spans capacity check. Default prefill_chunk_size is 4096 (server/config.rs:149) so the default is safe; a smaller chunk is not.

#5 [high] Parity evidence is silent-skip only; no CI on head

gemma4.rs:236-334 checkpoint_tokens_expand_the_image_envelope and gemma4.rs:334-415 native_pixels_and_positions_match_the_checkpoint_processor both return early and silently:

#8 [high] Confirmed: merging PR reverts #479 TERMINAL_PREFILL from proto and pb2

Decisive, verified by direct file reads at both refs:

#9 [high] Corrected: regression is the regenerated pb2 overwriting main, not the .proto hunks

CORRECTION to entry 8's mechanism (conclusion unchanged, precise mechanism):

#11 [high] Report 2026-11-25 run: prior blockers verified fixed at 2b4a31e

Verified by direct reads at pr/483 head 2b4a31e:

F1 (pb2 regression) FIXED: ignition/preparation/runtime_core_pb2.py descriptor at :27 now contains BOTH GEMMA4_IMAGE_PREPARATION\x10\x0b and TERMINAL_PREFILL\x10\x0e and the new PreparationManifest/PreparationParameter messages from main 27716185. Header still "Protobuf Python Version: 7.36.1" (pb2:5, ValidateProtobufRuntimeVersion 7,36,1 at :12-19) which is IDENTICAL to main's own file (read at ref=main, same lines) — no drift vs main; the pyproject 7.36.2 pin inconsistency is pre-existing on main.

F2 (count-keyed width table) FIXED: packing.rs:16-32 now LEGACY_BRACKETED_PATCH_FEATURES=1176, bracketed_patch_features(vision) (0→legacy), square_merge_side(ppf) via isqrt+square check; tensor_layout takes &VisionCapabilities (packing.rs:34-56); callers model/packing.rs:92-97 and bracketed() packing.rs:493-518. New additive field helios/proto/runtime_core.proto:281-282 uint64 patch_features = 6, serde(default) (model.rs:51-53), validate() at model.rs:72-92.

F3 (shared span fill) FIXED: emission now in layouts/bracketed.rs:52-111 gated on an atomic_spans: bool threaded from model/prompt.rs:52-65; the prompt.rs fallback is gone; test bracketed_layout_emits_atomic_spans_only_when_contract_declares_them at model/prompt.rs:1171-1282 (2 spans, len 262, markers, 256-chunk rejection, MiniMax no-span case).

Also fixed: conditioned.rs:187 now self.processor.patch_features() (single authority, mod.rs:459-471, 11 profiles); server/config.rs:443-490 bootstrap validation (width vs patch_features, Bracketed legacy-0 actionable error, envelope vs prefill_chunk_size and span.max_tokens) with boundary tests config.rs:936-1023; ignition/preparation/frontend.py:114-173 now asserts only consumed fields + validates envelope tokens from tokenizer_config.json as single tokens; docs updated (helios/README.md:705-719, docs/runtime-core-design.md:181-197, model-contract.md:82, TODO.txt:331-337); protobuf round-trip test protobuf.rs:813.

REMAINING writer-side gap (verified, total): patch_features appears NOWHERE in ignition except the pb2 descriptor. ignition/preparation/contract.py:112 default vision dict is dict(features_per_request=0, max_images=0, patches_per_feature=0, patch_capacities=[]) with no patch_features. A recipe that passes only the historical four keys exports 0 → legacy 1176 → Gemma4 (768) rejected at flare run by config.rs:456-464. Callers can pass extra keys via **vision, so it is an ergonomic/default gap, not a functional break. One-line fix.

#12 [high] Hardware testability at 2b4a31e: still zero reachable value

Testability analysis for the re-referral decision:

#6 [medium] Preparation gaps: single-checkpoint pin, unchecked token strings, no pytest

ignition/preparation/frontend.py:113-137 (new gemma4 branch): pins processor_class Gemma4Processor, image_processor type/patch_size 16/pooling 3/do_resize/do_rescale/do_normalize False/mean 0/std 1, optional resample 3/rescale_factor 1/255/do_convert_rgb, max_soft_tokens in (70,140,280,560,1120), and vision_config {gemma4_vision, 16, 3, 27 layers, 1152 hidden, 16 heads, head_dim 72, 4304 FFN}. Returns hardcoded tokens "<|image|>", "<|image>", "<image|>" with no check that each encodes to exactly one added token (contrast _native_image_placeholder at frontend.py:231-245 which does that for DeepSeek). Docs (repo lists all five Gemma 4 variants): docs/model-preparation.md:345 (gemma-4-e2b/e4b/12b/26b-a4b/31b + NVFP4); docs/api.md:749 links the 26B-A4B-it card; docs/model-development.md:79-83 covers e2b-e4b and 26B-A4B templates. So the vision-tower pin excluding 26B-A4B (and #74 more-than-one-checkpoint rule) is a real charter gap, but a doc/preparation-guard issue, not a hardware-testable runtime defect. No pytest for image_settings(profile="gemma4"): search_code gemma4 over tests/ → no matches. Shared constant duplicated: SUPPORTED_SOFT_TOKENS gemma4.rs:11 vs frontend.py:123.

#7 [medium] Checked clean and lower-severity items

Checked clean / lower severity:

#13 [medium] Residual should-fix items at 2b4a31e (none hardware-relevant)

Independent grading of what remains at head 2b4a31e, after re-reading the code:

A. ignition/preparation/contract.py:112 — default vision dict = dict(features_per_request=0, max_images=0, patches_per_feature=0, patch_capacities=[]), no patch_features. patch_features appears nowhere else in ignition except the pb2 descriptor. This is the in-repo authoring helper recipes call (cf. helios/tests/collective_core_fixture.py:33-40 passing the same four keys); **vision allows an explicit key, so it is a default/ergonomics gap with a serve-time symptom (config.rs:456-464 "re-export the core with vision.patch_features"), not a functional break. One-line fix. Should-fix before merge, but no hardware test can reach it.

B. server/config.rs:449-455 vs :456-464 — the first width check is subsumed by the Bracketed check whenever patch_features != 0 (bracketed_patch_features returns it verbatim); produces a second, vaguer message for the same defect. Cosmetic.

C. gemma4.rs:30-38 — one message invalid Gemma 4 image settings covers 6 conditions (patch_size 0/>64, pooling 0/>16, soft-token allowlist, pooling²!=ppf, patch budget). Diagnostic quality only.

D. gemma4.rs:132 re-inlines 3*patch_size*patch_size next to the patch_features() accessor at :54. Nit.

E. packing.rs:41-100 (ImageLayoutKind→width) and mod.rs:459-471 (Profile→width) remain two matches linked only by the 11-row test at packing.rs:695-824. Nit (test-covered).

F. patch_size/pooling_kernel_size remain configurable on the wire though ignition/preparation/frontend.py:124-127,140-141 pin 16/3 and :168-173 writes 16/3 literally. Dead flexibility, not incorrect.

G. Docs: helios/README.md:721-728 still presents Qwen's "1536 / temporal copy / 2×2 merge" as the shared process contract directly under the new Gemma 4 paragraph; docs/runtime-core-design.md:233-240 still omits Gemma 4 from the per-profile enumeration; image-fixture provenance at helios/README.md:772-789 names only the Qwen fixtures. Documentation only.

H. tests/frontend/gemma4_images.json processor/model blocks (lines 2-125) are written by generate_gemma4_image_fixtures.py:86 but never read (gemma4.rs:273 reads cases only). Dead data; envelope/token parity rests on the two #[ignore]d tests plus the pytest checkpoint cases that skip without HF_HOME.

I. Value delivered beyond the new profile: conditioned.rs:187 valid_processed previously used _ => 588 (confirmed at main:192), which is wrong for PatchMerge (1176) and PaddedGrid/padded_grid::FEATURES (1200) — the PR replaces it with ImageProcessor::patch_features() (mod.rs:459-471), fixing a per-request cache-invalidation bug. Also fixes a span-declaring Bracketed core being rejected at validate_prompt_data.