shadow_topk

Function shadow_topk 

Source
pub fn shadow_topk() -> usize
Expand description

Shadow top-k draft instrumentation (ATLAS_MTP_SHADOW_TOPK=k, default 0 = off, clamp k ≤ 8). Observational only — token selection untouched. Each drafter forward_one D2H’s its logits (same ~200 µs the conf path pays) and logs the top-k candidate ids + softmax probs per position; the verify steps log the target argmaxes under the same gate. Joining the two offline yields the per-depth conditional top-k coverage that gates the tree-speculation build (Phase 0 of the tree-spec plan). Value-parsed, not presence-checked (=0 really is off).

The SSOT parse. Both ModelLevers::shadow_topk (spark-model) and SchedLevers::shadow_topk (spark-server) resolve through it once per run rather than caching the answer in a OnceLock that a swap would pin.