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:
- Should fix — a second admission entry point that cannot express declared parameters, plus nine hand-threaded
&self.config.contract.core_parametersarguments (scheduler.rs:1519-1528, server/runtime.rs). - Should fix —
_wire_fp32written 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 deadtokensparameter 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
helios/src/model/contract.rs:424-435—is_text_forward_graph(the authoritative one).ignition/direct/scheduler.py:49—_TEXT_FORWARD_KINDS.tests/direct/test_scheduler.py— a localtext_forward = {...}for the mirror validation.helios/src/server/runtime/phase_tests.rs:6629—enable_core_parameter, a fixture that declares a parameter and binds it into every text forward graph.helios/src/model/tests.rs:59—bind_text_forward_core_parameters, the same fixture builder with a different name.
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
helios/src/server/models.rs:77-88: rebuilds a typedcrate::model::contract::CoreParameterRange(canonicalizing both bounds) only to hand it tojson!on line 86, right afterjson!already canonicalizesdefault. Inline it:"range": parameter.range.map(|r| json!({"min": canonical(r.min), "max": canonical(r.max)})), and drop the intermediate binding.helios/src/model/contract.rs:508-512:core_parameter()is a linear scan, called once per requested key inresolve_core_parameters(contract.rs:518-525) and once per core-parameter binding insidevalidate's graph loop (contract.rs:703). For a handful of parameters this is quadratic-but-tiny, yet the fix is smaller than the scan: collect aHashSet<&str>once besidevalidate_core_parameter_declarationsand check membership. Simpler to read and linear.
Checked and dropped (so this is not re-litigated by another lens)
- Multi-layer revalidation of resolved values —
plan_admission_with_core_parameters'svalidate_resolved_core_parameters(scheduler.rs:1548-1552) →Admission::validate/Prompt::validate(admission.rs:62-139) → thepack_stepbit-equality check (packing.rs:582-597). Looks redundant, but each layer guards a different construction path (scheduler-only tests, directAdmissionconstruction, plan-versus-admission divergence). Do not delete thepack_stepbit check — it is the only assertion that the value written to the device matches the one hashed into the prefix root. - Kani harness
core_parameter_validation_enforces_finite_ordered_bounds(contract/kani_proofs.rs:85-105) restatesvalidate()'s predicates verbatim as itsexpectedexpression, so it can only fail on a transcription error; the second harness (postcondition onresolve_value, lines 108-140) carries the real weight. Worth knowing when reading the "9 of 9 harnesses verified" claim; not worth deleting. - Tests: I read
model/tests.rs:87-352, 356-500,cache/tests.rs:127-156,server/runtime/phase_tests.rs:6628-6846,server/protocol/decode.rs:973-1013,server/models.rs:344-373,runtime_core/protobuf.rs:919-1013,heliopause/src/export/binding.rs:1568-1640,tests/direct/test_scheduler.py:724-995. They drive production entry points, not source text, and I found none that a same-shaped input would pass without the behaviour. The one weakness in this lens is #5: two of the copies are test fixtures, so consolidating them removes no coverage. - Docs (
docs/api.md+19,docs/direct-execution.md+11,helios/model-contract.md+30) are present-state prose with no changelog noise; volume is proportionate to a new wire field, so no prose finding in this lens.
Open questions / what I could not settle from the code
- Does the direct-execution mirror really need its own FP32 narrowing implementation? If
ignition/directis allowed to import fromignition.preparation.contract(it already importsruntime_core_pb2, scheduler.py:43), finding #2 collapses to a two-line change. If the direct path is deliberately standalone (nocontract.pydependency), then the duplication is a design choice and should be stated as such in a comment atscheduler.py:50. - Should
admit()/plan_admission(&spec)exist at all in the crate's public API? Only a test-usage search settles this (grep -rn "\.admit(" helios/srcreturns test modules only). If they are kept for ergonomic tests, marking them#[cfg(test)]-adjacent or documenting their declaration-free assumption would keep the production surface honest. - GPU-side behaviour (that the packed value actually reaches the kernel) is outside this lens; the PR itself flags live GPU export and serving of a declaring core as unrun, which no amount of code reading settles.