Skip to content

vllm.v1.worker.gpu.spec_decode.dflash.speculator

Classes:

DFlashSpeculator

Bases: DraftModelSpeculator

Methods:

_prepare_graph_forward(num_reqs, attn_metadata)

The FULL graph's context step: combine the staged target hidden states, publish the context anchor and store the context K/V.

_prepare_graph_replay(input_batch, num_graph_reqs, last_hidden_states, aux_hidden_states, num_rejected, dummy_run)

Eager work before a FULL replay: stage the inputs _prepare_graph_forward reads and store the context rows past the graph's num_context rows.

free_unused_weights(target_model)

With context_kv_only, keep only the weights of the modules that store the context K/V and those shared with the target. A draft model without context_kv_modules keeps all of its weights.

prepare_context_anchor(num_reqs, query_start_loc, num_rejected)

Publish context features required by a draft's candidate head. Runs inside the FULL graph, so it must not sync with the host.