Skip to content

Bind core-declared FP32 parameters into text forward graphs - #505

Merged
lukealonso merged 1 commit into
NVIDIA:mainfrom
jcartu:pr/core-declared-graph-inputs
Nov 28, 2026
Merged

lukealonso merged 1 commit into
NVIDIA:mainfrom
jcartu:pr/core-declared-graph-inputs

Conversation

@jcartu

@jcartu jcartu commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Why

Captured CUDA graphs already receive per-request inputs such as token IDs, positions, and the six-column sampling parameters (SAMPLING_PARAMETERS), which are read only by post-logit sampling. Model recipes that condition forward computation on a client-supplied FP32 parameter (for example, serving requests at different conditioning strengths from a single loaded multi-rank core without swapping weights) cannot reuse the sampling layout without widening a contract shared by every core, and cannot isolate prefix-cache checkpoints without native scheduler support.

Because a recipe can use a core parameter to change hidden state during prefill and decode, the resolved value must participate in prefix-cache identity and be written consistently on every text forward launch. Declaring generic named FP32 core parameters in ModelContract keeps Helios free of model-specific policy or per-model capability flags while enforcing storage, validation, caching, and packing invariants in shared runtime code.

What Changed

Before this change, ModelContract had no declaration for generic per-request FP32 inputs, ValueSource ended at PROMPT_LOOKAHEAD_LENGTH (42), HTTP decoding had no core_parameters field, /v1/models did not advertise core parameters, and PrefixHistory hashed only the domain tag and core identity into its root. After this change:

  • Protobuf schema and preparation helpers (helios/proto/runtime_core.proto, ignition/preparation/runtime_core_pb2.py, ignition/preparation/contract.py):
    • Add ModelContract.core_parameters = 8 (CoreParameter with name, optional float default_value, and optional CoreParameterRange with optional float min/max), ValueSource::CORE_PARAMETER = 43, and ValueBinding.parameter = 7.
    • Keep ModelContract.version at 3; cores without core-parameter declarations encode and decode identically without re-export.
    • Add ignition.preparation.contract.core_parameter(...), binding(..., parameter=...), and model_contract(..., core_parameters=...) with finite-FP32 validation and -0.0 canonicalization.
    • Regenerate ignition/preparation/runtime_core_pb2.py with protoc 36.1 (gencode 7.36.1, verified clean under protobuf>=7.36.2,<8).
  • Load-time and export-time contract validation (helios/src/model/contract.rs, helios/src/runtime_core/{mod,protobuf}.rs, heliopause/src/export/binding.rs):
    • Validate core-parameter declarations both on core load (serving_contract / PreparedContract::validate) and during Heliopause export (serving_metadata via helios_core::runtime_core::validate_core_parameters): nonempty unique names, present finite default_value, and when range is present, present finite min <= default_value <= max.
    • Restrict CORE_PARAMETER bindings to text forward graphs (PREFILL, TERMINAL_PREFILL, SCORED_PREFILL, RESUME, DECODE, SPECULATIVE, and MIXED), rejecting VISION, INIT, RESTORE, and SNAPSHOT graphs at load time.
    • Require every selected text forward graph to bind every declared core parameter, and require at least one selected text forward graph when any core parameter is declared, so no forward launch can read stale slot storage.
    • Require each CORE_PARAMETER binding to target a contiguous width-one FP32 buffer covering prepared request capacity with SUBMISSION_ROW, ACTIVE_ROW, or REQUEST_ROW indexing, zero value_offset, zero padding, and empty tensor; reject nonempty parameter on every other ValueSource.
  • HTTP decoding, model discovery, admission, prefix hashing, and packing (helios/src/server/, helios/src/scheduler.rs, helios/src/cache/hash.rs, helios/src/model/{admission,packing}.rs):
    • Accept an optional top-level core_parameters JSON object across all four generation protocols (Chat, Completions, Responses, and Messages). Omitting core_parameters or passing null resolves all declared core parameters to their prepared defaults. Non-object values, empty or unknown names, booleans, non-numeric values, non-finite numbers, values with magnitude above f32::MAX, and nonzero values that underflow to FP32 zero return HTTP 400.
    • Resolve finite FP32 values by clamping to declared inclusive ranges (or accepting any finite FP32 value when range is omitted) and canonicalizing -0.0 to +0.0.
    • Advertise ordered core-parameter declarations under flare.core_parameters in /v1/models with canonicalized +0.0 values.
    • Extend PrefixHistory with PrefixHistory::with_core_parameters, hashing each declared core parameter in declaration order as (u64 len, name bytes, canonical FP32 bits) into the root hash while keeping the exact previous root hash (flare-prefix-root-v1\0 || identity) for cores with no declarations.
    • Keep RequestScheduler::plan_admission unchanged for declaration-free callers and add plan_admission_with_core_parameters, validating resolved values via shared validate_resolved_core_parameters, storing them on AdmissionPlan and LiveRequest across pool lookup retries, preemption, and readmission, and verifying exact bit equality in Inputs::pack_step.
    • Pre-allocate Inputs::core_parameters in Inputs::new for SubmissionRow core-parameter bindings (padding inactive rows with 0.0 without steady-state allocation) and guard offset/extent calculations with checked arithmetic.
  • Direct diagnostic execution and documentation (ignition/direct/{packing,scheduler,server}.py, docs/api.md, docs/direct-execution.md, helios/model-contract.md):
    • Mirror text-forward binding validation, top-level-only core_parameters parsing, /v1/models flare.core_parameters advertisement, FP32 row packing, immutable MappingProxyType request parameter maps, and checkpoint key isolation.
    • Document the wire contract, /v1/models metadata, request semantics, and direct-execution behavior.

Claimed Result

A model core can declare generic per-request FP32 core parameters bound into its text forward graphs with shared load-time and export-time validation, strict HTTP request validation, deterministic prefix-cache isolation, and zero steady-state packing allocation. Cores without declared core parameters keep their existing wire contract (ModelContract.version == 3), six-column SAMPLING_PARAMETERS layout, and prefix-cache root hashes.

No model recipe in this repository binds a core parameter (official recipes live in local-inference-lab/hyperflare-recipes). No throughput or output-quality improvement is claimed.

Supporting Evidence and Limitations

Executed on Linux x86_64 (CPU and formal verification) against this commit:

  • Python CPU tests:
    • tests/direct, tests/cli, tests/preparation/test_core_boundary.py: 218 passed, 2 skipped (CUDA-gated tests). Covers core_parameter helper and wire protobuf round-tripping (CORE_PARAMETER == 43), text-forward completeness and maintenance-graph rejection, SUBMISSION_ROW/ACTIVE_ROW/REQUEST_ROW packing, checkpoint isolation, top-level core_parameters validation, and destination contiguity checks.
  • Rust CPU tests (--locked --release, with FLARE_TEST_TEMPLATE_DIR populated via tests/frontend/prepare_templates.py):
    • flare-helios --features runtime-core,server --lib: 1,692 passed, 43 ignored, plus 1 unrelated pre-existing failure on origin/main (model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape, broken when #555 relaxed catalog::validate). Covers protobuf wire round-trip and missing-field rejection, contract validation (including VISION, INIT, RESTORE, SNAPSHOT rejection and missing-forward-graph rejection), SUBMISSION_ROW/ACTIVE_ROW/REQUEST_ROW packing, bit-mismatch rejection, PrefixHistory hash vectors, /v1/models metadata, all 4 HTTP protocols, pool lookup retry, and preemption/readmission with parameter-salted checkpoints.
    • flare-helios --features runtime-core,server --test '*': 61 passed, 0 failed, 37 ignored (checkpoint/snapshot-gated).
    • flare-heliopause: 209 passed, 0 failed, 5 ignored, including serving_metadata_round_trips_and_validates_core_parameters.
    • flare: 236 passed, 0 failed, 4 ignored (228 lib, 7 packed_canonical_download, 1 reference_workflows).
    • flare-cli: 224 passed, 0 failed, 3 ignored (24 integration tests across cache_commands, cli, inspect, unverified_payload, plus 200 bin unit tests; distribution::tests::source_waits_for_receiver_file_verification was skipped as an unrelated 130 s test failing on origin/main in this environment).
  • TLA+ models and Rust lifecycle conformance (verification/helios-lifecycle/check.py, TLC 2.19):
    • All 9 TLA+ models, model mutations, Rust source mutations, and observed Rust transition replays passed (1,342 Lifecycle, 1,291 RankProtocol, 7,940 DispatchRing, 8,490 OffloadTransfer, 195,492 CacheOwnership, 13,566 Speculation, 365,508 ResponseLifecycle, and 31 CheckpointReservation transitions).
  • Kani formal proofs (cargo kani --manifest-path helios/Cargo.toml --lib, Kani 0.68.0 / CBMC 6.11.0):
    • 9 of 9 harnesses verified, 0 failures, including two proofs over arbitrary f32 values: model::contract::kani_proofs::core_parameter_validation_enforces_finite_ordered_bounds and model::contract::kani_proofs::core_parameter_resolution_produces_valid_canonical_value.
  • Unrun checks / limitations:
    • Live GPU export and serving of a core declaring core_parameters were not run on this rebased commit in this CPU verification environment; GPU end-to-end qualification remains to be executed with a declaring recipe.

Discord: jcartu

@jcartu
jcartu force-pushed the pr/core-declared-graph-inputs branch 7 times, most recently from d8b3d22 to 8bf2284 Compare November 25, 2026 03:50
@lukealonso
lukealonso force-pushed the pr/core-declared-graph-inputs branch from 8bf2284 to 7374e22 Compare November 28, 2026 22:41
@lukealonso lukealonso changed the title Bind core-declared FP32 graph inputs per request Bind core-declared FP32 scalar arguments into text forward graphs Nov 28, 2026
@lukealonso
lukealonso marked this pull request as ready for review November 28, 2026 22:52
Captured CUDA graphs already receive per-request inputs such as token IDs,
positions, and the six-column sampling parameters, which are consumed only by
post-logit sampling. Model recipes that condition forward computation on a
client-supplied FP32 parameter cannot reuse the sampling layout without widening
a contract shared by every core, and cannot isolate prefix-cache checkpoints by
the conditioning value without native scheduler support. Declaring named FP32
core parameters in the model contract lets a single loaded core serve requests
with different conditioning values without model-specific native policy or
per-model flags.

This change extends the runtime core contract, Helios runtime, Heliopause
exporter, and Ignition preparation and direct-execution paths additively:

- Schema and helpers (`helios/proto/runtime_core.proto`,
  `ignition/preparation/runtime_core_pb2.py`,
  `ignition/preparation/contract.py`): add `ModelContract.core_parameters = 8`,
  `CoreParameter`, `CoreParameterRange`, `ValueSource::CORE_PARAMETER = 43`,
  and `ValueBinding.parameter = 7`, keeping `ModelContract.version` at 3 and
  leaving existing cores without declarations unchanged.
- Contract and export validation (`helios/src/model/contract.rs`,
  `helios/src/runtime_core/protobuf.rs`, `heliopause/src/export/binding.rs`):
  validate unique nonempty names, required finite FP32 defaults, ordered finite
  ranges containing their defaults, contiguous width-one FP32 destination
  buffers covering prepared request capacity, zero offset and padding, and an
  empty `tensor` field. Restrict `CORE_PARAMETER` bindings to text forward
  graphs (`PREFILL`, `TERMINAL_PREFILL`, `SCORED_PREFILL`, `RESUME`, `DECODE`,
  `SPECULATIVE`, and `MIXED`), rejecting `VISION`, `INIT`, `RESTORE`, and
  `SNAPSHOT` graphs, and require every selected text forward graph to bind every
  declared core parameter so no forward step can read stale slot storage.
- HTTP decoding, discovery, admission, prefix hashing, and packing
  (`helios/src/server/`, `helios/src/scheduler.rs`, `helios/src/cache/hash.rs`,
  `helios/src/model/{admission,packing}.rs`): accept an optional top-level
  `core_parameters` object on Chat, Completions, Responses, and Messages
  requests (treating omitted or `null` as prepared defaults, rejecting unknown
  names, non-objects, booleans, non-numbers, non-finite values, magnitudes
  above `f32::MAX`, and nonzero underflow to FP32 zero with HTTP 400), clamp
  finite values to declared inclusive ranges, canonicalize `-0.0` to `+0.0`,
  advertise declarations under `flare.core_parameters` in `/v1/models`, hash
  every declared core parameter in declaration order into the prefix-history
  root (leaving the root hash unchanged when no core parameters are declared),
  retain the resolved map in `AdmissionPlan` across pool lookup retries and
  preemption/readmission, verify exact bit equality against the planned value
  during step packing, and pre-allocate staging storage in `Inputs::new` with
  checked offset and extent arithmetic.
- Direct diagnostic execution and documentation (`ignition/direct/`,
  `docs/api.md`, `docs/direct-execution.md`, `helios/model-contract.md`):
  mirror the same text-forward binding rules, top-level-only `core_parameters`
  decoding, `/v1/models` metadata, packing, immutable request parameter map,
  and checkpoint isolation.

Claimed result: a model core can declare generic per-request FP32 core
parameters consumed by text forward graphs with shared admission validation,
prefix-cache isolation, and zero steady-state packing allocation, while cores
without declarations retain their wire contract and prefix-cache hashes. No
recipe in this repository binds a core parameter, and no throughput or
output-quality improvement is claimed.

Supporting evidence and limitations:
- Python CPU tests (`tests/direct`, `tests/cli`,
  `tests/preparation/test_core_boundary.py`): 218 passed, 2 CUDA-gated skipped.
- Rust CPU tests (`--locked --release`): `flare-helios --features
  runtime-core,server --lib` 1,692 passed, 43 ignored, 1 unrelated pre-existing
  `origin/main` failure (`packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape`);
  `flare-helios --test '*'` 61 passed, 37 ignored; `flare-heliopause` 209
  passed, 5 ignored (including `serving_metadata_round_trips_and_validates_core_parameters`);
  `flare` 236 passed, 4 ignored; `flare-cli` 224 passed, 3 ignored
  (`distribution::tests::source_waits_for_receiver_file_verification` skipped as
  a pre-existing 130 s environment failure).
- TLA+ models and Rust lifecycle conformance (`verification/helios-lifecycle/check.py`,
  TLC 2.19): all 9 models, model mutations, Rust source mutations, and observed
  Rust transition replays passed across all 8 conformance suites.
- Kani (`cargo kani --manifest-path helios/Cargo.toml --lib`, Kani 0.68.0 /
  CBMC 6.11.0): 9 of 9 harnesses verified, 0 failures, including
  `core_parameter_validation_enforces_finite_ordered_bounds` and
  `core_parameter_resolution_produces_valid_canonical_value`.
- Unrun checks: live GPU export and serving of a core declaring
  `core_parameters` were not run on this rebased revision in this CPU
  verification environment.

Signed-off-by: Joshua Cartu <[email protected]>
Co-Authored-By: Luke Alonso <[email protected]>
Signed-off-by: Luke Alonso <[email protected]>
Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
@lukealonso lukealonso changed the title Bind core-declared FP32 scalar arguments into text forward graphs Bind core-declared FP32 parameters into text forward graphs Nov 28, 2026
@lukealonso
lukealonso force-pushed the pr/core-declared-graph-inputs branch from 7374e22 to ef94d62 Compare November 28, 2026 23:18
@lukealonso
lukealonso merged commit 85de9ea into NVIDIA:main Nov 28, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 505.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The core design, wire compatibility, HTTP decoding, prefix-cache salting, steady-state packing, and Kani/TLA+ verification are sound with 0 blockers, but two verified issues should be fixed: the latent unsalted-admission trap on RequestScheduler and the missing docs/TODO.txt qualification record with stated qualification scope in user-facing docs.

  • Blockers: 0
  • Should fix: 2
  • Subtractive suggestions: 1
  • Nits: 4

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants