Subtractive report · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/92500103-6955-42f5-9790-35cab2b5cdf7.md

Subtraction review of PR #483 (+2269 / −240, 36 files)

Key findings

The change is two changes stapled together: a genuine shared fix (per-profile patch width, contract-driven Bracketed packing, Bracketed atomic spans) worth ~1,070 lines, and an entire Gemma 4 image profile (~1,200 lines, 53% of the diff) that nothing in the repository consumes and that the PR itself says cannot serve until an unlanded recipe PR exists. Charter #74 requires new recipes/formats to "prove they export and serve cleanly from the PR branch"; AGENTS.md forbids "presenting scaffolding or partially wired features as supported." The profile half should be deferred, and the remaining half is itself carrying ~350 lines of tests and fixture data that duplicate each other or are read by nothing.

Nothing in the PR is dead behaviour in the shared half — the shared fix removes a real defect (conditioned.rs's _ => 588 fallback was wrong for PatchMerge = 1176 and PaddedGrid = 1200), and I verified the patch_features = 0 → 1176 legacy default is required by docs/design-review.md principle 13 and AGENTS.md core compatibility (existing MiniMax cores have no such field), so it is not a finding.

Ranked by lines saved:

# Severity Where Saves
1 Blocking Gemma 4 profile (gemma4.rs, fixtures, tests, ignition block, enum arms) ~1,200
2 Should fix gemma4.rs:374-533 two #[ignore] tests ~160
3 Should fix gemma4_images.json:2-125 + generator 28-29, 81-85 ~134
4 Should fix packing.rs:694-825 all-profile table ~132
5 Should fix gemma4.rs:335-372 geometry/pixel tests ~24
6 Nit server/config.rs:449-464 duplicate width compare; packing.rs:26-32 square_merge_side ~20
7 Nit layouts/bracketed.rs:52-88 run-tracking closure + atomic_spans: bool ~14

1. Blocking — the Gemma 4 profile is scaffolding with no in-tree consumer (~1,200 lines)

Evidence it is not needed yet

What goes if the profile is deferred

Path Added lines
helios/src/frontend/images/gemma4.rs (whole file; 185 production, 350 test) 534
tests/frontend/gemma4_images.json 256
tests/preparation/test_frontend_gemma4.py 216
tests/frontend/generate_gemma4_image_fixtures.py 94
ignition/preparation/frontend.py:114-173 (Gemma 4 checkpoint gate) ~60
helios/proto/runtime_core.proto:598-605 Gemma4ImageSettings, ImagePreparationKind::Gemma4, mod.rs arms, protobuf.rs arm + round-trip test, describe.rs, conditioned.rs:354-361, config.rs Gemma 4 test, docs ~40

~1,200 lines, leaving ~1,070 that carry only the shared fix.

What should stay and land on its own (all of it addresses a demonstrable defect or a missing invariant):

Smaller version of the whole PR: one commit adding the contract field + per-profile width + contract-driven Bracketed packing + Bracketed spans; the profile moves to the recipe PR that can actually export and serve it, and brings its own fixtures and tests then.


2. Should fix — two #[ignore] tests duplicate the checked-in fixture (~160 lines)

helios/src/frontend/images/gemma4.rs:374-533 (only relevant if the profile stays).

Neither runs in CI (both require an environment variable or .venv), and both deviate from the repo's existing optional-snapshot pattern of an early return (layouts/bracketed.rs:126, frontend/images/decoding_tests.rs (not opened), helios/tests/tools/test_images.rs) — the PR description frames this as deliberate, which only makes them fail-if-you-fiddled tests.

Smaller version: delete both functions plus the imports they alone need (crate::frontend::{Asset, FrontendAssets, images::ImageSettings} at 189, sha2 at 190, std::path::PathBuf at 191). Every assertion stays covered unconditionally. ~160 lines.


3. Should fix — the fixture ships 124 lines no test reads (~134 lines)

tests/frontend/gemma4_images.json:2-125 contains a full processor block (audio feature extractor, image processor, video processor — lines 2-76) and a full model block (vision_config + model_type + image_token_id/boi_token_id/eoi_token_id — lines 77-125).

The only consumer is helios/src/frontend/images/gemma4.rs:269-273, which parses the file and reads fixture["cases"].as_array(); a repo-wide search for gemma4_images returns that single hit, and helios/tests/tools/test_images.rs expects an assets key and is not pointed at this file. Nothing reads ["processor"] or ["model"].

tests/frontend/generate_gemma4_image_fixtures.py:28-29 reads processor_config.json (not opened)/config.json (not opened) only to build those blocks (81-85), which are written at line 86 as dict(processor=raw, model=profile, cases=cases).

Smaller version: write dict(cases=cases); delete generator lines 28-29 and 81-85 and JSON lines 2-125. ~124 JSON + ~10 Python lines.

Honest caveat: tests/frontend/glm53_images.json:2-87 and generate_glm_image_fixtures.py:29-30,43-44 already do the same thing, so this copies an existing (already dead) convention rather than inventing one. For a newly added 256-line file it is still 134 lines of data no code reads.


4. Should fix — packing.rs 11-profile table test repeats conditioned.rs (~132 lines)

helios/src/frontend/images/packing.rs:694-825 processor_patch_features_match_tensor_layout_for_every_profile builds an 11-row table of ImageSettings + ImageLimits + layout + patches_per_feature + patch_features and asserts processor.patch_features() == tensor_layout(...).1.

That equality is already enforced twice, unconditionally:

Smaller version: delete the table (694-825) and the ImageSettings imports it needs. Keep bracketed_packs_3x3_metadata_widths_and_rejects_invalid_extents (603-693), which is the only genuinely new behaviour (3×3 stride, 768 width, truncation/odd-grid rejection). If direct table coverage is wanted, three rows (PatchMerge 1176, PaddedGrid 1200, Bracketed/Gemma4 768) say the same in ~12 lines instead of 132.


5. Should fix — gemma4.rs geometry/pixel tests restate the fixture (~24 lines)

No loss: the only unique bit, (x, y) ordering, is exactly what the positions hash pins.


6. Nit — one duplicated width comparison and one misplaced helper (~20 lines)

helios/src/server/config.rs:443-464 compares the processor width against the contract twice:

if vision.patch_features != 0 && width != vision.patch_features { /* err A */ }
if image_layout == Some(Bracketed) {
    let expected = packing::bracketed_patch_features(vision);
    if width != expected { /* err B */ }
}

The second block is unreachable after the first whenever patch_features != 0, since bracketed_patch_features returns vision.patch_features in that case. One condition covers both, with one error string instead of two:

let bracketed = model.contract.frontend.image_layout == Some(ImageLayoutKind::Bracketed);
if let Some(expected) = (vision.patch_features != 0 || bracketed)
    .then(|| packing::bracketed_patch_features(vision))
    .filter(|expected| width != *expected)
{
    return Err(format!("image preparation patch width ({width}) differs from the prepared layout width ({expected}); re-export the core with vision.patch_features").into());
}

All three rejections exercised by the test at config.rs:936-1024 (legacy 0 → 1176 mismatch, explicit mismatch, match) still fire. ~10 lines.

Related: square_merge_side (packing.rs:26-32) exists only so tensor_layout can reject a non-square patches_per_feature at load, and it forces a vision argument through tensor_layout (packing.rs:34-39), through model/packing.rs:92-97, through four test call sites, plus a duplicate call in bracketed() (packing.rs:495). Every in-tree profile has a square ratio (Qwen 4, Mimo 4, Deepseek 9, DeepseekRowMajor 9, Moonvit 4, Step 4, Radio 4, Glm 4, PatchMerge 4, PaddedGrid 4, Gemma 4 9), so it is a contract invariant: fold it into VisionCapabilities::validate() (helios/src/model.rs:72-92) and delete the helper plus the extra parameter. ~8-12 lines and a smaller signature.


7. Nit — the span can be computed where the run starts (~14 lines)

helios/src/frontend/images/layouts/bracketed.rs:52-88 threads run_start state, a two-branch flush_span closure and a trailing flush in order to push start-1..end+1. The run's extent is already known when the run starts (processed.geometry[image].tokens), so the state machine disappears:

if position == 0 || expanded.mm_token_type_ids[position - 1] == 0 {
    let source = images.get(image).ok_or("unexpected image token span")?;
    conditioning.push(ConditioningEvent { position: position as u64, identity: source.identity });
    if let Some(span) = span {
        let end = position + processed.geometry[image].tokens + 1;
        spans.push(position.checked_sub(1).filter(|_| end <= expanded.token_ids.len())
            .ok_or("bracketed image span is missing envelope markers")?..end);
    }
    image += 1;
}

~10 lines, no closure. The closure's two error branches are also redundant with admission: validate_prompt_data (helios/src/model.rs:425-428 requires s.start < s.end <= tokens.len(); 441-456 requires tokens[s.start] == span.start_token and tokens[s.end-1] == span.end_token) already rejects a mis-placed boundary.

Separately, atomic_spans: bool (bracketed.rs:23) is computed in exactly one place — helios/src/model/prompt.rs:58-64 — from image_tokens.span.is_some(). Passing Option<&ImageSpan> instead removes the boolean and the .is_some(), matching how class_token::prepare_input already receives a prepared layout field (model/prompt.rs:69-73). ~4 lines.


Open questions / what I could not establish