pub struct SpeculativeDecodeResult {
pub generated_tokens: Vec<usize>,
pub forward_calls: usize,
pub tokens_generated: usize,
}Expand description
Result of a speculative decode run, with the counters that make its actual savings observable rather than just assumed.
Fields§
§generated_tokens: Vec<usize>§forward_calls: usizeNumber of Decoder::forward_batch calls made (prefill counts as
one call, each subsequent accept/reject round counts as one
more, regardless of how many tokens that round produced).
tokens_generated: usizeTotal tokens produced across all rounds – always equal to
generated_tokens.len(), kept as a separate field so the ratio
tokens_generated / forward_calls (the actual speedup metric)
is easy to read directly off this struct.
Implementations§
Source§impl SpeculativeDecodeResult
impl SpeculativeDecodeResult
Sourcepub fn tokens_per_call(&self) -> f64
pub fn tokens_per_call(&self) -> f64
Average tokens produced per forward_batch call. 1.0 means
speculation never helped (every round produced exactly the
anchor token); higher means draft tokens were accepted.
Trait Implementations§
Source§impl Clone for SpeculativeDecodeResult
impl Clone for SpeculativeDecodeResult
Source§fn clone(&self) -> SpeculativeDecodeResult
fn clone(&self) -> SpeculativeDecodeResult
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 moreAuto Trait Implementations§
impl Freeze for SpeculativeDecodeResult
impl RefUnwindSafe for SpeculativeDecodeResult
impl Send for SpeculativeDecodeResult
impl Sync for SpeculativeDecodeResult
impl Unpin for SpeculativeDecodeResult
impl UnsafeUnpin for SpeculativeDecodeResult
impl UnwindSafe for SpeculativeDecodeResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more