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 sparse kernels, packed-sequence training, and context-parallel long-context recipes.
Key Features
- Mixture of Experts (MoE) with 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 for GLM-5.2 DSA indexer and sparse MLA paths through
backend.attn: tilelang - Packed-sequence and context-parallel recipes for 4K and 32K Tulu3-style SFT runs
- Large-scale parallelism with 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 sparse-kernel recipes, 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 additionally enables CP=8, packed THD batches, and the TileLang DSA path.
Try with NeMo AutoModel
1. Clone and install from source (full instructions):
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.
2. Run the recipe from inside the repo:
Run with Docker
1. Pull the container and mount a checkpoint directory:
2. Navigate to the AutoModel directory (where the recipes are):
3. 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.