GLM-4.5 技术报告解读:Agentic、推理与编码三位一体的基座模型

解读 GLM-4.5 的架构取舍——以更深的 MoE 层数与更多的注意力头换取推理能力,并梳理其预训练与中期训练数据配方、基础设施设计,以及两阶段的专家模型迭代式后训练流程。

GLM-4.5 技术报告摘要

论文:GLM-4.5: Agentic, Reasoning, and Coding (ARC) Foundation Models
团队:Zhipu AI & Tsinghua University
时间:2025.08(arXiv:2508.06471)
页数:26页


1. 预训练 Recipe

训练策略

项目详情
架构MoE,GLM-4.5: 355B总参/32B激活; GLM-4.5-Air: 106B总参/12B激活
MoE层GLM-4.5: 89 MoE layers + 3 Dense layers + 1 MTP layer
Experts160total, 8 active/token + 1 shared expert
RoutingLoss-free balance routing + sigmoid gates
AttentionGQA with partial RoPE, 96heads (hidden dim 5120), QK-Norm
MTPMoE layer作为MTP layer支持speculative decoding
优化器Muon (Newton-Schulz iter=5, momentum=0.95, update RMS=0.2) + cosine decay (非WSD)
LRwarmup 0→2.5e-4, decay to 2.5e-5
Batchwarmup 16M→64M tokens (前500B tokens内)
总Token23T (15T pre-training + 7T continued pre-training + mid-training)
序列长度4K(pre-training) → 32K → 128K (mid-training)
RoPE base10,000 → 1,000,000 (at 32K extension)

关键架构发现

  • 增加深度优于宽度:相比DeepSeek-V3/Kimi K2,GLM-4.5减小hidden dim和routed experts数量,增加层数(89MoE layers vs DeepSeek-V3的58),因为更深的模型展示更好的推理能力
  • 2.5x Attention Heads:96heads/5120 hidden dim(比常规多2.5倍)。训练loss无改善,但reasoning benchmarks (MMLU, BBH) 显著提升

    训练数据(Pre-training + Mid-training)

项目详情
Pre-training corpus15T tokens:网页、社交媒体、书籍、论文、代码仓库
Web数据中英网页,按quality score分bucket,高质量bucket上采样(受Nemotron-CC启发)
Mid-training7T tokens (continued pre-training)

Mid-training 四阶段:

阶段数据序列长度
Code & Reasoning Continual Pre-trainingrepo-level代码(同repo文件concat学习cross-file dependency)+ GitHub issues/PRs/commits (diff格式)32K
Synthetic Reasoning Data从网页/书籍收集数学/科学/编程竞赛QA,用reasoning model合成推理过程32K
Long Context & Agent长文档上采样 + 大规模合成agent轨迹128K
(各~500B/500B/100B)

Infra设计

项目详情
原文未详述pre-training Infra(但报告末尾开源了SlimeRL框架)

2. 后训练 Recipe(Expert Model Iteration)

两阶段设计

Stage 1: Expert Training

  • 构建3个domain expert: Reasoning Expert、Agent Expert、General Chat Expert
  • 每个expert: Cold Start SFT →RL

Stage 2: Unified Training

  • Self-distillation: 从3个expert收集数据训练统一hybrid reasoning模型
  • Overall SFT: 百万级sample覆盖reasoning/general chat/agentic/long-context任务
  • 精心平衡thinking data和non-thinking data,产出hybrid reasoning model

SFT关键策略

项目详情
Cold Start SFT小量带extended CoT的数据,为每个expert提供基础能力
Overall SFT从各expert distill数据训练统一模型,max context=128K
关键技巧减少Function Call模板中的character escaping(代码参数不用JSON转义,降低模型学习负担)
Hybrid模式平衡有reasoning的数据和无reasoning的数据,让模型学会在两种模式间切换

3. RL Recipe

训练策略

项目详情
算法GRPO(去除KL loss)
ExpertRL分别对Reasoning/Agent/Code expert独立做RL
Unified RL整合后的模型再做一轮RL

关键设计

① Difficulty-based Curriculum Learning

  • 原文提到基于难度的课程学习策略(细节在smaller experimental model上验证)

② Dynamic Sampling Temperature

  • 问题:固定temperature无法适应policy分布变浓(entropy降低),后期探索不足
  • 做法:当rollout平均reward趋于稳定时,识别为convergence phase,提升temperature
  • 质量控制:周期性在held-out set上评估多个temperature,选不导致>1%性能下降的最大temperature

③ Token-weighted Mean Loss (CodeRL)

  • 问题:sequence-mean loss对代码RL收敛慢
  • 做法:使用token-weighted mean loss
  • 效果:更细粒度且稳定的梯度信号,显著加速收敛

④ Science RL:高质量小数据优于大规模混合数据

  • 发现:仅用小量expert-verified multiple-choice题做RL (GPQA 65.8%),显著优于混合质量科学数据 (62.9%)

⑤ 直接在Full-length (64K) 做RL

  • 持续推高模型上限,优于短contextRL

Infra设计:Slime RL框架(开源)

项目详情
框架名Slime
核心模块Training (Megatron) + Rollout + Reward
特点灵活性+效率兼顾
已开源随报告开源

4. 关键亮点

  1. 深度优于宽度:89层MoE (vs DeepSeek-V3的58层),更深=更强推理
  2. 2.5x Attention Heads:不改loss但提升reasoning benchmarks
  3. Expert Model Iteration:3个domain expert独立RL → self-distillation统一
  4. Dynamic Sampling Temperature:基于reward稳定性自适应调节探索-利用平衡
  5. Token-weighted Mean Loss:代码RL加速收敛
  6. 高质量小数据>大规模混合数据:Science RL的关键发现
  7. Muon优化器+ Cosine Decay:比WSD schedule在general benchmarks上更优
  8. Slime RL框架:开源,Megatron-based
本文结束 感谢您的阅读