IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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.eagle3_deepseekV3

Eagle3 drafts for a DeepseekV3 target.

Eagle3DeepseekV3​

class max.pipelines.architectures.eagle3_deepseekV3.Eagle3DeepseekV3(config)

source

Bases: Eagle3MLADraft

Eagle3 draft paired with a DeepseekV3 target.

See Eagle3MLADraft for the implementation.

Parameters:

config (DeepseekV3Config)

has_own_lm_head​

has_own_lm_head = True

source

Whether the head scores through its own lm_head. One whose checkpoint ships none scores through its target’s.

Eagle3DeepseekV3DraftArchConfig​

class max.pipelines.architectures.eagle3_deepseekV3.Eagle3DeepseekV3DraftArchConfig(max_seq_len)

source

Bases: ArchConfigWithBoundedMaxSeqLen

The draft architecture’s config: its sequence bound and KV leaf.

Parameters:

max_seq_len (int)

build_module()​

classmethod build_module(context)

source

Builds the head from the draft checkpoint context names.

It embeds through its target’s embedding, so spec decoding shares that onto it, and its target’s head too when the checkpoint ships none.

Parameters:

context (ModelLoadContext)

Return type:

tuple[Eagle3DeepseekV3, Eagle3DeepseekV3DraftConfig]

construct_kv_params()​

classmethod construct_kv_params(huggingface_config, pipeline_config, devices, kv_cache_config, cache_dtype)

source

Returns a one-layer view of the target’s cache, for the one decoder layer the head has.

Parameters:

Return type:

KVCacheParams

initialize()​

classmethod initialize(pipeline_config, model_config=None, *, max_seq_len)

source

Records the sequence length the pipeline resolved.

Parameters:

Return type:

Self

max_seq_len​

max_seq_len: int

source

Eagle3DeepseekV3DraftConfig​

class max.pipelines.architectures.eagle3_deepseekV3.Eagle3DeepseekV3DraftConfig(target_layer_ids=<factory>, *, dtype, kv_params, devices, use_subgraphs=True, data_parallel_degree=1, quantization_encoding=None, vocab_size=129280, hidden_size=7168, intermediate_size=18432, moe_intermediate_size=2048, moe_layer_freq=1, num_hidden_layers=61, num_attention_heads=128, num_key_value_heads=128, n_shared_experts=1, n_routed_experts=256, routed_scaling_factor=2.5, kv_lora_rank=512, q_lora_rank=1536, qk_rope_head_dim=64, v_head_dim=128, qk_nope_head_dim=128, topk_method='greedy', n_group=8, topk_group=4, num_experts_per_tok=8, first_k_dense_replace=3, norm_topk_prob=True, hidden_act='silu', max_position_embeddings=4096, max_seq_len, rms_norm_eps=1e-06, tie_word_embeddings=False, rope_theta=10000.0, rope_scaling=None, rope_interleave=True, scoring_func='sigmoid', attention_bias=False, attention_dropout=0.0, norm_dtype=bfloat16, gate_dtype=None, correction_bias_dtype=None, max_batch_context_length=131072, quant_config=None, attn_quant_config=None, dense_mlp_layers_without_quant=frozenset({}), ep_config=None, graph_mode='auto', return_logits=ReturnLogits.LAST_TOKEN, return_hidden_states=ReturnHiddenStates.NONE, eagle_aux_hidden_state_layer_ids=None, eplb_profile_enabled=False)

source

Bases: DeepseekV3Config

The target’s config, as the head runs it.

Parameters:

target_layer_ids​

target_layer_ids: list[int]

source

The target layers the head fuses, as MAX indices.

Eagle3MHADeepseekV3DraftArchConfig​

class max.pipelines.architectures.eagle3_deepseekV3.Eagle3MHADeepseekV3DraftArchConfig(max_seq_len)

source

Bases: ArchConfigWithBoundedMaxSeqLen

The MHA head’s config: its sequence bound and its own KV leaf.

Parameters:

max_seq_len (int)

build_module()​

classmethod build_module(context)

source

Builds the MHA head from the draft checkpoint context names.

A checkpoint that doesn’t name the target layers it was trained on gets layers spread across the target, which fc fuses as many of as its shape says.

Raises:

ValueError – If the named layers don’t match fc’s width.

Parameters:

context (ModelLoadContext)

Return type:

tuple[Eagle3MHADraft, Eagle3MHADraftConfig]

construct_kv_params()​

classmethod construct_kv_params(huggingface_config, pipeline_config, devices, kv_cache_config, cache_dtype)

source

Returns the head’s one-layer cache, in bfloat16.

MHA flash attention requires q/k/v and KV cache dtypes to match, and the head computes in bfloat16 whatever the target caches in.

Parameters:

Return type:

KVCacheParams

initialize()​

classmethod initialize(pipeline_config, model_config=None, *, max_seq_len)

source

Records the sequence length the pipeline resolved.

Parameters:

Return type:

Self

max_seq_len​

max_seq_len: int

source