Skip to content

GLM-5: from Vibe Coding to Agentic Engineering

Skip →MiMo-V2.6
RL stage 2 #9extendedfrontierpaperrubric 10/122026 · ~35 min

GLM-5 Team (Aohan Zeng, …, Jie Tang)

Status

TL;DR. GLM-5 is Zhipu’s successor to GLM-4.5. It is a 744B-total / 40B-active MoE with 256 experts and 80 layers. Its sparse attention is DeepSeek-V3.2’s DSA, added through continued training on only 20B adaptation tokens after a 1000-step indexer warm-up. Post-training runs in this order:

  1. SFT with a 202,752-token context and interleaved thinking;
  2. Reasoning RL;
  3. Agentic RL;
  4. General RL;
  5. On-policy cross-stage distillation at the end, to recover skills that earlier stages lost.

The agentic RL is fully asynchronous and runs on slime. It relies on a token-in-token-out (TITO) gateway and a simple double-sided importance-sampling mask. All numbers are vendor-reported.

Asynchronous agentic RL without π_old. Rollout and training run on separate GPUs, and weights are pushed to the inference engine every K updates. The optimizer is reset after each push. Three mechanisms keep this stable:

  • TITO gateway. It records the exact token IDs the inference engine produced, so the trainer never re-tokenizes text and gets a mismatched action sequence.
  • Direct double-sided IS. The ratio rt=exp⁡(log⁡πθ−log⁡πrollout)r_t=\exp(\log\pi_\theta-\log\pi_{\text{rollout}}) uses the stored rollout log-probs. Tokens outside [1−ϵℓ,1+ϵh][1-\epsilon_\ell,1+\epsilon_h] are masked. This is simpler than IcePop because it drops πθold\pi_{\theta_{old}}.
  • Sample hygiene. A trajectory is dropped if its oldest policy version is staler than τ. Environment-crash failures are removed and their groups padded.

Cross-stage OPD. The final checkpoints of earlier stages act as teachers. The GRPO advantage is replaced with

A^i,t=sg ⁣[log⁡πteacherinfer(yi,t∣x,yi,<t)πθtrain(yi,t∣x,yi,<t)],\hat A_{i,t}=\mathrm{sg}\!\left[\log\frac{\pi^{\text{infer}}_{\text{teacher}}(y_{i,t}\mid x,y_{i,<t})}{\pi^{\text{train}}_{\theta}(y_{i,t}\mid x,y_{i,<t})}\right],

with group size 1 and batch 1024. A group is unnecessary because the teacher supplies the baseline.

Results and discussion. Table 7, vendor-reported:

BenchmarkGLM-5GLM-4.7DeepSeek-V3.2Kimi K2.5Claude Opus 4.5GPT-5.2 (xhigh)
SWE-bench Verified77.873.873.176.880.980.0
Terminal-Bench 2.0 (Terminus-2)56.241.039.350.859.354.0
BrowseComp with context management75.967.567.674.957.865.8
τ²-Bench89.787.485.380.291.685.5
MCP-Atlas67.852.062.263.865.268.0

Baseline columns are as reported in GLM-5’s table, under its own settings; they can differ from a model’s own report. For example, DeepSeek-V3.2’s τ²-Bench is 85.3 here but 80.3 in DeepSeek-V3.2’s report. Compare scores only within one source and harness.

On a verified Terminal-Bench 2.0 that fixes ambiguous instructions, GLM-5 scores 60.7. GLM-5 still trails Claude Opus 4.5 on SWE-bench. The report also evaluates long-horizon tasks: Vending-Bench 2 and CC-Bench-V2.

  • SWE environments. Issue–PR pairs are filtered by rules and LLMs and labeled as bug fix, feature, refactor and so on. A RepoLaunch-based pipeline builds executable environments, and an LLM writes language-aware log parsers that extract F2P and P2P tests. The result is more than 10K verifiable environments across thousands of repositories in 9 languages.
  • Terminal environments. Built two ways, both in Harbor format:
    • from seed tasks: draft → construction agent → iterative optimization;
    • from a web corpus: a coding agent turns a code page into a task and must pass the Harbor validation script itself before the task is admitted.
  • Search data. A web knowledge graph is built from more than 2M high-information pages that an early search agent visited. Questions come from multi-hop subgraphs around low- to mid-frequency entities. Three-stage filtering removes:
    • questions a tool-free model answers in any of 8 tries;
    • questions a basic early agent solves in a few steps;
    • questions whose answers are not unique or are inconsistent, found by a bidirectional verification agent.
  • Rewards. General RL mixes rule-based rewards, ORMs and GRMs. ORMs are low-variance but hackable; GRMs are more robust but higher-variance. Slides use a 3-level reward (static markup, runtime rendering, visual), plus rejection sampling and masking of defective pages.
  • Asynchronous RL. The TITO gateway, double-sided IS without π_old, optimizer reset per weight sync, staleness threshold τ, crash-aware group padding, and more than 1K concurrent rollouts.
  • Distillation. On-policy cross-stage distillation as the final stage, rather than one merged RL stage as in DeepSeek-V3.2. This is the same per-token reverse-KL signal as on-policy distillation.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    GLM-5's agentic RL uses r_t = π_θ/π_rollout, computed from the log-probs saved at rollout time, and masks any token whose ratio leaves [1−ε_l, 1+ε_h]. Take ε_l = ε_h = 0.2 for illustration. For five tokens with ratios 0.75, 0.95, 1.10, 1.25 and 1.6, which get a gradient, and how does this differ from PPO clipping? Then apply the staleness rule: a trajectory spans policy versions (w_0, …, w_k), the trainer is at version w′ = 12, and τ = 3. Which of these are kept: (8, 9), (9, 10, 11), (10, 12)?

    What a strong answer covers
    • Kept interval [0.8, 1.2]: tokens with 0.95 and 1.10 get gradients; 0.75, 1.25 and 1.6 are masked entirely (zero gradient).
    • PPO clipping is sign-dependent: with A > 0, a ratio of 1.25 is clipped (no gradient), but a ratio of 0.75 still gets a gradient through the unclipped branch of the min. Double-sided masking drops both tails regardless of the advantage sign.
    • No π_old forward pass is needed, because the rollout log-probs act as the behavior policy. The report accepts this "controlled degree of off-policy bias" for simplicity and stability.
    • Staleness uses the oldest version: 12 − 8 = 4 > 3, so (8, 9) is dropped. 12 − 9 = 3 and 12 − 10 = 2, so the other two are kept.
    • Samples that failed because the environment crashed are removed. If more than half the group survives, valid samples are repeated to pad it; otherwise the whole group is dropped.
  2. What if…

    GLM-5's BrowseComp numbers move a lot with test-time context management. Explain the three settings (none, keep-recent-k, hierarchical) and their reported scores, and say what this means for comparing search agents.

    What a strong answer covers
    • Without context management: 55.3%. Keep-recent-5 (only the 5 most recent tool-call rounds stay in context): 62.0%.
    • Hierarchical: keep-recent-k plus Discard-all whenever the context exceeds T = 32K, after which the agent restarts with fresh history. It reaches 75.9, versus 67.6 for DeepSeek-V3.2 with context management.
    • Motivation: accuracy degrades badly beyond about 100K tokens, so less context can mean better reasoning, not only more steps.
    • A comparison must therefore fix the context-management policy and the step or token budget. Otherwise a score of 55 vs 76 measures the scaffold, not the model.
  3. Critique

    In slides RL, the policy learned layout hacks that fooled static HTML checks (Fig. 9). Describe the three-level reward GLM-5 used, why runtime rendering resists these hacks, and what remains unverified in the reported 40% → 92% improvement.

    What a strong answer covers
    • Level 1 checks static markup attributes such as positioning, spacing, colour and typography. Level 2 checks runtime rendering properties such as DOM element sizes and bounding boxes, measured by a distributed rendering service. Level 3 checks visual perceptual features, such as abnormal whitespace.
    • Static rules can be satisfied by declarations that do not reflect what is actually displayed. Rendering gives grounded geometry, so hidden overflow or a fake aspect ratio is caught.
    • Reported: pages strictly 16:9 rose from 40% to 92%, and human win rates against GLM-4.5 were 60% for content quality, 57.5% for layout rationality and 65% for visual aesthetics (67.5% overall).
    • Still open: the human evaluation is internal; rejection sampling reuses the same reward as the RL, so it can amplify that reward's blind spots; and no held-out aesthetic judge is reported.

Done with this page?

Status