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.mtp_qwen3_5

The MTP head a Qwen3.5 checkpoint ships beside its trunk.

MTPQwen3_5DraftArchConfig​

class max.pipelines.architectures.mtp_qwen3_5.MTPQwen3_5DraftArchConfig(*, hidden_size, num_attention_heads, num_key_value_heads, num_hidden_layers, rope_theta, rope_scaling_params, max_seq_len, intermediate_size, interleaved_rope_weights, vocab_size, dtype, model_quantization_encoding, quantization_config, kv_params, return_logits=ReturnLogits.LAST_TOKEN, norm_method='rms_norm', norm_dtype=None, attention_bias=False, rms_norm_eps=None, tie_word_embeddings=False, stacked_mlp=False, stacked_qkv=False, attention_multiplier, embedding_multiplier, residual_multiplier, devices, clip_qkv, quant_config=None, longrope_scaling_params=None, logits_scaling=1.0, return_hidden_states=ReturnHiddenStates.NONE, target_layer_ids=None, use_subgraphs=True, data_parallel_degree=1, sliding_window=None, quantization_encoding=None, layer_types=<factory>, full_attention_interval=4, linear_key_head_dim=128, linear_value_head_dim=128, linear_num_key_heads=16, linear_num_value_heads=48, linear_conv_kernel_dim=4, partial_rotary_factor=0.25, attn_output_gate=True, mamba_ssm_dtype=float32, state_pool_dtype=None, vision_config=None, mrope_without_encoder=False, image_token_id=None, video_token_id=None, vision_start_token_id=None, mrope_section=None, hf_quantization_config=None, quant_scheme=None, declared_dtype=None)

source

Bases: Qwen3_5Config

The head’s config: its target’s, with a KV leaf for its one layer.

Parameters:

build_module()​

classmethod build_module(context)

source

Builds the MTP head from the target’s checkpoint, which context names.

The head’s config is its target’s, finalized against the head’s weights. It embeds and projects through the target’s embedding and head, so spec decoding shares those onto it.

Raises:

ValueError – If the checkpoint ships no MTP head, or one with tensors the head doesn’t read.

Parameters:

context (ModelLoadContext)

Return type:

tuple[Qwen3_5MTP, Qwen3_5Config]

construct_kv_params()​

classmethod construct_kv_params(huggingface_config, pipeline_config, devices, kv_cache_config, cache_dtype, *, allow_kv_head_replication=False)

source

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

Parameters:

Return type:

KVCacheParams