#1 [high] Should fix: duplicate core-parameter copies and bit-equality guard (~55 lines)
Both copies come from the same source and cannot diverge, so one copy plus the guard can go.
Sources of the same value:
- helios/src/server/runtime.rs:1459 and :1477 pass
&incoming.prompt.core_parameterstoadmit_with_host_store/admit_with_checkpoint_accounting; runtime.rs:1545-1550 buildsAdmission::from_prompt(self.config, handle, &incoming.prompt, ..)(admission.rs:118 doescore_parameters: prompt.core_parameters.clone()). - So
LiveRequest.core_parameters(scheduler.rs:268, set at :1827 from the plan whose value is scheduler.rs:1578core_parameters.clone()of the same map) andAdmission.core_parameters(admission.rs:62) hold the identical map for a given request.
What goes:
Admission.core_parametersfield (admission.rs:62) and itsconfig.contract.validate_core_parameters(&self.core_parameters)?(admission.rs:74-76): the values were already resolved and range-checked byPreparedContract::resolve_core_parametersat the HTTP boundary (server/request.rs:333-335) before the Prompt existed, and validated again inplan_admission_with_core_parameters(scheduler.rs:1548-1552).- The 14
core_parameters: Default::default(),fixture lines this change added in 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, prompt_tests.rs:53 — they exist only to fill the new field. - The pack-time cross-check in packing.rs:588-597 (
planned+value.to_bits() != planned.to_bits()+ error), which compares the two copies, plusLiveRequest::core_parameters()if packing reads the plan copy instead.
Smaller version: packing.rs:582-587 reads the value from one place only:
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 resolved map is immutable after admission, so a mismatch between two clones of it is unreachable; the prefix hash already used the same bits (scheduler.rs:1560-1566).
Lines: ~2 + 3 + 15 fixtures + 12 guard + 4 accessor ≈ 36-55 depending on whether the accessor stays.
#2 [high] Should fix: is_text_forward_graph duplicates GraphKind::samples (~14 lines)
helios/src/model/contract.rs:424-435 adds
pub(crate) fn is_text_forward_graph(kind: GraphKind) -> bool {
matches!(kind, GraphKind::Prefill | GraphKind::TerminalPrefill | GraphKind::ScoredPrefill
| GraphKind::Resume | GraphKind::Decode | GraphKind::Speculative | GraphKind::Mixed)
}
helios/src/execution/manifest.rs:89-100 already has GraphKind::samples() with the identical set (Prefill, TerminalPrefill, ScoredPrefill, Decode, Speculative, Mixed, Resume) and it is already the vocabulary used elsewhere for "this graph runs a forward that samples" (manifest.rs:940, transport.rs:1537/1552, server/runtime.rs:2969, model/testing.rs:171).
Replace both call sites (contract.rs:665, packing.rs:140) with descriptor.kind.samples() / graph.kind.samples() and delete the helper. Saves 12-14 lines, and removes a second list that must be kept in sync with samples(). Also delete the duplicated seven-kind matches! in the new test helper helios/src/model/tests.rs:59-77 and phase_tests.rs:6637-6652 by using kind.samples() there too (~+12 lines).
#7 [high] Overall assessment and what is justified
The change touches 32 files, +2393/-261 (orientation packet). Roughly +1,530 of that is Rust and Python product code, +760 tests, and +45 docs. Nothing in this repository binds a core parameter (PR description: "No model recipe in this repository binds a core parameter (official recipes live in local-inference-lab/hyperflare-recipes)"), and the GPU path was never run on this head ("Live GPU export and serving of a core declaring core_parameters were not run").
Verdict against the charter: this is a new captured-graph op contract (CORE_PARAMETER = 43 changes ValueSource, shared by every core) and the charter says such an addition "requires owner approval before you write it" (Charter, Standards & Contributions: "Captured-graph op contracts: Adding a new one—even if it reuses an existing graph kind—requires owner approval"). Luke's comment on #404 (2026-11-21) is the request that motivated it ("implement this not as a hardcoded steering_scale parameter, but as a generic system by which model cores can expose scalar arguments"), so the direction is sanctioned; the size is not, and the same #404 review demanded the shared-path cost be kept small.
Checked and found justified (no subtraction):
PrefixHistory::with_core_parameterskeepingnewas a thin delegate (hash.rs:37-65) preserves the exact old root for declaration-free cores — needed for existing cores to keep their hashes.AdmissionPlan.core_parameterssurvivingrefresh_admission_plan(scheduler.rs:1584-1590) is required by the preemption/readmission path.Inputs::core_parameterspre-allocation (packing.rs:286-307, :543-549) is the stated zero-steady-state-allocation claim.- The protobuf fields,
ValueSource::CORE_PARAMETER,ValueBinding.parameterare the minimum wire surface for the feature. - Ignition
contract.pycore_parameter()/binding(parameter=)/model_contract(core_parameters=)are the recipe-facing API and are minimal.
Total available subtraction: ~150-330 lines, dominated by the Python direct-path validator reimplementation.
#8 [high] Research summary
Reviewed PR #505 (Bind core-declared FP32 parameters into text forward graphs, +2393/-261, 32 files) through a subtraction lens. The direction is sanctioned — Luke's #404 comment asked for exactly this generic mechanism — and the core wire additions (CoreParameter, ValueSource::CORE_PARAMETER, ValueBinding.parameter, the recipe-facing contract.py helpers) are minimal and necessary. What is not minimal is the amount of duplicated validation and duplicated copies of the same resolved value.
Six findings recorded, ranked by size:
ignition/direct/scheduler.py:131-185(~90-200 lines) re-implements, in Python, the entire load-time core-parameter contract validation (distinct names, finite defaults, ranges, per-graph completeness, maintenance-graph rejection, indexing/offset/padding/tensor/dtype/row-count/contiguity). All of it already runs inhelios/src/model/contract.rs:473-482,665-728when the core is loaded, on the same prepared model objectignition/directserves.Admission.core_parametersplus the pack-time bit-equality guard (helios/src/model/admission.rs:62,74-76; helios/src/model/packing.rs:588-597; ~36-55 lines) — the field is a second clone of the same map thatLiveRequest.core_parametersholds, and the guard compares two clones that cannot diverge.is_text_forward_graph(helios/src/model/contract.rs:424-435; ~14 lines, +12 in tests) duplicatesGraphKind::samples()(helios/src/execution/manifest.rs:89-100), which lists exactly the same seven kinds and is already the shared vocabulary.- The same FP32 wire validation written four times (
ignition/preparation/contract.py:12-28,ignition/direct/scheduler.py:50-65,helios/src/server/protocol/decode.rs:49-75,helios/src/model/contract.rs:453-462), plus-0.0canonicalization threaded through five call sites for an invariant the charter does not ask for (~20-40 lines). helios/src/model/packing.rs:139-145,236-245,540-603re-checks dtype, indexing and buffer extent thatcontract.rsalready rejected at load (~12 lines).- Nits (~25 lines): pass-through wrappers, six different error strings for the same overflow condition, and 17 lines of
docs/api.mdrestatinghelios/model-contract.md.
Nothing was found that the change makes dead elsewhere. I explicitly checked and found justified: keeping PrefixHistory::new as a delegate to preserve the old root hash, AdmissionPlan.core_parameters surviving refresh_admission_plan, and the Inputs::core_parameters pre-allocation.
#9 [high] Diff accounting and smaller-version snippets for the report
Change size: 32 files, +2393/-261.
Product code added (~1,530 of it is Rust+Python, product code):
- helios/src: 21 files, +1534/-60
- ignition/preparation: 2 files, +231/-182 (≈200 of the -182/+231 is the regenerated
runtime_core_pb2.py; handwritten iscontract.py+≈90/-10) - tests/direct/test_scheduler.py: +273/-0 (sole new test file)
- ignition/direct: 3 files, +204/-14 (packing.py +1, scheduler.py +≈105, server.py +40, test-file aside)
- heliopause/src/export/binding.rs: +76/-1 (≈72 of it the new test)
- docs: api.md +18, direct-execution.md +12, helios/model-contract.md +30
- helios/proto/runtime_core.proto: +15
Where the Rust test bulk sits: helios/src/model/tests.rs ≈+460 (of which the two new tests ≈+390), server/runtime/phase_tests.rs ≈+225, runtime_core/protobuf.rs ≈+100, model/contract/kani_proofs.rs +60, cache/tests.rs +31, server/models.rs +31, server/protocol/decode.rs +44. The 15 one-line core_parameters: Default::default(), fixture lines are spread across model/tests.rs, packed_round_tests.rs, server/runtime.rs, phase_tests.rs, prompt_tests.rs.
Smaller version for finding 2 (packing.rs:582-597 collapses to):
if binding.source == ValueSource::CoreParameter {
let value = live.core_parameters().get(&binding.parameter).copied()
.ok_or("core-parameter admission is incomplete")?;
... write value ...
}
i.e. drop admission.core_parameters entirely and read the plan copy on LiveRequest.
Smaller version for finding 3: replace is_text_forward_graph(graph.kind) at contract.rs:665 and packing.rs:140 with graph.kind.samples() / descriptor.kind.samples(), delete contract.rs:424-435, and use kind.samples() in the two new test helpers (model/tests.rs:59-77, phase_tests.rs:6637-6652).
Smaller version for finding 5: delete the CoreParameter => { is_text_forward_graph(..) && matches!(indexing, SubmissionRow|RequestRow|ActiveRow) } arm at packing.rs:139-145 — the fallback arm _ => matches!(indexing, SubmissionRow | RequestRow | ActiveRow) already states the rule — and drop CoreParameter from the dtype group at packing.rs:236-239, restoring that group to SamplingParameters | ImageTensor | PageTable as it was before the change.
#3 [medium] Should fix: same FP32 wire validation written four times (~20-40 lines)
The change implements the same FP32 wire validation three times (twice in Python, once in Rust) plus a fourth canonicalization in Python direct:
- ignition/preparation/contract.py:12-28
_FP32_MAX+_wire_fp32(value, label)(17 lines) - ignition/direct/scheduler.py:50-65
_FP32_MAX+_wire_fp32(value)(16 lines) — the body is the same modulo the label andnp.float32vs struct pack/unpack - helios/src/model/contract.rs:453-462
resolve_value/ decode.rs:49-75core_parameter_map(27 lines of decode-side narrowing) canonical_core_parameter(contract.rs:420-422) is triviallyif value == 0. { 0. } else { value }and is called from 5 places (hash.rs:49, models.rs:79/80/85, decode.rs:71, tests) purely so-0.0becomes+0.0.
Smaller version: one helper in ignition/preparation/contract.py imported by ignition/direct/scheduler.py, and in Rust one fn fp32(value: f64) -> Option<f32> next to canonical_core_parameter:
fn canonical(value: f32) -> f32 { if value == 0. { 0. } else { value } }
with resolve_value calling it and the decode map reusing resolve_value-style narrowing instead of its own copy. Saves ~20-30 lines and one whole duplicated float validator.
Also: the -0.0 canonicalization buys nothing observable. -0.0 == 0.0 and (-0.0f32).clamp(0.0, 1.0) returns -0.0, but hashing -0.0 and +0.0 as different prefix roots would only split cache entries for values the model computes identically. If canonicalization is dropped, canonical_core_parameter, its 5 call sites, the validate_value bit check (contract.rs:466), the /v1/models re-canonicalization (models.rs:79-85), the -0.0 test in models.rs:369-374, and the Python 0.0 if narrowed == 0.0 else narrowed lines all go (~40 lines). The stated behaviour "canonicalizes -0.0 to +0.0" is a self-imposed invariant, not something the charter requires.
#4 [medium] Should fix: packing.rs re-validates what contract.rs already enforced (~12 lines)
helios/src/model/packing.rs duplicates, at runtime, checks the load-time contract validator already made:
- packing.rs:139-145
CoreParameter => is_text_forward_graph(..) && matches!(indexing, SubmissionRow|RequestRow|ActiveRow)— contract.rs:697-719 already rejects any other kind/indexing at load (config.contract.validate(manifest)runs first at packing.rs:67, twice: also catalog.rs:31 → contract.rs:551). - packing.rs:236-245 the
buffer.dtype != Dtype::Float32clause forCoreParameter— contract.rs:704 already enforces Float32. - packing.rs:598-603 the
destination + 1 > input.elementsextent check, and packing.rs:540-542'selements > input.elements— contract.rs:706 (buffer.shape[0] < manifest.request_capacity()) already guarantees the buffer covers request capacity.
Smaller version: drop the CoreParameter arm from the valid_indexing match (falls through to the existing _ => matches!(indexing, SubmissionRow | RequestRow | ActiveRow), which is already the right rule) and the CoreParameter clause from the dtype check; the grouping becomes SamplingParameters | ImageTensor | PageTable again as before. Saves ~12 lines. Loss: none — an unloadable core never reaches Inputs::new.
#5 [medium] Should fix: ignition/direct re-implements contract validation already done in Rust (~90-200 lines)
The Python direct path re-implements the whole load-time contract validation in Layout.__post_init__ (ignition/direct/scheduler.py:131-185, 55 lines), covering: distinct named parameters, finite defaults, range keys {"min","max"}, range containing the default, every text forward graph binding every declared parameter, no bindings on maintenance graphs, indexing in {SUBMISSION_ROW, REQUEST_ROW, ACTIVE_ROW}, zero value_offset/padding, empty tensor, FP32 dtype, row count >= capacity, contiguity.
Every one of those rules already exists in helios/src/model/contract.rs:473-482 + :665-728 and is applied when the core is loaded/exported (serving_contract → PreparedContract::validate). ignition/direct serves the same prepared model object (ignition/preparation/model.py:24-36 copies the already-validated contract into server_config), and _validate_resources (ignition/preparation/graphs.py:125-181) already asserts buffer contiguity for every registered buffer. So the only new thing needed for direct execution is the packing case in packing.py:84 and the request-side resolution in scheduler.py:227-249.
Smaller version: keep _wire_fp32, resolve_core_parameters, core_parameter_identity, and drop the contract re-validation block (scheduler.py:131-185) and its buffer_contiguity field/_row_contiguous/_core_parameter_rows helpers (scheduler.py:68-81, :117-118, :213-216). Saves ~90 lines in scheduler.py plus ~110 of the tests that only exercise those rejections (tests/direct/test_scheduler.py:726-800 _core_parameter_layout knobs, :840-847, :910-940).
Caveat to state: ignition/direct can be pointed at a core produced by an older/other exporter, so if the maintainers want the Python path independently defensive this stays; but helios validates the same contract before Inputs is built (packing.rs:67), and the direct path is documented as diagnostic-only (docs/direct-execution.md:409 in the printed banner "not production serving").
#6 [low] Nit: small wrappers, duplicated error strings and docs (~25 lines)
- helios/src/model/contract.rs:508-512
PreparedContract::core_parameter(name)— a 5-line linear search used in two places that could use the same iterator inline; keep only ifresolve_core_parametersand validate share it. Minor (3 lines). - contract.rs:534-536
validate_core_parameters(&self, values)is a one-line wrapper over the free functionvalidate_resolved_core_parameters(contract.rs:484-498); called from two sites in admission.rs (:76, :139). Both admission sites also re-check whatplan_admission_with_core_parameters(scheduler.rs:1548) checks again. Deleting the admission.rs calls (entry 1) also removes the wrapper: ~6 lines. - helios/src/runtime_core/mod.rs:46-48
pub fn validate_core_parametersis a pass-through toprotobuf::validate_core_parameterswith one external caller (heliopause/src/export/binding.rs:1045). The wrapper exists only becauseprotobufis private. Nit (3 lines); cannot be removed without making the module function public. - errors in packing.rs are now 9 distinct new messages ("submission-row input extent overflow", "packed values exceed prepared input storage" ×3, "packed token offset overflow", "packed input offset overflow", "core-parameter admission is incomplete", "core-parameter admission plan is incomplete", "packed core parameter differs from its prefix-history value", "packed input byte offset overflow", "floating-point source requires a float32 input buffer", "packed values exceed core-parameter staging storage"). Six of them are the same condition (
checked_addoverflow / out of range) with different text; a single"packed values exceed prepared input storage"covers all: ~6 lines. - docs: docs/api.md:749-765 (17 lines) and helios/model-contract.md:110-131 overlap almost verbatim on CORE_PARAMETER shape/indexing/defaults/clamping; model-contract.md is the contract reference, api.md needs only the HTTP-facing sentence. ~8 lines.