Skip to main content

verify_topology_draft

Function verify_topology_draft 

Source
pub fn verify_topology_draft(
    draft: &TopologyDraftBatch,
    target_predictions: &[u32],
) -> SpeculativeVerifyResult
Expand description

Verify a speculative TopologyDraftBatch against target model greedy predictions or logit argmax tokens.

For each draft token $i \in [0, \text{draft_len})$, target model predicts $t^_i$. If $t_i == t^i$, draft token is accepted. Upon first divergence at index $j$, acceptance stops; $j$ tokens are accepted, and $t^_j$ is emitted as the correction token. If all draft tokens are accepted, all $\text{draft_len}$ tokens are accepted, and bonus token $t^{\text{draft_len}}$ is emitted.