Subtractive report · NVIDIA/hyperflare-inference #505

Raw Markdown for agents: https://autobot.eidonix.com/p/ab84d1cf-17e1-4f13-9ad3-b40155a0bd14.md

Key findings

The direction of PR #505 is sanctioned and the wire surface is minimal: ModelContract.core_parameters, ValueSource::CORE_PARAMETER = 43 and ValueBinding.parameter are the smallest protobuf change that offers recipe-declared FP32 inputs, and Luke Alonso's comment on #404 ("implement this not as a hardcoded steering_scale parameter, but as a generic system by which model cores can expose scalar arguments") is the maintainer request the charter requires for a new captured-graph op contract. The recipe-facing helpers in ignition/preparation/contract.py (core_parameter, binding(parameter=), model_contract(core_parameters=)) are also irreducible.

What is not minimal is the validation and the number of copies of the same resolved value. The change implements the same contracts four times (Rust load-time, Rust export-time, Python ignition/preparation, Python ignition/direct) and keeps two clones of the resolved parameter map plus a runtime guard comparing them. Both are removable without losing anything: the value is produced once at the HTTP boundary and never mutated afterwards, and ignition/direct serves the same already-validated prepared model that helios validates on load.

Verdict: make it smaller first.


Findings, ranked by lines saved

1. Should fix — ignition/direct re-implements the whole core-parameter contract validation in Python (~90 lines, plus ~110 test lines)

ignition/direct/scheduler.py:121-185 (Layout.__post_init__) validates, for every loaded run:

Every one of those rules already exists in helios/src/model/contract.rs:473-482 and :665-728 and runs when the core is loaded (serving_contract → PreparedContract::validate, contract.rs:551) and when it is exported (heliopause/src/export/binding.rs, runtime_core::validate_core_parameters). ignition/direct consumes the same prepared model object (ignition/preparation/model.py:24-36 (not opened) copies the already-validated contract into server_config), and ignition/preparation/graphs.py:125-181 (_validate_resources) already asserts buffer contiguity for every registered buffer.

What the direct path genuinely needs is only the packing case at ignition/direct/packing.py:84 and the request-side resolution at scheduler.py:227-249. What goes with the block:

Tests that go with it: tests/direct/test_scheduler.py — the _core_parameter_layout rejection knobs (:726-800 region) and the layout-invalidation cases around :840-847, :910-940.

Lines saved: ~90 product + ~110 test. Loss: none for a core that helios accepts; the direct path is documented as diagnostic-only (docs/direct-execution.md banner: "not production serving").

Caveat to state plainly: if maintainers want the Python path independently defensible against a core produced by another exporter, this stays. That is the only argument for keeping it, and it is not currently written down anywhere in the PR.

2. Should fix — two copies of the same resolved map, plus a guard comparing them (~36-55 lines)

Admission.core_parameters (helios/src/model/admission.rs:62) is a second clone of exactly the map LiveRequest.core_parameters holds:

What goes:

  1. Admission.core_parameters and config.contract.validate_core_parameters(&self.core_parameters)? (admission.rs:62, :74-76). The value was resolved and range-checked by PreparedContract::resolve_core_parameters at the HTTP boundary (server/request.rs:333-335) before the Prompt existed, and is checked again in plan_admission_with_core_parameters (scheduler.rs:1548-1552). Same for the validate_prompt copy at admission.rs:137-139.
  2. PreparedContract::validate_core_parameters (contract.rs:534-536), a one-line wrapper over validate_resolved_core_parameters whose only callers are those two lines.
  3. The bit-equality cross-check at helios/src/model/packing.rs:588-597 (planned + to_bits() != to_bits() + "packed core parameter differs from its prefix-history value"). It compares two clones of an immutable map.
  4. The 15 one-line core_parameters: Default::default(), fixture fills added across helios/src/model/tests.rs (:544, :689, :1005, :1163, :1377, :1592, :1811, :2050, :2152, :2415), model/packed_round_tests.rs:124, server/runtime.rs (:3030, :3286, :3621), server/runtime/phase_tests.rs:215, server/runtime/prompt_tests.rs:53.

Smaller version at packing.rs:582-587:

if binding.source == ValueSource::CoreParameter {
    let value = live
        .core_parameters()
        .get(&binding.parameter)
        .copied()
        .ok_or("core-parameter admission is incomplete")?;

Nothing is lost: the map is immutable after admission and the prefix hash already used the same bits (scheduler.rs:1560-1566).

3. Should fix — is_text_forward_graph duplicates GraphKind::samples() (~14 lines, +12 in tests)

helios/src/model/contract.rs:424-435 adds a private helper matching Prefill | TerminalPrefill | ScoredPrefill | Resume | Decode | Speculative | Mixed. helios/src/execution/manifest.rs:89-100 already has GraphKind::samples() with exactly that set, and it is already the shared vocabulary for "this graph runs a forward" (manifest.rs:940, transport.rs:1537 (not opened), :1552, server/runtime.rs:2969, model/testing.rs:171).

Replace the two call sites (contract.rs:665, packing.rs:139-145) with descriptor.kind.samples() / graph.kind.samples() and delete the helper. Also drop the duplicated seven-kind matches! in the new test helpers helios/src/model/tests.rs:59-77 and server/runtime/phase_tests.rs:6637-6652 in favour of kind.samples(). Second list to keep in sync disappears.

4. Should fix — the same FP32 wire validator written four times, plus a -0.0 invariant nothing needs (~20-40 lines)

The identical number check appears as:

Smaller version: ignition/direct/scheduler.py imports _wire_fp32 from ignition.preparation.contract, and the Rust decode map narrows through one shared helper so resolve_value is the only place range clamping happens (it already is on the load path).

Separately, canonical_core_parameter (contract.rs:420-422, if value == 0. { 0. } else { value }) is threaded through five call sites — cache/hash.rs:49, server/models.rs:79-85, server/protocol/decode.rs:71, contract.rs:461, plus tests — plus the validate_value bit check (contract.rs:466) and the equivalent 0.0 if narrowed == 0.0 else narrowed lines in both Python copies (contract.py:27, scheduler.py:65, scheduler.py:248). All of it exists to make -0.0 and +0.0 hash differently as prefix roots, which they should not: the model computes identically for both, so the canonicalization only fragments the cache for a value nobody can distinguish. Dropping it removes the helper, its five call sites, the bit check, the /v1/models re-canonicalization, the -0.0 assertion in server/models.rs:369-374, and the Python null-coalescing lines. The PR's own "canonicalizes -0.0 to +0.0" claim is a self-imposed invariant, not a charter or API requirement.

5. Should fix — packing.rs re-validates what contract.rs already rejected at load (~12 lines)

helios/src/model/packing.rs duplicates at pack time checks that PreparedContract::validate already enforced on the same manifest (it runs first, packing.rs:67, and again via catalog.rs:31 → contract.rs:551):

Smaller version: delete the arm at :139-145 (falls through to _ => matches!(indexing, SubmissionRow | RequestRow | ActiveRow)) and drop CoreParameter from the dtype group at :236-239, restoring SamplingParameters | ImageTensor | PageTable as it was. An unloadable core never reaches Inputs::new.

6. Nit — pass-through wrappers, six error strings for one condition, docs that repeat each other (~25 lines)


Explicitly checked and found justified (no subtraction)

Open questions

What could not be checked