vllm.v1.worker.gpu.spec_decode.draft_logits
¶
Classes:
-
DraftLogitsCache–Pre-temperature draft logits, cached by a draft step for the next
Functions:
-
draft_logits_row–Row of a request in this rank's draft logits cache, or -1 if no row.
DraftLogitsCache
¶
Pre-temperature draft logits, cached by a draft step for the next verification.
A replicated cache holds every request on every TP rank, at row req_state_idx.
A sharded cache (batch-sharded sampling) holds on each TP rank only the requests that rank verifies. Every draft step gives the request at batch position i to rank i % tp, at row i // tp of its cache, so no rank caches more than cdiv(num_reqs, tp) requests however the request slots are spread.
Rows are reused every step. A request that the scheduler skips for a step
keeps its drafts, but its row may since have been given to another
request. inverse_row_mapping detects this, and stale_drafts marks those
drafts invalid, so verification rejects them and samples from the target.
Methods:
-
assign–Give a sharded cache's rows out by batch position. Call after
-
owners_of–The TP rank that verifies each of a batch's requests: the rank that
-
stale_drafts–Mark the drafts whose draft logits were overwritten since drafting.
draft_logits_row(req_state_idx, row_mapping_ptr)
¶
Row of a request in this rank's draft logits cache, or -1 if no row.
row_mapping_ptr is None for a replicated cache, which is indexed by request
state. Otherwise it is DraftLogitsCache.row_mapping.