pub struct SpecSampling {
pub temp: f32,
pub seed: u64,
pub top_k: i32,
pub top_p: f32,
pub min_p: f32,
pub penalty_last_n: usize,
pub penalty_repeat: f32,
pub penalty_freq: f32,
pub penalty_present: f32,
}Expand description
Scratch KV for the MTP block (one full-attn layer).
PERSISTENT MODE (default, 2026-07-03 — the acceptance lever): sized cap = max_ctx and kept in sync with the COMMITTED sequence — slot p holds the MTP block’s K/V for committed token p (roped p+1, the chain’s rope convention), so the draft chain’s self-attention sees the FULL committed history instead of only the current round’s 1..K+1 chain tokens (the reference engine’s “mtp_update” design). Entries come from two sources:
- chain appends: accepted positions KEEP their chain-computed entries (embedding exact, hidden chain-approximate — the reference engine accepts the same);
mtp_kv_fillbatches: prompt positions + the last-draft position on full accept, computed from EXACT trunk hiddens (K/V-only MTP-block pass, no attention/FFN/lm_head). Rejected drafts / p-min extras / pseudo-seed appends are all discarded by the round-startset_lentruncation (the KvLayer len mechanism — §C rollback for the draft side). Multi-turn spec-decode session (2026-07-05): trunk Cache + persistent MTP draft scratch + the committed token list, alive across generate_spec_session calls. Turn N+1 primes ONLY its suffix (chunked continuation prime over the quantized past) and mtp_kv_fill’s its suffix rows, then the round loop runs unchanged.last_hcarries the pre-output_norm hidden of the last committed row across turns (the predecessor-pairing seed + fill anchor). Per-request sampling config for the sampled-spec serve path.
Fields§
§temp: f32§seed: u64§top_k: i32§top_p: f32§min_p: f32§penalty_last_n: usize§penalty_repeat: f32§penalty_freq: f32§penalty_present: f32Trait Implementations§
Source§impl Clone for SpecSampling
impl Clone for SpecSampling
Source§fn clone(&self) -> SpecSampling
fn clone(&self) -> SpecSampling
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SpecSampling
Auto Trait Implementations§
impl Freeze for SpecSampling
impl RefUnwindSafe for SpecSampling
impl Send for SpecSampling
impl Sync for SpecSampling
impl Unpin for SpecSampling
impl UnsafeUnpin for SpecSampling
impl UnwindSafe for SpecSampling
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more