GLM-5 / GLM-5.1 / GLM-5.2 (MoE + DSA)
GLM-5 / GLM-5.1 / GLM-5.2 (MoE + DSA)
GLM-5, GLM-5.1, and GLM-5.2 are Zhipu AI’s open-source large Mixture-of-Experts models featuring a DeepSeek-style MLA (Multi-head Latent Attention) + DSA (Dynamic Sparse Attention) architecture. GLM-5.2 uses the same glm_moe_dsa AutoModel architecture with IndexShare DSA support, optional TileLang or cuDNN sparse kernels, packed-sequence training, and context-parallel long-context recipes.
Key Features
GLM-5 family models in NeMo AutoModel include the following capabilities:
- Mixture-of-Experts (MoE): DeepSeek-style MLA and sparse DSA attention
- IndexShare DSA for GLM-5.2: Shared DSA layers reuse the previous full layer’s top-k sparse attention selection, including pipeline-parallel carry support
- Optional TileLang kernels: GLM-5.2 DSA indexer and sparse MLA paths through
backend.attn: tilelang - Optional cuDNN DSA indexer and FlashMLA sparse attention: Available on SM90+ GPUs through
backend.attn: cudnn - Packed-sequence and context-parallel recipes: Support for 4K and 32K Tulu3-style SFT runs
- Large-scale parallelism: FSDP2, Expert Parallelism, Pipeline Parallelism, and optional Context Parallelism
Available Models
- GLM-5 (
GlmMoeDsaForCausalLM) - GLM-5.1 (
GlmMoeDsaForCausalLM): Updated weights - GLM-5.2 (
GlmMoeDsaForCausalLM): IndexShare DSA, TileLang and cuDNN sparse kernels, and long-context CP coverage
Example HF Models
Example Recipes
Parallel Setup
The HellaSwag recipes scale training using Expert Parallelism and Pipeline Parallelism (EP=64, PP=4 across 32 nodes of 8× H100 GPUs). The long-context GLM-5.2 recipe also enables CP=8, packed THD batches, and the TileLang DSA path.
Try with NeMo AutoModel
- Clone and install from source (full instructions):
The cuDNN backend also requires FlashMLA’s flash_mla_sparse_fwd, which is not
published as a complete source distribution on PyPI. Install the tested revision with its
submodules before selecting backend.attn: cudnn:
This is a long-context multi-node recipe that uses CP=8, EP=64, and PP=4. See the Launcher Guide for multi-node setup.
- Run the recipe from inside the repo:
Run with Docker
- Pull the container and mount a checkpoint directory:
- Navigate to the AutoModel directory (where the recipes are):
- Run the recipe:
See the Installation Guide and LLM Fine-Tuning Guide.
Fine-Tuning
See the LLM Fine-Tuning Guide and the Large MoE Fine-Tuning Guide.