vllm.model_executor.models.qwen3_dspark ¶
Qwen3 DSpark draft model for semi-autoregressive drafting.
DSpark drafts a whole block in one parallel pass (DFlash-style: context-KV precompute + a non-causal query-block forward) and then injects intra-block dependency with a lightweight sequential Markov head.
The parallel backbone is a standard Qwen3 decoder stack reused from the DFlash Qwen3 draft (see qwen3_dflash.py). DSpark adds: * markov_head: low-rank V x r / r x V transition bias added to the base logits, sampled left-to-right by the speculator (the sequential stage).
DSparkMarkovHead is shared with the DSV4-style DSpark model.
Classes:
-
DSparkMarkovHead–Sequential transition-bias head (low-rank V x r, r x V).
-
Qwen3DSparkModel–DFlash Qwen3 backbone + DSpark Markov head.
DSparkMarkovHead ¶
Bases: Module
Sequential transition-bias head (low-rank V x r, r x V).
markov_w1[token] embeds the previously sampled token (target vocab, vocab_size); markov_w2 projects it to a draft-vocab bias (draft_vocab_size) added to the base draft logits. The two sizes coincide for full-vocab drafts.
Both weights are replicated because the head runs sequentially for every draft position. Sharding them would add an all-reduce and a full-vocab gather to each position.
Methods:
-
apply_bias_gathered–Apply the Markov bias only to selected rows of
logits. -
bias–Vocab-size transition bias from a Markov embedding ([B, r] -> [B, V]).
-
embed–r-dim Markov embedding of
token_ids([B] -> [B, r]).
Source code in vllm/model_executor/models/qwen3_dspark.py
apply_bias_gathered(markov_embed, logits, values, index, scale=1.0) ¶
Apply the Markov bias only to selected rows of logits.
The caller initializes logits to -inf once for all draft positions. This method scatters the corrected candidate values into that dense buffer so the normal sampler sees the truncated proposal.
Source code in vllm/model_executor/models/qwen3_dspark.py
bias(markov_embed, logits_processor) ¶
Vocab-size transition bias from a Markov embedding ([B, r] -> [B, V]).
Source code in vllm/model_executor/models/qwen3_dspark.py
Qwen3DSparkModel ¶
Bases: DFlashQwen3Model
DFlash Qwen3 backbone + DSpark Markov head.