Training

Pinned sources GLM‑5 report (arXiv 2602.15763v2) · no training code is published

  1. Start of training
  2. Pre‑training, generalweb data18T4KNTPMTPWhat trains: all3 shared MTP layers
  3. Pre‑training, code and reasoningcode, mathematics, science9T4KNTPMTPWhat trains: all
  4. Mid‑training 32Klong code and reasoning1T32KNTPWhat trains: all
  5. Mid‑training 128Klong context and agent data500B128KNTPWhat trains: all
  6. Mid‑training 200Kthe longest documents50B200KNTPWhat trains: all
  7. Base model, dense attention
  8. DSA warm‑up1,000 steps≈ 2.8B202,752KLto main attentionWhat trains: indexer+ indexer
  9. Sparse adaptationmid-training’s data20B200KLMKLselected positionsWhat trains: allsparse
  10. GLM-5 base model
  11. SFTchat, reasoning, agentsnot stated202,752SFTnot statednot stated: tokens, what trains
  12. Reasoning RLfour domainsnot statednot statedGRPO+ IcePopWhat trains: not indexernot stated: tokens, context
  13. Agentic RLasynchronousnot statednot statedGRPOWhat trains: not indexernot stated: tokens, context
  14. General RLhuman-style alignmentnot statednot statedGRPOWhat trains: not indexernot stated: tokens, context
  15. On‑policy distillationacross stagesnot statednot statedOPDnot statednot stated: tokens, context, what trains
  16. GLM-5
  • tokens, log scale
  • derived: computed from stated numbers
  • NTPdashed: concluded, no source names it
  • not stated by the sources
  • the architecture changes
  • checkpoint
  • checkpoint, weights published

Agentic RL

×

Asynchronous RL on coding and search agents, with over 10,000 verifiable software-engineering and terminal environments: rollouts and training run on separate GPUs.

GRPO, group relative policy optimization

For each prompt the model writes a group of answers; each is scored and compared with the group’s mean, and the model is moved toward the answers above it, by a step clipped near the policy that wrote them and with a penalty for leaving a reference model.

J=1G∑i=1G(min⁡(wiAi, wˉiAi)−βDi)wˉi=clip⁡(wi, 1−ε, 1+ε)\begin{aligned}J&=\frac1G\sum_{i=1}^{G}\Big(\min\big(w_iA_i,\ \bar w_iA_i\big)-\beta D_i\Big)\\\bar w_i&=\operatorname{clip}(w_i,\,1-\varepsilon,\,1+\varepsilon)\end{aligned}

DeepSeek-R1 paper, eq. 1 to 3, and DeepSeek-V3 report, eq. 26 to 28; for one prompt, in the atlas’s letters w, w̄, D

What the letters mean

wiw_i: answer ii’s probability under the model being trained over its probability under the policy that wrote it; AiA_i: its reward less the group’s mean, over the group’s standard deviation; DiD_i: a KL penalty to the reference model; GG: the group size; ε\varepsilon, β\beta: hyper-parameters. Maximized.

The GLM-5 report writes its own objective (§4.1, p. 15): rewards less the group’s mean, with no division by its spread and no KL term; the ratio taken to the rollout engine’s log-probabilities, and tokens outside [1−εℓ,1+εh][1-\varepsilon_\ell,1+\varepsilon_h] masked.

Environments
over 10K software-engineering environments, terminal and search tasks
Off-policy correction
token-level, masked outside a band

Not disclosed Steps · Learning rate · Group size

Why

Agent rollouts are long and uneven, and synchronous RL leaves GPUs idle waiting for the slowest; decoupling generation from training keeps them busy. GLM-5 report §4.1, p. 15

What the terms meanAsynchronous RL · Rollout
Asynchronous RL
Generation keeps a steady number of responses in flight, and training takes over the machines as soon as enough are finished; an unfinished response resumes under the updated model, so the model also learns from tokens an earlier version of itself wrote, and tokens that are too stale are left out of the loss.
Rollout
A response the policy writes during reinforcement learning, tool calls included, to be scored.
All settings5
Algorithm
Group-wise policy optimization: K traces per problem from the previous policy, each reward less their mean; only the model’s own tokens enter the loss (§4.1)
Asynchrony
Inference and training engines on separate GPUs; weights pushed to the rollout engines every K updates, the optimizer reset after each; samples whose oldest policy version is too stale are dropped
Off-policy correction
Token-level importance sampling against the rollout’s own log-probabilities; tokens outside [1 − ε_ℓ, 1 + ε_h] masked out of the gradient
Environments
Over 10K verifiable software-engineering environments across 9 languages, synthesized terminal tasks and multi-hop search tasks
Indexer
Frozen by default throughout the RL stages, its top-k by the deterministic torch.topk; non-deterministic top-k operators degraded RL drastically within a few steps
Sources6