Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/core-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,10 @@ frames. Exact host `QueryLength` bindings select lengths before proposal draws;
GPU `SpeculativePrefixLimit` bindings freeze per-lane ceilings while the captured
program allocates within P. Both paths reserve cache against their full
submitted lane limits. Confidence producers declare `confidence_width` and write
FP32 `[2, request_slots, draft_capacity]` completion frames.
FP32 `[2, request_capacity, draft_capacity]` completion frames indexed by
completion frame, submission row (sized to
`request_capacity = Execution.max_active.next_power_of_two()`), and draft depth
`1..=completion_token_capacity - 1`.

Host pending-token, grammar, history, cost-discovery, and phase-transition
dependencies serialize the affected program. Prefill, terminal prefill, scored
Expand Down
14 changes: 10 additions & 4 deletions docs/runtime-core-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,12 @@ maximum prefill chunk; intermediate prefill capacities are optional.
tokens per completion. Zero or omission resolves to eight; positive values are
literal. ABI6 records contain 16 metadata fields followed by that many token
fields. Logprob storage uses the same token capacity. Optional survival storage
uses one fewer position. Proposal-confidence buffers may have one through T−1
positions and must cover every graph’s confidence width, where T is the completion
token capacity. Capacity one omits these zero-depth outputs. All ranks must agree on the resolved capacity. Graph widths
uses one fewer position. Proposal-confidence buffers (`proposal_confidence`)
are contiguous FP32 storage with shape `[2, request_capacity, draft_capacity]`,
indexed by completion frame, submission row (sized to
`request_capacity = Execution.max_active.next_power_of_two()`), and draft depth
`1..=completion_token_capacity - 1`, covering every graph’s confidence width.
Capacity one omits these zero-depth outputs. All ranks must agree on the resolved capacity. Graph widths
fit this capacity; continuation-state storage has independently declared geometry.

Execution metadata identifies complete speculative programs by B/D/W/P: request
Expand All @@ -712,7 +715,10 @@ reads. Graph names do not select semantics.
inputs bind immutable ceilings and leave actual lengths to a captured GPU causal
allocator. Fixed prefix selection supports host-allocated ragged programs; GPU
allocation requires adaptive selection. A confidence output declares
`confidence_width` and uses FP32 `[2, request_slots, draft_capacity]` frames.
`confidence_width` and uses FP32 `[2, request_capacity, draft_capacity]`
submission-row frames (where
`request_capacity = Execution.max_active.next_power_of_two()` and
`draft_capacity` is in `1..=completion_token_capacity - 1`).

`flare run` accepts `--max-concurrency`, `--mtp-draft-tokens`, and adaptive/fixed
selection flags. Unspecified values retain core defaults. A concurrency limit
Expand Down
7 changes: 5 additions & 2 deletions docs/scheduling-runtime-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ prefixes. Termination censors the remaining suffix. Width-one rounds measure
cost without supplying acceptance observations.

A confidence-producing program declares `confidence_width`, equal to its actual
D. Its FP32 sidecar has shape `[2, request_slots, draft_capacity]`, covering every
produced prefix. Only completed rounds update host forecasts. Rank zero's
D. Its FP32 sidecar (`proposal_confidence`) has shape
`[2, request_capacity, draft_capacity]`, indexed by completion frame, submission
row (sized to `request_capacity = Execution.max_active.next_power_of_two()`),
and draft depth `1..=completion_token_capacity - 1`, covering every produced
prefix. Only completed rounds update host forecasts. Rank zero's
confidence drives host decisions; peer estimates must be valid probabilities
but need not agree bitwise. Exact request identities, consumption, emitted
prefixes, and committed state agree across ranks.
Expand Down
4 changes: 3 additions & 1 deletion helios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ Speculative descriptors carry actual request/proposal/target geometry B/D/W/P,
including explicit P for rectangular programs. Exact `QueryLength` inputs select
host allocation; `SpeculativePrefixLimit` inputs select captured GPU allocation.
A produced confidence sidecar declares `confidence_width` and uses two FP32
frames shaped `[2, request_slots, draft_capacity]`. Host dependencies are derived
frames shaped `[2, request_capacity, draft_capacity]` indexed by submission row
(sized to `Execution.max_active.next_power_of_two()`) and draft depth
`1..=completion_token_capacity - 1`. Host dependencies are derived
per selected program. Planning projects queued expected service and output age
at submission; observed delivery age changes only when tokens are published.

Expand Down
7 changes: 5 additions & 2 deletions helios/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ runtime validates graph operations, buffer geometry, and storage dependencies.
zero value resolves to eight tokens; a positive value is the token capacity T.
All ranks use the same resolved value. Completion records have 16 metadata fields
and T token fields. Generation logprobs have T token positions, and optional
survival outputs have T−1 positions. Proposal-confidence buffers may have
one through T−1 positions and must cover each graph’s confidence width. Cores
survival outputs have T−1 positions. Proposal-confidence buffers
(`proposal_confidence`) are contiguous `float32` storage with shape
`[2, request_capacity, draft_capacity]`, indexed by completion frame, submission
row (sized to `request_capacity = Execution.max_active.next_power_of_two()`),
and draft depth `1..=T−1`, covering each graph’s confidence width. Cores
with T=1 omit these zero-depth outputs. Graph verification widths cannot exceed T; model
and operator limits may be smaller. Continuation-state geometry is independent
of completion token capacity.
Expand Down
8 changes: 5 additions & 3 deletions helios/model-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ and target programs retain their declared RNG reservations.

A program producing confidence declares `confidence_width`, equal to its actual
D. `proposal_confidence` is contiguous FP32 storage with shape
`[2, request_slots, draft_capacity]`; the capacity covers every declared output
width. Frame index selects the completion frame, and submitted rows retain their
lane order. There is no unframed confidence layout.
`[2, request_capacity, draft_capacity]`, where
`request_capacity = Execution.max_active.next_power_of_two()` and
`draft_capacity` is in draft depth `1..=completion_token_capacity - 1` covering
every declared output width. Frame index selects the completion frame, and
submitted rows retain their lane order. There is no unframed confidence layout.

The single terminal completion reports actual offers, accepted drafts, and
emitted tokens. Helios validates each offer against its reserved lane ceiling
Expand Down
4 changes: 2 additions & 2 deletions helios/src/execution/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ impl ExecutionManifest {
if buffer.dtype != Dtype::Float32 || buffer.shape.len() != 3
|| buffer.shape[0] != 2 || buffer.shape[1] != self.request_capacity()
|| !(1..self.completion_token_capacity).contains(&buffer.shape[2]) {
return Err("proposal confidence requires two float32 frames indexed by request slot and draft prefix".into());
return Err("proposal confidence requires [2, request_capacity, draft_capacity] float32 frames indexed by submission row (sized to max_active.next_power_of_two()) and draft depth 1..=completion_token_capacity - 1".into());
}
}
if let Some(buffer) = self.buffers.iter().find(|buffer| buffer.name == "readiness_timestamps") {
Expand Down Expand Up @@ -868,7 +868,7 @@ impl ExecutionManifest {
|| confidence.shape[1] != self.request_capacity()
|| confidence.shape[2] < graph.confidence_width
|| confidence.shape[2] > self.completion_token_capacity - 1 {
return Err("confidence output requires [2, request_slots, draft_capacity] float32 frames".into());
return Err("confidence output requires a speculative graph whose confidence_width equals draft_tokens and [2, request_capacity, draft_capacity] float32 submission-row frames covering confidence_width within draft depth 1..=completion_token_capacity - 1".into());
}
}
if graph.name.is_empty() || !names.insert(&graph.name) {
Expand Down
66 changes: 66 additions & 0 deletions helios/src/execution/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,72 @@ fn eight_token_completions_accept_shorter_proposal_confidence() {
assert!(value.validate().is_err());
}

#[test]
fn proposal_confidence_validation_describes_submission_row_layout() {
let mut value = manifest();
value.max_active = 3;
assert_eq!(value.request_capacity(), 4);
value.graphs[0].kind = GraphKind::Speculative;
value.graphs[0].token_capacity = 6;
value.graphs[0].draft_tokens = 5;
value.graphs[0].packed_token_capacity = 24;
value.graphs[0].confidence_width = 5;
value.buffers.push(BufferDescriptor {
name: "proposal_confidence".into(),
address: 0x20000,
nbytes: 2 * 4 * 5 * 4,
dtype: Dtype::Float32,
shape: vec![2, 4, 5],
strides: vec![20, 5, 1],
});
value.validate().unwrap();

for (shape, strides, nbytes, dtype) in [
(vec![2, 3, 5], vec![15, 5, 1], 2 * 3 * 5 * 4, Dtype::Float32),
(vec![1, 4, 5], vec![20, 5, 1], 4 * 5 * 4, Dtype::Float32),
(vec![2, 4, 16], vec![64, 16, 1], 2 * 4 * 16 * 4, Dtype::Float32),
(vec![2, 4, 5], vec![20, 5, 1], 2 * 4 * 5 * 4, Dtype::Int32),
] {
let mut invalid = value.clone();
let buffer = invalid.buffers.last_mut().unwrap();
buffer.shape = shape;
buffer.strides = strides;
buffer.nbytes = nbytes;
buffer.dtype = dtype;
let error = invalid.validate().unwrap_err().to_string();
assert!(error.contains("submission row"), "{error}");
assert!(error.contains("request_capacity"), "{error}");
assert!(error.contains("draft depth 1..=completion_token_capacity - 1"), "{error}");
assert!(!error.contains("request slot"), "{error}");
assert!(!error.contains("request_slots"), "{error}");
}

let mut width_exceeds = value.clone();
width_exceeds.graphs[0].confidence_width = 6;
width_exceeds.graphs[0].draft_tokens = 6;
width_exceeds.graphs[0].token_capacity = 7;

let mut width_mismatch = value.clone();
width_mismatch.graphs[0].confidence_width = 4;

let mut non_speculative = value.clone();
non_speculative.graphs[0].kind = GraphKind::Decode;
non_speculative.graphs[0].token_capacity = 1;
non_speculative.graphs[0].draft_tokens = 0;
non_speculative.graphs[0].packed_token_capacity = 0;
non_speculative.graphs[0].confidence_width = 1;

for invalid in [width_exceeds, width_mismatch, non_speculative] {
let error = invalid.validate().unwrap_err().to_string();
assert!(error.contains("speculative graph whose confidence_width equals draft_tokens"), "{error}");
assert!(error.contains("request_capacity"), "{error}");
assert!(error.contains("submission-row"), "{error}");
assert!(error.contains("draft depth 1..=completion_token_capacity - 1"), "{error}");
assert!(!error.contains("request slot"), "{error}");
assert!(!error.contains("request_slots"), "{error}");
}
}

#[test]
fn persistent_worker_manifest_validation_enforces_handles_alignment_and_cardinality() {
let mut value = manifest();
Expand Down