Correctness report · NVIDIA/hyperflare-inference #505

Raw Markdown for agents: https://autobot.eidonix.com/p/69553c14-d95b-48fb-9f1f-3edc430480b0.md

Review of PR #505 — Bind core-declared FP32 parameters into text forward graphs (correctness lens)

Key findings

The wire format, contract validation, prefix hashing, and packing work are internally consistent: I could not find a path that produces a wrong value, a wrong prefix-cache identity, or a bad row layout for cores that declare core parameters. Two gaps remain where validation is claimed "shared" but is not actually reached on every path:

  1. Should fix — RequestScheduler::plan_admission passes empty declarations, so admission of a declaring core through admit/admit_planned succeeds with no parameters and fails only at packing on every forward launch.
  2. Should fix — Heliopause export validates only the declarations, not the bindings, so a recipe can export successfully with an invalid core-parameter binding and fail only when the core is loaded.

Three nits follow (misleading errors, a null in /v1/models). Nothing here blocks the design; the two "should fix" items are about failing early and where the description says validation happens.


Should fix

1. Declaration-free admission silently bypasses core-parameter validation

helios/src/scheduler.rs:1526-1528:

pub fn plan_admission(&mut self, spec: &RequestSpec) -> Result<AdmissionPlan> {
    self.plan_admission_with_core_parameters(spec, &[], &Default::default())
}

validate_resolved_core_parameters (helios/src/model/contract.rs:484-497) rejects only when values.len() != parameters.len() or a value fails validate_value; with both collections empty it returns Ok(()). Consequently, on a core whose contract does declare parameters:

The failure surfaces only during execution, on every forward launch, at helios/src/model/packing.rs:588-592:

let planned = live.core_parameters().get(&binding.parameter).copied()
    .ok_or("core-parameter admission plan is incomplete")?;

Why it matters: docs/design-review.md principle 2 requires admission to reserve resources and reject unsupported configurations explicitly, and AGENTS.md forbids silently substituting execution paths / weakening guarantees. The PR description presents validation as shared and load-time-consistent; the declaration-free admission entry point is the one callers use by default (all scheduler tests and the boundary/policy tests go through it, e.g. helios/src/scheduler/tests.rs:2711 (not opened), helios/src/scheduler/policy_tests.rs:3056 (not opened)), so an embedder that keeps using admit gets a request that is accepted, occupies a slot, and then dies in the step loop instead of getting one clear 4xx/AdmissionError::Invalid.

Fix: carry the model's declarations into the scheduler (e.g. on SchedulerLimits/ModelConfig alongside scored_prefill_catalog) and always validate them, or make plan_admission return AdmissionError::Invalid when declarations exist and none were supplied.

Would be settled by: a test fixture with a declaring core that admits via scheduler.admit(...) and asserts Err (currently Ok, error later at pack_step).

2. Export-time validation covers declarations but not bindings

heliopause/src/export/binding.rs:1044-1047:

let contract: super::wire::ServingContract = message("ServingContract", &server.into())?;
if let Some(model_contract) = contract.model_contract.as_ref() {
    helios_core::runtime_core::validate_core_parameters(model_contract)?;
}

runtime_core::validate_core_parameters (helios/src/runtime_core/protobuf.rs:54-73) only parses name/default_value/range and calls validate_core_parameter_declarations (contract.rs:473-482) — names, finiteness, and min <= default <= max. The binding invariants this PR introduces — text-forward-only sources (packing.rs:139-145), required width-one FP32 buffer covering request capacity, SubmissionRow|RequestRow|ActiveRow indexing (packing.rs:153-161), zero value_offset (packing.rs:162-168), zero padding, empty tensor, and "every declared parameter bound in every selected text forward graph + at least one text forward graph selected" — live in PreparedContract::validate (helios/src/model/contract.rs:693-728) and in the packing-side validation reached at helios/src/model/packing.rs:67 via catalog::validate (helios/src/model/catalog.rs:31).

Because ExportRequest.input_bindings carry only buffer_name/host_offset/nbytes (heliopause/src/python.rs:206-240), the export path structurally cannot run those checks; the only contract validator exposed to the export side is validate_prepared_contract (heliopause/src/python.rs:161-169), which is behind the qualification feature and, from what I could search, has no Python caller (only export_serving is called, ignition/preparation/core_proto.py:12 (not opened)).

Result: a recipe can produce a core archive whose PreparedContract violates the new rules (e.g. a CORE_PARAMETER binding in a VISION graph, or a declared parameter bound in only one of two selected prefill graphs) and the export succeeds. It fails only at load (Bootstrap::load → catalog::validate) or at Inputs::new, contradicting the description's "Validate core-parameter declarations both on core load … and during Heliopause export". A rejected-at-export error is far cheaper than a rejected multi-GB artifact.

Fix: run PreparedContract::validate (or a shared binding-only validator extracted from it) from serving_metadata, or make export_serving require the prepared contract JSON and validate it.

Would be settled by: an export test with a CORE_PARAMETER binding placed on a non-text-forward graph — expected Err from export today; Ok until load.


Nits

3. Mismatched-length error message reads as a contract mismatch

Admission::validate/validate_prompt route through validate_core_parameters (contract.rs:534 → validate_resolved_core_parameters), whose single error string is "core_parameters does not match the model core's resolved parameters" (contract.rs:495). An embedder that builds Admission { core_parameters: Default::default(), .. } for a declaring core gets that message, which suggests a model/runtime version skew rather than "this request did not supply required parameters". helios/src/model/admission.rs:74-76, 137-139. Fix: name the missing parameters in the error.

4. Offset guard reports the wrong reason for float sources

helios/src/model/packing.rs:162-168 now includes CoreParameter in the guard but keeps the message "value offset requires an integer value source" — wrong for CoreParameter, SamplingParameters, and ImageTensor, all of which are float sources. Anyone debugging a rejected recipe will be sent down the wrong path. Fix: generalize the message ("this value source does not support a nonzero value offset").

5. /v1/models emits "range": null for unbounded parameters

helios/src/server/models.rs:76-88 builds "range": range where range is Option<CoreParameterRange>, so an omitted range serializes as JSON null, while the serving metadata path deliberately strips nulls (runtime_core/protobuf.rs:87: retain(|_, v| !v.is_null())). Clients must handle both "absent" and "null"; docs/api.md (not opened) should state which is normative, or the field should be omitted.


Checked and found correct

Open questions / limits