Simplicity report · NVIDIA/hyperflare-inference #483

Raw Markdown for agents: https://autobot.eidonix.com/p/7c30e606-c070-4b3c-b1cb-dfdc3825d66a.md

Review of PR #483 — simplicity lens (head ab9a432, base main 27716185)

Verdict: should-fix issues only. No blocking findings.

Rules applied, cited below: AGENTS.md:188-193 ("Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement… Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost"), AGENTS.md:194-199 (tests must exercise the affected behavior; no scaffolding presented as supported), docs/design-review.md:16 ("Keep Helios as simple as possible"), charter line 12 (runtime small and model-agnostic).

Scope: every changed file was read in context; the three findings below are the residue after the author's polish commit. Things I checked and found fine are listed at the end so they are not re-reviewed.


Key findings

  1. Gemma 4 patch_size / pooling_kernel_size are unreachable wire knobs (should fix). No producer can emit anything but 16/3, yet the code carries two proto fields, two struct fields, three validation arms that cannot fire, and a third spelling of the 768 patch width. AGENTS.md:188-193 names configuration switches without a concrete requirement as a rejection reason.
  2. The new geometry test repeats 7 of 9 rows a checked-in fixture already pins by hash (should fix). Only (100,3000) and (3000,100) are unique.
  3. The new legacy-core test hand-builds ~70 lines of manifest (should fix) because the shared test manifest builder cannot emit a Vision graph; the fix is three lines in testing.rs and unlocks future vision-core tests.
  4. Three nits: a ~130-line table where four rows suffice, a precomputed boolean threaded across a module boundary, and a test that restates a fixture case by hand.

Should fix

S1. patch_size and pooling_kernel_size cannot vary; they only duplicate the 768 patch width

Files/lines: helios/proto/runtime_core.proto:599-600; helios/src/frontend/images/mod.rs:335-336; helios/src/frontend/images/gemma4.rs:18-19,27-40,52-60,86-88; ignition/preparation/frontend.py:124-127,140-141,168-173.

What is wrong. The wire/profile surface offers two tunables that no producer can ever set to anything but one value:

Why it matters. This is exactly the "configuration switches without a concrete requirement" and "speculative compatibility" that AGENTS.md:188-193 says to reject, and it is contrary in spirit to docs/design-review.md:16's instruction to express model differences through prepared layout metadata rather than native specialisation. A reader of Gemma4ImageSettings reasonably concludes patch geometry is configurable, then has to trace into Python to discover it is not. The duplicated 768 and duplicated soft-token list are two places a future change can rot.

The smaller version. Follow the precedent already in the tree — glm.rs (not opened)'s const FACTOR: usize = 28 — and express the fixed geometry as constants:

const PATCH: usize = 16;
const POOLING: usize = 3;
const FEATURES: usize = 3 * PATCH * PATCH; // 768

Then: reserve proto tags 1-2 in Gemma4ImageSettings; drop the two struct fields, their serde keys, the two serde/protobuf field mappings, both dead validation arms, and the two Python literals at frontend.py:169-170; keep the single pooling_area² == limits.patches_per_feature check as the remaining cross-profile invariant (it is a genuine prepared-contract check, not a duplicate of a knob); keep one soft-token allowlist — prefer the Python one, since preparation is where the checkpoint is actually rejected, and have Rust consume it through the prepared contract instead of a local copy.

Anticipated counter and why it does not hold. The author may point to PatchMergeImageSettings.patch_size, which patch_merge.rs:92 likewise pins to 14. That is the same defect in the neighbouring profile — precedent, not a requirement — and unlike PatchMerge these tags have never shipped, so no compatibility argument constrains them.

S2. geometry_matches_the_hugging_face_processor repeats 7 of its 9 rows

File/lines: helios/src/frontend/images/gemma4.rs:383-402.

What is wrong. The nine-row table at :386-396 asserts grid/tokens for (1,1), (672,672), (1008,672), (91,37), (1920,1080), (10,3000), (3000,10), (100,3000), (3000,100). The first seven are already pinned — grid, tokens, patches and resize SHA-256 — by canonical_processor_pixels_positions_and_resize (gemma4.rs:314-381) from tests/frontend/gemma4_images.json:126-256. Only (100,3000) → [1,273,9] and (3000,100) → [1,9,273] (:392-393) add coverage.

Why it matters. Two assertions on the same values with two different failure messages is the kind of parallel path that drifts: if the resize geometry changes, one test fails and the other may not, and a reader cannot tell which is authoritative. It is also per AGENTS.md:194-199 redundant validation rather than focused validation.

The smaller version. Keep the two tall/wide rows plus the tokens * 9 == patches invariant (:400), which is a real property the fixture does not assert, and delete the other seven rows (~10 lines). Alternatively delete the test entirely and add the invariant to the fixture loop at :378.

S3. The new legacy-core test hand-builds a manifest the shared builder could emit

Files/lines: helios/src/model/tests.rs:1277-1452, specifically build_manifest at :1343-1411; root cause helios/src/model/testing.rs:344-355.

What is wrong. testing::manifest cannot produce the graph this test needs: testing.rs:354 sends GraphOperation::Vision to _ => unreachable!(), so the test reimplements manifest construction locally. That local copy duplicates shared arithmetic — tests.rs:1355-1409 repeats the strides/address/offset computation of testing.rs:307-337 and the binding assembly of :368-377 — and it exists only because the shared builder also fixes every ImageTensor binding to width 1 (testing.rs:259-275) and to Dtype::Int64 unless listed (:276-293). There is also a redundant reconstruction at tests.rs:1450 (base_manifest = build_manifest(1176) immediately before use; base_manifest holds exactly that value from :1414).

Why it matters. ~70 lines of hand-maintained manifest arithmetic is a second source of truth for graph layout; when ExecutionManifest shape changes, this test breaks for reasons unrelated to the behaviour it checks (a legacy core without patch_features loads and stages 1176-wide pixels).

The smaller version. Map GraphOperation::Vision => GraphKind::Vision in testing::manifest (testing.rs:344-355) and let the test override the one vision_pixel_values buffer extent to (16, pixel_width); the shared builder then supplies strides, bindings and input_frame_bytes. That removes the local build_manifest closure entirely, removes the redundant :1450 rebuild, and makes future vision-core tests possible without another copy. This is squarely inside AGENTS.md:194-199's "tests must exercise the affected behavior" — the plumbing is not the behaviour.


Nits

  1. helios/src/frontend/images/packing.rs:685-814 (~130 lines). processor_patch_features_match_tensor_layout_for_every_profile asserts processor.patch_features() == tensor_layout(..) across ten rows, many of them carrying patch_features: 0. Four rows cover every distinct outcome (Gemma 4 9/768, PatchMerge 4→1176, PaddedGrid 1200, plus one of 588 or 1536); the rest is repetition, ~100 lines removable.
  2. helios/src/model/prompt.rs:52-65. The ImageLayoutKind::Bracketed arm computes …image_tokens.span…is_some() as a bare bool and passes it positionally; layouts/bracketed.rs:23,58 consumes it, and the test call sites pass false at bracketed.rs:175,199. Passing Option<&ImageSpan> puts the derivation next to its only use and removes an unlabelled boolean from a five-argument signature. (The span emission itself in bracketed.rs:51-88 is the right design — one closure, one loop, matching deepseek — and replacing it would be worse.)
  3. helios/src/frontend/images/gemma4.rs:404-420. pixels_interleave_rgb_and_positions_are_xy restates the 91×37 fixture case by hand (grid_thw [1,30,78], patches * 3 * 16 * 16 at :411-412), which the fixture already pins by SHA-256. Keep only the assertion the hash cannot express — the (x, y) ordering check at :415-418 (position_ids[grid_w] == [0,1]), which is genuinely worth keeping and should be noted as such if the rest goes.

Checked in context and found fine (do not re-raise)


Open questions and what I could not verify