pub trait TargetModel {
// Required methods
fn vocab_size(&self) -> usize;
fn verify(
&self,
prefix: &[TokenId],
draft_tokens: &[TokenId],
) -> SpeculativeDecodingResult<TargetScores>;
}Expand description
A model that, given a prefix and up to k draft continuations, returns
per-position distributions (as log-probs) in a single forward pass.
Required Methods§
Sourcefn vocab_size(&self) -> usize
fn vocab_size(&self) -> usize
Vocabulary cardinality the target emits log-probs over. Must match
the draft’s vocab_size().
Sourcefn verify(
&self,
prefix: &[TokenId],
draft_tokens: &[TokenId],
) -> SpeculativeDecodingResult<TargetScores>
fn verify( &self, prefix: &[TokenId], draft_tokens: &[TokenId], ) -> SpeculativeDecodingResult<TargetScores>
Score prefix concatenated with draft_tokens: return k + 1
distributions (the k draft-covered positions plus the bonus).