pub struct VerificationResult {
pub accepted_tokens: SmallVec<[u32; 8]>,
pub emitted_target_token: u32,
pub accepted_count: usize,
pub total_tokens_produced: usize,
pub rejection_index: Option<usize>,
pub kv_valid_length: usize,
}Expand description
The outcome of the speculative verification stage executed against the target model.
Fields§
§accepted_tokens: SmallVec<[u32; 8]>Candidates from the draft model that were successfully verified.
emitted_target_token: u32The next token sampled from the target model distribution. This is either:
- The correction token if a candidate was rejected.
- The bonus next-token if all K candidates were accepted!
accepted_count: usizeHow many draft tokens were accepted before the first rejection (0..=K).
total_tokens_produced: usizeTotal number of tokens committed in this single speculative cycle (accepted_count + 1 emitted token).
rejection_index: Option<usize>The index in the draft sequence where rejection occurred (or None if all accepted).
kv_valid_length: usizeHow many positions in the KV-cache need to be preserved from the draft.
Implementations§
Source§impl VerificationResult
impl VerificationResult
Sourcepub fn all_committed_tokens(&self) -> impl Iterator<Item = u32>
pub fn all_committed_tokens(&self) -> impl Iterator<Item = u32>
Returns an iterator over all committed tokens in order: [accepted_0, accepted_1, …, accepted_k, emitted_target_token]
Trait Implementations§
Source§impl Clone for VerificationResult
impl Clone for VerificationResult
Source§fn clone(&self) -> VerificationResult
fn clone(&self) -> VerificationResult
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 moreSource§impl Debug for VerificationResult
impl Debug for VerificationResult
Source§impl<'de> Deserialize<'de> for VerificationResult
impl<'de> Deserialize<'de> for VerificationResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<VerificationResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<VerificationResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for VerificationResult
impl PartialEq for VerificationResult
Source§impl Serialize for VerificationResult
impl Serialize for VerificationResult
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for VerificationResult
Auto Trait Implementations§
impl Forget for VerificationResult
impl Freeze for VerificationResult
impl Move for VerificationResult
impl RefUnwindSafe for VerificationResult
impl Send for VerificationResult
impl Sync for VerificationResult
impl Unpin for VerificationResult
impl UnsafeUnpin for VerificationResult
impl UnwindSafe for VerificationResult
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