Skip to main content

SpecSampling

Struct SpecSampling 

Source
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_fill batches: 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-start set_len truncation (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_h carries 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: f32

Trait Implementations§

Source§

impl Clone for SpecSampling

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Copy for SpecSampling

Source§

impl Debug for SpecSampling

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.