A Deep Dive into the GLM-5 Technical Report: Architecture, Sparse Attention, and Asynchronous RL
This article breaks down the GLM-5 technical report for developers, covering its MoE base design, low-rank attention, multi-token prediction, sparse attention that matches dense attention with far fewer tokens, a fully asynchronous RL training framework, and the self-built training infrastructure behind it. It also includes a reusable checklist for applying these engineering practices under limited compute.
1. Why This Technical Report Is Worth Reading Page by Page
The value of a public large model technical report is not in the scores it claims, but in how it decomposes “quality improvements” into reproducible engineering decisions. After a new flagship model in an open-source model family released its full technical documentation, community discussion quickly focused on three things: how attention is sparsified, how reinforcement learning training escapes synchronous waiting, and how training and inference infrastructure was built in-house to support experiments at extreme scale.
On public benchmarks, this class of open-source flagship now competes with the top closed-source models overseas in the same tier, with wins and losses on different areas: on composite intelligence index evaluations, the open-source side reached the 50-point range for the first time and ranked first among open-source models; on human-preference arena leaderboards, both the text and code sub-rankings also placed first among open-source models, putting them in the same range as the leading closed-source models. What matters is not the ranking itself but how the gap was compressed — trading compute for architectural efficiency, and time for training frameworks.
2. Base Model Fundamentals: Rebalancing Parameter Count and Activation Size
The new base model continues with a Mixture-of-Experts (MoE) design: roughly 744B total parameters, about 40B activated per inference, 256 experts, and 80 layers. Compared with the previous generation (355B total, 32B activated), total parameters doubled while activated parameters rose only slightly, and the training corpus grew from around 23T tokens to 28.5T tokens (about 27T for pre-training and 1.5T for mid-training).
Three engineering implications sit behind these numbers:
- Decoupling capacity from cost: Total parameters set the upper bound on knowledge capacity, while activated parameters determine the compute per forward pass. Putting the incremental budget into “expert capacity” rather than “activation width” is the key lever for controlling inference cost.
- Mid-training becomes a standalone stage: The 1.5T-token mid-training phase is not simply “continued pre-training” but targeted reinforcement of long context, code, and reasoning, requiring separate design for data mixture and learning-rate scheduling.
- Data scale is plateauing: The increase from 23T to 28.5T is far smaller than the increase in parameters, indicating the focus has shifted from “feeding more data” to “producing stronger training signals from the same data.”
3. Breaking Down the Three Architecture Changes
3.1 Low-Rank Attention Plus Optimizer Sharding
On the attention side, the model uses a multi-head latent attention (MLA) approach derived from the same lineage as mainstream long-context solutions: keys and values are compressed into a low-dimensional latent space for caching and projected back up at inference time, sharply reducing memory footprint and bandwidth pressure. The direct benefit is a lower per-token cost in long-context scenarios; the cost is extra computation from the projection matrices and added implementation complexity.
The accompanying optimizer change — sharding states such as momentum by dimension instead of keeping the full state resident — addresses a different bottleneck: at the trillion-parameter scale, optimizer state memory often exceeds the weights themselves. Sharding that state and aligning it with the parallelism strategy significantly lowers peak per-GPU memory, making larger batches and longer sequences feasible at the same time.
Illustrative pseudocode:
# Core of low-rank attention: compress first, project up laterc_kv = x @ W_dkv # compress to latent space, cache only c_kvk = c_kv @ W_uk # expand when neededv = c_kv @ W_uvout = softmax(q @ k.T / scale) @ v
3.2 Multi-Token Prediction
Multi-token prediction (MTP) makes the model predict tokens at several future positions at once during training, providing a denser supervision signal for representation learning. At inference time, the extra prediction heads can act as a draft model for speculative decoding, turning “one token at a time” into “verify multiple candidates at once.” Two engineering points matter: the loss weights of the prediction heads need annealing during training so the main task is not diluted; and at inference the acceptance rate determines the actual speedup, since poor draft quality can slow throughput instead.
3.3 Sparse Attention: Matching 943B Tokens with 20B Tokens
The most debated and most valuable point in the report is that sparse attention let roughly 20B tokens of training match the performance of about 943.7B tokens with dense attention on specific evaluations. The logic is not mysterious: in dense attention, a large share of attention weights are near zero and represent wasted computation; sparsification concentrates the budget on the few connections that actually carry information, effectively raising the density of “useful tokens.”
Practical sparsification usually follows one of three routes:
- Static block sparsity: Skip computation with a fixed block mask; simple to implement and hardware-friendly, but rigid in pattern.
- Dynamic selection-based sparsity: Score at coarse granularity, then take the top-k blocks; flexible, but needs stable routing and load balancing.
- Hybrid: Local windows preserve nearby information while a few global tokens preserve long-range paths, balancing recall and cost.
Whichever route is chosen, training stability depends on suppressing “routing collapse”: a combination of auxiliary load-balancing loss, capacity factor, and random routing is needed, otherwise a few experts or a few blocks get selected repeatedly and sparsity degrades into inefficient density.
4. A Fully Asynchronous Reinforcement Learning Training Framework
Traditional RL training is synchronous: sampling, scoring, and updating run strictly in sequence, and long-tail samples make the whole batch wait for the slowest trajectory, keeping GPU utilization low over time. The fully asynchronous approach decouples generation from learning — the inference cluster continuously produces trajectories into a queue, and the training side consumes them in available batches, with stale samples controlled through importance-sampling correction or proximal constraints.
The benefits are a significant end-to-end throughput gain and no more blocking on long tails; the risk is more off-policy samples causing training oscillation. In practice this requires three things: a cap on data staleness, per-sample weight clipping, and a rollback-capable checkpoint mechanism.
Inference cluster --trajectories--> Experience queue --batches--> Training cluster^ |+---------------- weight version sync --------------+
5. Self-Built Training Infrastructure and Engineering Takeaways
Supporting these experiments is a self-built training stack aimed at large-scale RL: unified orchestration of generation and training roles, fine-grained parallelism with memory reuse, fault tolerance with automatic rescheduling, and end-to-end metrics observability. Most teams do not need to build this from scratch, but should prioritize three general capabilities: containerized elastic scheduling, dataset and checkpoint management on object storage, and a logging, monitoring, and alerting system. Running on a platform with complete cloud-native capabilities, such as Baidu AI Cloud, lets you reuse general capabilities like the container platform, object storage, log service, and monitoring and alerting, and focus your effort on the algorithm and data side.
6. A Reusable Practice Checklist
- Validate the sparsity pattern and routing balance on a small-scale proxy task before scaling to full training.
- Design optimizer state sharding together with the parallelism strategy; do not patch memory problems after the fact.
- Use an annealing strategy for multi-token prediction weights, and tune inference around acceptance rate as the core metric.
- For asynchronous RL, always set a data staleness cap and weight clipping, and keep the ability to roll back quickly.
- Separate evaluation into three categories — composite intelligence, human preference, and code and long context — to avoid single-point conclusions.
Overall, the methodology of this generation of open-source models can be summarized as: spend compute on effective connections, spend time on parallel pipelines, and converge complexity into self-built infrastructure. For developers, the real takeaway is not a particular score but an engineering paradigm that approaches the leading closed-source tier under limited compute.
