For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python module
max.pipelines.architectures.dspark_qwen3
The DSpark draft of Nemotron-H, a Qwen3-style block drafter.
DSparkQwen3
class max.pipelines.architectures.dspark_qwen3.DSparkQwen3(config, kv_params, *, num_devices, max_seq_len, device)
Bases: Module
The DSpark draft: context projection, layers and Markov head.
Builds the draft.
-
Parameters:
-
- config (DSparkQwen3DraftConfig) – The draft’s hyperparameters.
- kv_params (KVCacheParams) – The draft’s KV cache leaf.
- num_devices (int) – The tensor-parallel degree.
- max_seq_len (int) – The longest sequence, which sizes the rope table.
- device (Any) – The device the rope table is built on.
forward()
forward(embeds, kv_collection, input_row_offsets)
Alias for forward_block().
forward_block()
forward_block(embeds, kv_collection, input_row_offsets)
Runs the block, whose K and V land at the cache’s lengths.
materialize()
materialize(ctx, kv_collection, input_row_offsets)
Writes every layer’s K and V of the context rows into the cache.
project_context()
project_context(taps)
Projects the concatenated target taps to the draft’s context.
DSparkQwen3DraftConfig
class max.pipelines.architectures.dspark_qwen3.DSparkQwen3DraftConfig(hidden_size, intermediate_size, num_hidden_layers, num_attention_heads, num_key_value_heads, head_dim, rms_norm_eps, vocab_size, rope_theta, sliding_window, max_position_embeddings, block_size, mask_token_id, target_layer_ids, markov_rank, sample_from_anchor, quantized)
Bases: object
The DSpark draft’s hyperparameters, from its checkpoint config.
-
Parameters:
-
- hidden_size (int)
- intermediate_size (int)
- num_hidden_layers (int)
- num_attention_heads (int)
- num_key_value_heads (int)
- head_dim (int)
- rms_norm_eps (float)
- vocab_size (int)
- rope_theta (float)
- sliding_window (int)
- max_position_embeddings (int)
- block_size (int)
- mask_token_id (int)
- target_layer_ids (tuple[int, ...])
- markov_rank (int)
- sample_from_anchor (bool)
- quantized (bool)
block_size
block_size: int
head_dim
head_dim: int
hidden_size
hidden_size: int
intermediate_size
intermediate_size: int
markov_rank
markov_rank: int
mask_token_id
mask_token_id: int
max_position_embeddings
max_position_embeddings: int
num_attention_heads
num_attention_heads: int
num_context_features
property num_context_features: int
How many target taps feed the fc projection.
num_drafts
property num_drafts: int
How many tokens a block proposes.
num_hidden_layers
num_hidden_layers: int
num_key_value_heads
num_key_value_heads: int
quantized
quantized: bool
Whether the checkpoint stores its linears NVFP4 weight-only.
rms_norm_eps
rms_norm_eps: float
rope_theta
rope_theta: float
sample_from_anchor
sample_from_anchor: bool
Whether the anchor slot of the block predicts a draft token.
False is the DFlash layout: the block’s first slot holds the committed
token and predicts nothing, so a block of block_size carries
block_size - 1 drafts.
sliding_window
sliding_window: int
tap_layer_inputs
The target layers whose inputs the target taps.
The checkpoint names layer outputs and the target taps layer inputs, and a layer’s output is the next layer’s input.
target_layer_ids
The target layers whose outputs the draft reads, as the checkpoint names them. Tapping a layer’s output is tapping the next layer’s input.
vocab_size
vocab_size: int