nemo_automodel.components.models.glm5_next.mtp
nemo_automodel.components.models.glm5_next.mtp
GLM-5.3-Flash multi-token prediction (MTP) head.
The released checkpoint stores one MTP layer after the decoder stack, as
model.language_model.layers.{num_hidden_layers}. It is a plain pre-norm
residual block (no mHC) with the same NoPE MLA + KPool indexer attention and
routed MoE as the sparse decoder layers:
fused = eh_proj(cat(enorm(next_token_embedding), hnorm(h_prev))) hidden = fused + self_attn(input_layernorm(fused)) output = final_layernorm(hidden + mlp(post_attention_layernorm(hidden)))
h_prev is the backbone output after its final norm, and the shared
lm_head projects output for the auxiliary loss. final_layernorm
is stored as shared_head.norm in the checkpoint.
Module Contents
Classes
API
Bases: MTPModule
GLM-5.3-Flash MTP stack: one Glm5NextMTPSublayer per depth.
Parameters:
GLM-5.3 text config.
Enabled MTP config with the single-sublayer pattern "*".
MoE config shared with the decoder’s sparse layers.
Kernel backend selection.
Parameter dtype of the fusion projection and norms.
Initialize every depth on buffer_device.
Update every depth’s routing correction bias.
Bases: Module
One GLM-5.3-Flash MTP depth: embedding fusion, sparse MLA, MoE and final norm.
Parameters:
GLM-5.3 text config.
Checkpoint layer index of this depth (num_hidden_layers + depth).
MoE config shared with the decoder’s sparse layers.
Kernel backend selection.
Parameter dtype of the fusion projection and norms.
Predict one token further ahead.
Parameters:
Previous depth’s output (the backbone’s final-norm
output for depth 1) with shape [batch, local_sequence, hidden].
Embedding of the token depth positions ahead, in the
same local layout, zero where that token leaves the document.
Document map shared with the backbone attention.
Optional [batch, local_sequence] mask, True on padding.
Returns: torch.Tensor
Normalized hidden states [batch, local_sequence, hidden] for the
Initialize a checkpoint-free MTP depth on buffer_device.
Update this depth’s no-aux-loss routing correction bias.