Skip to main content
Implementation: radixark/miles#2786. It goes with the SGLang sglang-miles-glm53next branch and radixark/Megatron-LM#89; the image in section 3 pins all three.

1. Model Introduction

GLM-5.3-Flash (model_type: glm5_next) is a 45-layer KDA + DSA hybrid MoE. It is a different architecture from the 744 B GLM5 and GLM5.2 flagships, not a smaller cut of them.
  • 45 layers, hybrid: 34 KDA linear-attention layers + 11 DSA sparse-attention layers.
  • 288-expert MoE, sigmoid routing at top-8; the first 3 layers are dense.
  • mHC hyper-connections at every block.
  • NoPE MLA — multi-latent attention with the positional half of the QK head empty.
  • kpool-compressed lightning indexer picks which keys the DSA layers attend.
  • Hidden 4096, FFN 12288, 64 attention heads, vocab 154880, rotary base 800000.
  • MTP is dropped for training.

2. Supported Variants

3. Environment Setup

Use docker.io/radixark/miles:glm53next — the rolling radixark/miles:dev image with the three moving parts checked out at the versions this recipe was built against, multi-arch so the same tag serves GB300 and x86 nodes.
The reference checkpoint has to be converted first — --ref-load resolves to <--ckpt-dir>/<megatron_model_type>_torch_dist:

4. Launch

Bring up a ray cluster across the nodes, export MILES_SCRIPT_EXTERNAL_RAY=1, then on the head node:
Smoke slice on one node:
The PP-4 shapes run 11 / 11 / 11 / 12 layers per stage, since 45 does not divide by 4. GRPO on DAPO-Math-17k, Adam at lr 1e-6, max_tokens_per_gpu 8192, full uniform recompute. Rollout is colocated, with the trainer offloaded to disk; both DSA paths run on tilelang and the KV cache is BF16. Routing replay turns on with --enable-r3.

5. What a Healthy Run Looks Like

From the validation run in #2786 — 16 nodes × 4 GB300, DAPO on DAPO-Math-17k: train/train_rollout_logprob_abs_diff is the one to read first on a fresh bring-up: it covers the KDA, DSA and hyper-connection paths at once.

6. LoRA RL

scripts/run_glm5_3_flash_lora.py trains a LoRA adapter through native LoRA (--megatron-to-hf-mode raw): the trainer is the glm5_next model of section 4, loaded from the torch_dist base of section 3, and miles.backends.megatron_utils.lora.native attaches the adapters. With --lora-base-cpu-backup SGLang keeps the frozen base across colocated offload and onload, so each step syncs only the adapter. The 288 routed experts stay frozen, since native LoRA has no per-expert adapter. kv_b_proj stays frozen too: the DSA attention absorbs its weight into the query and output without calling the module, so an adapter on it would never run. The launcher’s --target-modules attn,mlp --exclude-modules "*.mlp.experts.*,*.self_attn.kv_b_proj" selects exactly the table, and selecting a frozen projection fails at argument validation. The KDA conv1d, A_log, dt_bias and o_norm, the DSA indexer and the mHC parameters are not LoRA targets. Serving the adapter needs SGLang LoRA on the KDA projections, which sglang-miles does not have yet; it is in sgl-project/sglang#44862.