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_deepseekV4
The DSpark stages DeepSeek-V4’s checkpoint ships beside its trunk.
DSparkDeepseekV4DraftArchConfig
class max.pipelines.architectures.dspark_deepseekV4.DSparkDeepseekV4DraftArchConfig(max_seq_len)
Bases: ArchConfigWithBoundedMaxSeqLen
The draft architecture’s config: its sequence bound, and no KV leaf.
The stages’ windows are layers of the trunk’s window leaf, which the trunk’s own KV params already size.
-
Parameters:
-
max_seq_len (int)
build_module()
classmethod build_module(context)
Builds the stages from the trunk’s checkpoint, which context
names.
The stages read the trunk’s embedding and head, which their caller
passes in, so the checkpoint’s mtp.* weights are all they load.
-
Raises:
-
ValueError – If the method isn’t
dspark. -
Parameters:
-
context (ModelLoadContext)
-
Return type:
-
tuple[DeepseekV4DSpark, DSparkDeepseekV4DraftConfig]
construct_kv_params()
classmethod construct_kv_params(huggingface_config, pipeline_config, devices, kv_cache_config, cache_dtype)
Returns None: the stages read and write the trunk’s leaves.
-
Parameters:
-
- huggingface_config (AutoConfig)
- pipeline_config (PipelineConfig)
- devices (list[DeviceRef])
- kv_cache_config (KVCacheConfig)
- cache_dtype (DType)
-
Return type:
-
None
initialize()
classmethod initialize(pipeline_config, model_config=None, *, max_seq_len)
Records the sequence length the pipeline resolved.
-
Parameters:
-
- pipeline_config (PipelineConfig)
- model_config (MAXModelConfig | None)
- max_seq_len (int)
-
Return type:
max_seq_len
max_seq_len: int
DSparkDeepseekV4DraftConfig
class max.pipelines.architectures.dspark_deepseekV4.DSparkDeepseekV4DraftConfig(module)
Bases: object
The stages’ module config, and what the pairing reads beside it.
-
Parameters:
-
module (DeepseekV4Config)
block_size
property block_size: int
Returns the tokens a block holds, every one of them drafted.
hidden_size
property hidden_size: int
Returns the trunk’s hidden size, which the stages draft in.
mask_token_id
property mask_token_id: int
Returns the token that fills the block past its anchor.
module
module: DeepseekV4Config
target_layer_ids
Returns the trunk layers whose states the stages read.
vocab_size
property vocab_size: int
Returns the trunk’s vocabulary, which the stages score.
dspark_draft_width()
max.pipelines.architectures.dspark_deepseekV4.dspark_draft_width(speculative, target_huggingface_config, draft_huggingface_config)
The DSpark block width: the checkpoint’s dspark_block_size.
Every block position drafts a token, so the width is the block size. The
stages unroll the Markov chain over the block, so a different
--num-speculative-tokens is rejected rather than silently overridden.
-
Parameters:
-
- speculative (SpeculativeConfig)
- target_huggingface_config (Any)
- draft_huggingface_config (Any)
-
Return type: