Deep Dive into the GLM-5 Technical Report: Architecture, Training, and Deployment
This article breaks down the GLM-5 open-weight model technical report, focusing on its MoE fundamentals, three architecture-level changes (MLA with Muon Split optimization, multi-token prediction, and DSA sparse attention), and practical guidance for memory budgeting, long-context validation, throughput tuning, and deployment. Readers will gain a clear understanding of how sparse activation, low-rank attention, and denser training objectives work together to control cost and maintain training stability.
1. Why This Technical Report Deserves a Line-by-Line Breakdown
The capability boundary of open-source models is being pushed higher at a rapid pace. According to public evaluation leaderboards, the new generation of open-weight models has reached the 50-point range in composite intelligence indices for the first time, ranking first among open-source models in both text and code arenas and sitting in the same tier as the top closed-source models overseas. The significance of these results lies not in the rankings themselves, but in what they demonstrate: an architecture centered on sparse activation can decouple “parameter scale” from “inference cost” to an extent that is engineering-feasible.
It is worth emphasizing that leaderboard scores are only the entry point. What developers should really focus on are three architecture-level changes described in the report: the co-design of attention and optimizer, the multi-token prediction training objective, and the sparse attention mechanism. These correspond to three independent problems: training stability, data efficiency, and long-context cost. Each is discussed in detail below.
2. Fundamentals: Scale, Activation Volume, and Data Mix
This generation continues the Mixture of Experts (MoE) route, with approximately 744B total parameters and about 40B activated per inference, 256 experts, and 80 layers. Compared with the previous generation (355B total parameters, 32B activated), the total parameter count has doubled, activated parameters have increased by about 25%, and the pre-training corpus has grown from 23T tokens to 28.5T tokens, of which about 27T is used for pre-training and 1.5T for mid-training.
These figures carry two engineering implications that are easy to overlook:
- Declining activation ratio. The previous generation had an activation ratio of about 9%; this generation drops to about 5.4%. Total parameters grow far faster than activated parameters, meaning the expansion mainly buys “knowledge capacity” rather than “compute per token”.
- Mid-training is listed separately. The 1.5T-token mid-training stage is typically used for quality improvement, long-context extension, and capability alignment. It is not counted in the main pre-training budget, yet it is a key source of long-text performance.
An illustrative capacity calculation logic (not official figures, only demonstrating the order-of-magnitude relationship):
total_params = 744e9activated_params = 40e9experts, layers = 256, 80print(f"Activation ratio: {activated_params / total_params:.2%}") # ~5.38%print(f"Experts per layer: {experts / layers:.1f}") # ~3.2, indicating experts are not evenly distributed across layers
3. Change One: Splitting Latent Attention from Optimizer Orthogonalization
On the attention side, the model adopts Multi-head Latent Attention (MLA), which shares the same origin as existing low-rank KV compression schemes in the industry: projecting the key-value cache into a low-dimensional latent space and caching only the compressed vectors, thereby significantly reducing memory footprint and bandwidth pressure under long sequences.
However, the training team encountered a new problem: commonly used matrix-orthogonalization optimizers (Muon-like methods) require orthogonalizing the entire projection matrix, whereas MLA weights are split into a two-part low-rank structure of “down-projection compression + up-projection”. Orthogonalizing the concatenated whole matrix breaks the semantics of this low-rank decomposition, causing the update direction to mismatch the parameter structure and leading to instability in early training.
The solution is summarized as Muon Split: lowering the orthogonalization granularity from “the whole matrix” to “each attention head processed individually”. Its effects are:
- Preserving low-rank structure integrity, with no cross-projection-segment mixed updates;
- Making update scales more uniform across heads, avoiding individual heads dominating gradients;
- Reducing the scale of orthogonalization computation, keeping overhead controllable.
Pseudocode illustration:
def muon_split_update(W_down, W_up, num_heads):# No longer orthogonalize [W_down; W_up] as a wholefor h in range(num_heads):d, u = W_down[h], W_up[h]g = build_head_grad(d, u)d -= lr * orthogonalize(g) # intra-head orthogonalizationu -= lr * orthogonalize(g.T)return W_down, W_up
Engineering takeaway: when the model structure moves from “dense whole-block” to “low-rank + per-head”, the optimizer cannot retain default settings and must be modified accordingly; otherwise the structural gains will be consumed by training instability.
4. Change Two: Multi-Token Prediction
Multi-Token Prediction (MTP) adds several prediction heads on top of the standard next-token objective, allowing the model to predict tokens at multiple future positions in a single forward pass. The benefits come in three layers:
- Denser training signal: the same batch of data provides supervision over longer dependencies, mitigating the short-sightedness of “only looking at the previous word”;
- Higher data efficiency: at the 28.5T-token scale, this is equivalent to improving the utilization of unit corpus;
- Inference acceleration: the extra prediction heads are naturally suited to speculative decoding, with drafts generated by the model itself and acceptance rates typically higher than those of an independent small model.
Input: x1 x2 x3 x4 x5Main head: -> y2 (standard objective)Aux head 1: -> y3Aux head 2: -> y4Loss: L = L_main + λ1*L1 + λ2*L2
Note: the weights of auxiliary heads need annealing; during inference, only the main head can be retained to save memory, or all heads can be kept in exchange for throughput. This is an adjustable knob at deployment time.
5. Change Three: Sparse Attention
The third change is DSA sparse attention: instead of having each query attend to all history, a lightweight scorer first selects a small number of key positions, and precise attention is then performed only on the selected set. It is complementary to MLA—MLA compresses “the cache volume per token”, while DSA reduces “the number of tokens that need to be accessed”.
# Two-stage attention: coarse filtering + precise computationscores = lightweight_score(q, k_cache) # low-dimensional scoringidx = topk(scores, k=2048) # sparse selectionout = precise_attention(q, k_cache[idx]) # precise computation only on selected items
Complexity drops from O(n²) to approximately O(n·k), benefiting both memory footprint and latency for long documents and repository-level code contexts. The cost is the need to ensure recall of the top-k selection; during training, an annealing strategy is typically used to gradually tighten sparsity.
6. Deployment Recommendations
- Memory budget: estimate compute based on activated parameters (~40B) rather than total parameters, and estimate weight loading and cache overhead based on total parameters;
- Long-text scenarios: prioritize validating the recall quality of sparse attention at the target length, rather than only looking at first-token latency;
- Throughput tuning: treat the number of MTP heads and speculative draft length as stress-test variables;
- Training-side modifications: if training a low-rank attention structure yourself, be sure to adjust the optimizer orthogonalization granularity accordingly;
- Deployment topology: container platforms host inference services, object storage hosts weights, and logging services with monitoring and alerting cover latency, memory, and acceptance-rate metrics.
Overall, the value of this generation of open-source models lies not only in scores, but in providing a replicable path: using sparse activation to control unit cost, using low-rank attention and sparse selection to control long-context overhead, using denser training objectives to improve data efficiency, and using optimizer modifications to safeguard training stability.
