Skip to main content

GemmaDraft

Struct GemmaDraft 

Source
pub struct GemmaDraft {
Show 15 fields pub layers: Vec<GemmaDraftLayer>, pub pre_proj: GpuTensor, pub post_proj: GpuTensor, pub output_norm: GpuTensor, pub head: GpuTensor, pub d2t: Option<Vec<u32>>, pub d2t_dev: Option<CudaSlice<u32>>, pub trim_adapt: Option<TrimAdapt>, pub rope_freqs: CudaSlice<f32>, pub ones: CudaSlice<f32>, pub n_embd: usize, pub n_backbone: usize, pub rope_base_global: f32, pub rope_base_swa: f32, pub sliding_window: usize,
}

Fields§

§layers: Vec<GemmaDraftLayer>§pre_proj: GpuTensor§post_proj: GpuTensor§output_norm: GpuTensor§head: GpuTensor§d2t: Option<Vec<u32>>

FR-Spec trim map: draft-row index -> target token id (None = full head, identity).

§d2t_dev: Option<CudaSlice<u32>>

Device copy of d2t — the async round translates each drafted trim-idx in place (u32_map_k) before it seeds the next draft step or meets the verify argmax.

§trim_adapt: Option<TrimAdapt>

Adaptive trim (coverage escapes are the entire trim cost — oracle-proven +2% on the cell the static trim lost by 17%, jsonl 2026-07-19): spare head slots learned at serve time from the prompt’s own ids and verify-correction tokens.

§rope_freqs: CudaSlice<f32>§ones: CudaSlice<f32>§n_embd: usize§n_backbone: usize§rope_base_global: f32§rope_base_swa: f32§sliding_window: usize

Implementations§

Source§

impl GemmaDraft

Source

pub fn trim_adapt_stats(&self) -> Option<(usize, usize)>

Adaptive-trim stats: (slots used, slot budget). None when adaptation is off.

Source

pub fn trim_adapt_save(&self) -> Result<usize>

Persist the learned trim rows: append ids not yet in the sidecar to <ranks>.learned (the load path pre-fills spare slots from it, so a distribution’s escapes pay their first-miss round ONCE across the serve lifetime, not per request).

Source§

impl GemmaDraft

Source

pub fn load(e: &Engine, g: &GgufFile) -> Result<Self, Box<dyn Error>>

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> 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, 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.