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_glm5_next

The MTP layer a GLM-5.3-Flash checkpoint ships beside its trunk.

MTPGlm5NextDraftArchConfig​

class max.pipelines.architectures.mtp_glm5_next.MTPGlm5NextDraftArchConfig(max_seq_len)

source

Bases: ArchConfigWithBoundedMaxSeqLen

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

Parameters:

max_seq_len (int)

build_module()​

classmethod build_module(context)

source

Builds the MTP layer from the checkpoint that context names.

Its config is the target’s, with the precision map read off the whole checkpoint, MTP layer included, so its FP8 projections load as FP8. 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 layer.

Parameters:

context (ModelLoadContext)

Return type:

tuple[Glm5NextMTP, Glm5NextConfig]

construct_kv_params()​

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

source

Returns None, because the layer writes into the target’s caches.

It writes the last slot of the target’s latent, indexer and tail ring caches, which the target’s config declares when it speculates.

Raises:

ValueError – If the accelerator is neither an NVIDIA GPU nor a gfx950 AMD GPU, the only AMD target the KDA ops build for.

Parameters:

Return type:

None

initialize()​

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

source

Records the sequence length the pipeline resolved.

Parameters:

Return type:

MTPGlm5NextDraftArchConfig

max_seq_len​

max_seq_len: int

source