Skip to content
Merged
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
12 changes: 8 additions & 4 deletions docs/cli-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,14 @@ The controls use the core's captured snapshot graphs and require no re-export.
`--scheduler-checkpoint-extra-work-fraction FRACTION` bounds optional checkpoint
work relative to productive request work. The default is `0.05`; values must be
finite and in `[0,1]`. It overrides
`[server] scheduler_checkpoint_extra_work_fraction`. An interior message endpoint before the prompt end serves as the conversation
anchor only when splitting prefill there adds predicted prefill work within the
request's extra-work allowance (reducing to zero added prefill work when the
fraction is zero), and otherwise the zero-split prompt end acts as the anchor.
`[server] scheduler_checkpoint_extra_work_fraction`. Under a nonzero fraction,
an interior message endpoint before the prompt end is retained without charging
its split when the generation prompt opens a reasoning block
(`output.content.start == OutputStart::Reasoning`). Otherwise an interior
message endpoint serves as the conversation anchor only when splitting prefill
there adds predicted prefill work within the request's extra-work allowance
(reducing to zero added prefill work when the fraction is zero), and the
zero-split prompt end acts as the anchor when it does not.
When timing estimates are unavailable, a nonzero fraction keeps the last eligible
message endpoint as a best-effort anchor while zero falls back to the prompt end.
Zero snapshot capacity disables all checkpoint cuts. Any retained interior anchor
Expand Down
26 changes: 16 additions & 10 deletions docs/core-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -1436,16 +1436,22 @@ to earlier tokens cannot reuse a checkpoint for different tokens.
The scheduler chooses the last eligible complete-message boundary as the request's
candidate conversation anchor, or the prompt end if no message boundary is
eligible. When snapshot storage has zero capacity, the scheduler emits no
checkpoint cuts. An interior message boundary before the prompt end is retained as
the conversation anchor only when splitting prefill there adds predicted prefill
work within the request's extra-work allowance (`scheduler_checkpoint_extra_work_fraction`
times estimated uncached prefill work, reducing to exact zero split cost when the
fraction is zero); otherwise the zero-split prompt end serves as the anchor. When
an interior anchor is retained, its predicted split overhead is charged against
that same extra-work allowance while its single anchor snapshot copy remains
uncharged. Earlier complete-message boundaries before that candidate anchor
compete in reverse message order; a distinct prompt end follows them. There is no
capture-count limit or allocation of a fixed snapshot share to each request.
checkpoint cuts. When `scheduler_checkpoint_extra_work_fraction > 0` and the
generation prompt opens a reasoning block
(`output.content.start == OutputStart::Reasoning`), an interior message
boundary before the prompt end is retained as the conversation anchor without
charging its split so stripped reasoning tags do not invalidate multi-turn
prefix reuse. Otherwise an interior message boundary is retained only when
splitting prefill there adds predicted prefill work within the request's
extra-work allowance (`scheduler_checkpoint_extra_work_fraction` times
estimated uncached prefill work, reducing to exact zero split cost when the
fraction is zero), with the zero-split prompt end serving as the anchor when it
does not; when such a budgeted interior anchor is retained, its predicted split
overhead is charged against that same extra-work allowance while its single
anchor snapshot copy remains uncharged. Earlier complete-message boundaries
before that candidate anchor compete in reverse message order; a distinct
prompt end follows them. There is no capture-count limit or allocation of a
fixed snapshot share to each request.

Extra captures share this request-local work allowance, with a default fraction of
0.05. An extra endpoint charges the additional predicted prefill time caused by
Expand Down
13 changes: 8 additions & 5 deletions docs/scheduling-runtime-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,14 @@ prefill exposes its decoder and checkpoint operation only after completion.
Checkpoint retention uses the exact token endpoints supplied by the native
frontend under the anchor-budgeting and shared request-local allowance rules in
[exact endpoint capture](core-design.md#exact-endpoint-capture): zero snapshot
capacity disables cuts; an interior message boundary is retained as the
conversation anchor only when its predicted prefill split fits the
`scheduler_checkpoint_extra_work_fraction` allowance (defaulting to 0.05,
charging the split while leaving the anchor snapshot copy uncharged); and
earlier messages plus a distinct prompt end compete within that same allowance.
capacity disables cuts; when `scheduler_checkpoint_extra_work_fraction > 0`
(defaulting to 0.05), an interior message boundary is retained without charging
its split if the generation prompt opens a reasoning block
(`output.content.start == OutputStart::Reasoning`, so stripped reasoning tags
do not invalidate multi-turn prefix reuse), and otherwise is retained only when
its predicted prefill split fits that allowance (charging the split while
leaving the anchor snapshot copy uncharged); earlier messages plus a distinct
prompt end compete within that same allowance.
Prefill predictions use measured costs, including stale
estimates retained for dispatch ranking. Pricing skips unmeasured capacities
that consume no additional tokens over a smaller capacity, and unmeasured
Expand Down
14 changes: 9 additions & 5 deletions helios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,15 @@ capacity. Among candidates of one graph kind and cohort that perform the same
logical work, selection first discards any shape whose capacities are all at
least as large as another candidate's and larger in at least one. An unmeasured
prefill graph is not explored when a smaller loaded capacity consumes the same
tokens. Checkpoint selection uses the last eligible message boundary as the
conversation anchor only when its predicted prefill split fits the request-local
`scheduler_checkpoint_extra_work_fraction` allowance (defaulting to 0.05),
otherwise falling back to the prompt end. A retained interior anchor charges its
split against that allowance (leaving its snapshot copy uncharged), and earlier
tokens. Checkpoint selection retains the last eligible interior message
boundary as the conversation anchor without charging its split when
`scheduler_checkpoint_extra_work_fraction > 0` (defaulting to 0.05) and the
generation prompt opens a reasoning block
(`output.content.start == OutputStart::Reasoning`), so stripped reasoning tags
do not invalidate multi-turn prefix reuse. Otherwise an interior message
boundary is kept only when its predicted prefill split fits that request-local
allowance (charging the split while leaving the anchor snapshot copy
uncharged), falling back to the prompt end when it does not, and earlier
messages plus a distinct prompt end compete for the remaining headroom.
Productive completed decode earns the same fraction of measured time for a
distinct terminal capture. There is no capture-count cap or per-request share of
Expand Down
2 changes: 1 addition & 1 deletion helios/src/model/packed_round_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fn packed_combined_packing_preserves_sparse_slot_keys_and_ceiling_padding() {
for _ in 0..4 {
let prompt = vec![7; 64];
let h = scheduler.admit(RequestSpec { prompt_logprobs: false, message_boundaries: vec![], prompt: prompt.clone(), conditioning: vec![],
max_new_tokens: 64, grammar_constrained: false, growable_output: false }).unwrap();
max_new_tokens: 64, grammar_constrained: false, growable_output: false, preserve_message_anchor: false }).unwrap();
admissions[h.slot as usize] = Some(Admission { prompt_logprobs: false, handle: h,
sampling: SamplingParameters::default(), core_parameters: Default::default(),
max_new_tokens: 64, prompt, data: PromptData { positions: (0..64).map(|i| [i; 3]).collect(),
Expand Down
13 changes: 12 additions & 1 deletion helios/src/model/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ fn generic_core_parameters_resolve_pack_and_enforce_text_forward_contracts() {
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
};
// Unified validation rejects out-of-range and non-canonical -0.0 values in plan_admission_with_core_parameters.
let out_of_range =
Expand Down Expand Up @@ -378,6 +379,7 @@ fn core_parameters_pack_sparse_permuted_rows_and_preserve_prefix_values() {
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
};
let requests = [0.125f32, 0.25, 0.5, 0.75]
.into_iter()
Expand Down Expand Up @@ -526,6 +528,7 @@ fn admission_histogram_seed_and_partial_page_uploads_preserve_native_semantics()
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
let mut admissions: [Option<Admission>; 4] = std::array::from_fn(|_| None);
Expand Down Expand Up @@ -674,6 +677,7 @@ fn large_prefill_uploads_preserve_token_position_and_image_indices_without_tail_
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
let mut admissions: [Option<Admission>; 4] = std::array::from_fn(|_| None);
Expand Down Expand Up @@ -986,6 +990,7 @@ fn packing_follows_value_bindings_after_buffers_and_model_are_renamed() {
grammar_constrained: true,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
let mut admissions: [Option<Admission>; 4] = std::array::from_fn(|_| None);
Expand Down Expand Up @@ -1101,6 +1106,7 @@ fn legacy_copy_bindings_pack_neutral_sentinels_without_copy_proposals() {
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
let step = scheduler.plan().unwrap();
Expand Down Expand Up @@ -1231,6 +1237,7 @@ fn mixed_native_uploads_pack_prompt_after_the_decode_extent_and_sample_only_elig
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
admissions[h.slot as usize] = Some(Admission {
Expand Down Expand Up @@ -1444,6 +1451,7 @@ fn state_transfer_and_resume_upload_fixture() {
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
let mut admissions: [_; 4] = std::array::from_fn(|_| None);
Expand Down Expand Up @@ -1663,6 +1671,7 @@ fn grammar_packing_fixture() -> (
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
admissions.push(Some(Admission {
Expand Down Expand Up @@ -1896,6 +1905,7 @@ fn prefill_compacts_execution_feature_indices_and_preserves_admission_metadata()
grammar_constrained: false,
prompt_logprobs: false,
growable_output: true,
preserve_message_anchor: false,
})
.unwrap();
scheduler
Expand Down Expand Up @@ -2004,7 +2014,7 @@ fn committed_generation_cursors_require_feedback_while_unused_prompt_positions_d
}
scheduler.measured_graph_durations(&manifest.graphs).unwrap();
let handle = scheduler.admit(RequestSpec { message_boundaries: vec![], prompt: vec![7; 64], conditioning: vec![],
max_new_tokens: 64, grammar_constrained: false, prompt_logprobs: false, growable_output: false }).unwrap();
max_new_tokens: 64, grammar_constrained: false, prompt_logprobs: false, growable_output: false, preserve_message_anchor: false }).unwrap();
let mut admissions: [Option<Admission>; 4] = std::array::from_fn(|_| None);
admissions[handle.slot as usize] = Some(Admission { handle, sampling: SamplingParameters::default(),
core_parameters: Default::default(),
Expand Down Expand Up @@ -2264,6 +2274,7 @@ fn prompt_lookahead_packing_distributes_budget_across_single_multi_and_mixed_lan
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
admissions[h.slot as usize] = Some(Admission {
Expand Down
5 changes: 5 additions & 0 deletions helios/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ pub struct RequestSpec {
/// request decodes. When pages run out the scheduler may preempt such a request:
/// it finishes through its terminal checkpoint and the runtime readmits its history.
pub growable_output: bool,
/// Retain the last eligible interior message boundary as the conversation anchor
/// under nonzero `checkpoint_extra_work_fraction` instead of budgeting its split.
pub preserve_message_anchor: bool,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -225,6 +228,7 @@ pub struct LiveRequest {
pub generated_tokens: u32,
pub prompt_tokens: usize,
pub grammar_constrained: bool,
pub preserve_message_anchor: bool,
pub error_code: Option<i64>,
prompt_logprobs: bool,
execution_limit: u64,
Expand Down Expand Up @@ -1845,6 +1849,7 @@ impl RequestScheduler {
generated_tokens: 0,
prompt_tokens: spec.prompt.len(),
grammar_constrained: spec.grammar_constrained,
preserve_message_anchor: spec.preserve_message_anchor,
prompt_logprobs: spec.prompt_logprobs,
execution_limit: execution_limit as u64,
error_code: None,
Expand Down
1 change: 1 addition & 0 deletions helios/src/scheduler/boundary_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fn spec(system: Option<usize>, prompt: usize, output: u32) -> RequestSpec {
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
}
}
fn run_step(s: &mut RequestScheduler) -> ScheduledPlan {
Expand Down
1 change: 1 addition & 0 deletions helios/src/scheduler/checkpoint_lifecycle_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ fn deferred_prefill_reservations_match_lifecycle_model() {
grammar_constrained: false,
prompt_logprobs: false,
growable_output: false,
preserve_message_anchor: false,
})
.unwrap();
let init = s.plan().unwrap();
Expand Down
Loading