Skip to main content

1. Model Introduction

GLM-5 is the most powerful language model in Zhipu AI’s GLM series, scaling to 744 B parameters (40 B active) and integrating DeepSeek Sparse Attention (DSA) for long-context efficiency. GLM-5.1 is the next-generation model for agentic engineering on top of GLM-5, sharing the same model architectures, Key highlights:
  • Sparse MoE at frontier scale: 744 B total / 40 B active per token, 256 routed experts top-8 + 1 shared.
  • MLA + DSA attention: Multi-head Latent Attention (q-LoRA 2048 / kv-LoRA 512) combined with DeepSeek Sparse Attention to keep KV-cache cost low at long context.
  • Speculative decoding: EAGLE/MTP rollout supported via --enable-mtp.
  • PD disaggregation: prefill/decode disaggregation enabled by default for ≥1 node.

2. Supported Variants

3. Environment Setup

3.1 Download model + datasets

The Python launcher’s prepare subcommand handles download + dataset staging:

3.2 HF → Megatron torch_dist conversion

Also handled by prepare. Before conversion the launcher validates, via _validate_glm_checkpoint, that the checkpoint uses the native GLM-5 config (model_type=glm_moe_dsa, architectures=[GlmMoeDsaForCausalLM]) and fails fast if it does not, then converts it to the glm5-744B-A40B Megatron model type. Run prepare-cp afterwards on every node to copy the converted checkpoint from shared NFS to local disk.

4. Launch

4.1 Quick start

The Typer app exposes four subcommands:
The launcher’s docstring says it’s tested on H200 / B200 / GB300; the dataclass restricts --hardware to {H200, B200, GB300}.

5. Recipe Configuration

5.1 Parallelism

Verbatim from _execute_train, --num-nodes ≥ 16 branch: Plus --use-dynamic-batch-size, --data-pad-size-multiplier 4096, --log-probs-chunk-size 1024, --recompute-granularity full --recompute-method uniform --recompute-num-layers 1.

5.2 Algorithm

GRPO with --eps-clip 0.2 --eps-clip-high 0.28. R3 (--use-rollout-routing-replay) is not enabled by default.

5.3 Rollout & SGLang

Always-on flags:

5.4 Optimizer

--enable-optimizer-offload adds --optimizer-cpu-offload --overlap-cpu-optimizer-d2h-h2d --use-precision-aware-optimizer (opt-in).

5.5 Notable quirks

The launcher exposes these as flags:
  • --fp8-rollout — runs tools/convert_hf_to_fp8.py --strategy block --block-size 128 128 and feeds the FP8 directory to SGLang (Megatron stays BF16).
  • --enable-mtp — adds SGLang EAGLE speculative decoding (--sglang-speculative-{algorithm,num-steps,eagle-topk,num-draft-tokens}).
  • --enable-pd (default True for ≥1 node) — enables prefill/decode disaggregation; with PD the launcher uses larger SGLang world sizes (16 for <16 nodes, 64 for ≥16 nodes).
  • --use-deepep (default True) — enables Megatron-side DeepEP (--moe-enable-deepep --moe-token-dispatcher-type flex); falls back to alltoall. Forced off on GB300.

6. Pairs Well With