Simplicity report · NVIDIA/hyperflare-inference #505

Raw Markdown for agents: https://autobot.eidonix.com/p/a8dbc5ad-c1f0-4c64-bee9-1c827c65c74c.md

PR #505 "Bind core-declared FP32 parameters into text forward graphs" — review lens D (simplicity)

Rules cited throughout: the project charter ("Keep the runtime small and model-agnostic", "Solve the right problem in the right place … look for the smallest footprint"), AGENTS.md ("Reject unsupported abstractions and churn", "Reject scope expansion"), and docs/design-review.md principle 1 ("Keep Helios as simple as possible"). Read the full charter with read_charter.

Key findings

The mechanism itself is the small version of the problem: a generic, model-agnostic core_parameters declaration on ModelContract, no per-model branches, no capability flag, and the validation sits in shared runtime code rather than in a recipe (contract.rs:437-500, 690-735). Nothing here expands Helios's scope beyond what the charter allows, and no model-specific policy leaked in. No blocking findings.

What a smaller version deletes is plumbing:

  1. Should fix — a second admission entry point that cannot express declared parameters, plus nine hand-threaded &self.config.contract.core_parameters arguments (scheduler.rs:1519-1528, server/runtime.rs).
  2. Should fix — _wire_fp32 written twice in Python, two implementations of the same FP32 narrowing rule (contract.py:12-27, ignition/direct/scheduler.py:50-65). 3-7. Nits — a dead tokens parameter and a duplicated cache-key shape, a property pair, a graph-kind set written five times, an unreachable extent check, and two intermediate structures that only add a serialization hop or a quadratic scan.

Should fix

1. Two admission entry points; the declaration-free one is test-only, and the declaration list is threaded by hand at every call site

helios/src/scheduler.rs:1519-1528

pub fn admit(&mut self, spec: RequestSpec) -> Result<RequestHandle> {
    let plan = self.plan_admission(&spec)?;
    ...
}
pub fn plan_admission(&mut self, spec: &RequestSpec) -> Result<AdmissionPlan> {
    self.plan_admission_with_core_parameters(spec, &[], &Default::default())
}

Why it matters. The declarations are static model-core configuration — the same kind of data as identity and limits, both of which RequestScheduler::new already takes (scheduler.rs:705-709). Because they are not stored on the scheduler, every production call site has to pass them: helios/src/server/runtime.rs:1242, 1383, 1432, 1458, 1476, 2755, 2781, 2806, and again through admit_with_checkpoint_accounting/admit_with_host_store parameters (runtime.rs:2741, 2777, 2796) that exist for no other reason. That is eight threaded arguments and two extra function parameters for a value the scheduler could hold once.

The result is a second admission route that is only correct for declaration-free cores. plan_admission and admit are now unreachable from production code — a search of helios/src for .admit( finds only test modules (model/tests.rs, scheduler/*_tests.rs (not opened), model/packed_round_tests.rs (not opened)); the server path uses admit_planned/admit_with_* — so the unsalted path survives purely for the ~100 test call sites. A future caller can pick it by accident and silently get an unsalted prefix hash (the exact failure the PR exists to prevent), because nothing in the signature says "declaration-free only".

Smaller version. Add one field to RequestScheduler (core_parameters: Vec<CoreParameter>, set in new, validated there next to limits.validate_prefill()), keep a single plan_admission(&mut self, spec: &RequestSpec, core_parameters: &CoreParameters) and use self.core_parameters inside for both the declaration list (scheduler.rs:1560-1566) and the resolved-value check (scheduler.rs:1548-1552). Delete plan_admission_with_core_parameters's first parameter, delete the declaration-free wrapper, and delete the core_parameter_defs parameters from begin_pool_lookup, admit_with_checkpoint_accounting and admit_with_host_store. Tests keep calling plan_admission(&spec, &Default::default()).

2. _wire_fp32 and _FP32_MAX are implemented twice, in two styles, in the same package tree

ignition/preparation/contract.py:12-27 and ignition/direct/scheduler.py:50-65

# contract.py
_FP32_MAX = 3.4028234663852886e38
...
narrowed = struct.unpack("<f", struct.pack("<f", wide))[0]

# ignition/direct/scheduler.py
_FP32_MAX = float(np.finfo(np.float32).max)
...
narrowed = float(np.float32(wide))

Both reject bool, both wrap conversion errors, both check abs(wide) > FP32_MAX, both reject nonzero underflow to zero, both canonicalize -0.0 to +0.0. They even agree on the same three error distinctions (type/range/underflow) — except that contract.py's version carries a label for the message and scheduler.py's raises bare ValueError, so the two surfaces already differ in wording.

Why it matters. Two copies of a numeric-boundary rule drift: struct.pack and numpy's cast are not required to agree forever (numpy emits a warning and, under np.errstate/-W error, can raise on overflow where struct silently produces inf, which the code then has to catch). A change to the accepted range has to be made twice, and tests/direct exercises only the direct copy.

Smaller version. ignition/direct/scheduler.py:43 already imports from ignition.preparation import runtime_core_pb2 as wire — importing from ignition.preparation.contract import _wire_fp32 as _wire_fp32 (or promoting the helper to a shared private module) is one line; delete scheduler.py:50-65 and its _FP32_MAX. If a dependency-free direct path is a requirement, the reverse applies: keep only the struct implementation, which has no numpy dependency.

The Rust restatement of the same rule at helios/src/server/protocol/decode.rs:49-71 versus helios/src/model/contract.rs:453-462 I am not raising: those are two sides of a process boundary (HTTP decoding versus core-load validation) and each has to be independently correct.


Nits

3. _cache_key's tokens parameter is dead, and the cache key is built in two shapes

ignition/direct/scheduler.py:881-885

def _cache_key(self, request, tokens=None):
    tokens = tuple(request.prompt if tokens is None else tokens)

Only two call sites exist — scheduler.py:608 and scheduler.py:891 — and neither passes tokens, so the branch is unreachable. Meanwhile Checkpoint.cache_key (scheduler.py:418-424) reproduces the same two-shape rule (tokens alone, or (identity, tokens)), and the two must stay in agreement by hand for self.cache insertions/lookups to line up (scheduler.py:608, 891, 919). Delete the parameter, and build both keys with one function taking (parameters, tokens).

4. A property pair whose only purpose is a MappingProxyType swap

ignition/direct/scheduler.py:445-447, assigned at scheduler.py:544

Request.core_parameters returns _core_parameters, and validate writes request._core_parameters = MappingProxyType(...) from outside the class. One public attribute self.core_parameters, assigned in validate (or a small set_core_parameters method if immutability must be enforced), does the same thing with no property pair and no private/public aliasing.

5. The text-forward graph-kind set is written out five times

The Python copy is defensible (separate language), but the last two are near-verbatim copies (~35 lines) of one setup helper inside the same crate. helios/src/model/testing.rs already hosts binding/metadata fixtures; move one builder there and delete the other. (I re-verified the two helper signatures and their locations; the body-level near-equality is from my earlier pass over both files.)

6. An extent check that the constructor has already made unreachable

helios/src/model/packing.rs:540

let elements = frame.config.limits.request_capacity()
    .checked_mul(input.width)
    .ok_or("submission-row input extent overflow")?;
if elements > input.elements {
    return Err("packed values exceed prepared input storage".into());
}

Inputs::new already rejects any row-indexed binding whose storage cannot cover the prepared request slots (packing.rs:153-161: request_capacity().checked_mul(width).is_none_or(|required| elements < required) → error). So for every binding that reaches line 540, input.elements >= request_capacity * width, and elements > input.elements is false. The same bound is then checked a third time per write in write_floats (packing.rs:954-958) for the ActiveRow/RequestRow path. One check at the extent computation (line 534-539, which already computes the number) is enough. The per-write checked_add guards added with the checked_mul hardening pass are reasonable and should stay; this is only about the duplicated extent comparison.

7. Two intermediate structures that only add a hop


Checked and dropped (so this is not re-litigated by another lens)

Open questions / what I could not settle from the code