Zhipu AI Launches GLM-5.4 with Loop Transformer for Generalized Coding
Summary:Zhipu AI has introduced GLM-5.4, the first flagship model from the company to use a Loop Transformer. Instead of increasing parameter count, the architecture repeatedly executes a block of shared-weight layers, trading additional forward computation for greater effective reasoning depth. Three systems optimizations are central to the design: token-wise gated residual updates, globally shared KV caches supplemented with an independent sliding window, and reuse of sparse-attention indices across l
GLM-5.4: Expanding Reasoning Depth with a Loop Transformer
Zhipu AI has released the flagship GLM-5.4 and applied a Loop Transformer to its own large-scale foundation model. Rather than adding a separate stack of deeper layers, the design repeatedly executes a group of shared-weight layers, purchasing additional computational depth without materially increasing parameter count. GLM-5.4 targets what Zhipu calls generalized coding: using code generation and execution chains for tasks extending into video, 3D, CAD, and mechanical design. The model is available to all GLM Coding Plan users and has been integrated into ZCode, Trae, WorkBuddy, Qoder, and other platforms. Its API remains pending a safety review, while open-weight release is currently only a stated plan.
Decoupling Network Depth from Parameter Count
In a standard Transformer, each stacked layer normally executes once. Adding depth increases representational capacity, but it also raises the weight, training, and memory-access costs. A Loop Transformer takes a different path: shared-weight layers execute repeatedly within the same task, with each round receiving the hidden state produced by the previous one. GLM-5.4 uses 28 layers from the GLM-5 base for two loop rounds. Its state update can be abstracted as:
h_(r+1) = h_r + g_r ⊙ ΔF(h_r)
Here, F represents the candidate update produced by the shared-weight layer, while g_r is a token-wise, round-specific gate. The second round therefore does more than replay the first; it refines the contextual state established by the first round.
Zhipu describes the model as reaching the intelligence level of a 2–3T-class model, but it has not disclosed how parameter scale, inference compute, and measured capability are mapped to that statement. It should not be interpreted as evidence that GLM-5.4 has 2–3T parameters, nor does it replace a standardized evaluation.
The idea of weight-shared recurrent depth is not new. The 2018 Universal Transformer explored shared-weight structures, and later work on recurrent depth and recurrent language models demonstrated potential benefits. GLM-5.4's contribution is the application of that idea to a flagship base model, combined with post-training conversion and serving-system co-design. Zhipu also notes that, at equal pretraining compute, shared-weight models generally perform worse than models whose layers have independent weights. The team therefore converted an already pretrained base rather than pretraining the architecture from scratch, trading additional post-training compute for a lower upgrade cost.
The trade-off remains substantial. The looped section executes twice, so its forward computation and intermediate activations grow roughly with the number of rounds. Weight sharing may also prevent layers from developing completely independent functions. Loop depth is consequently a way to exchange parameter efficiency for effective computation, not a free substitute for a larger model.
Three Optimizations Target Stability, Memory, and Retrieval
1. Gated Progressive Updates Prevent Residual-Scale Expansion
If every loop directly overwrites the hidden state, activation norms can expand rapidly, causing later layers to receive representations that differ from the distributions learned during pretraining. GLM-5.4 assigns each round an independent token-wise gate and writes back only a controlled fraction of the candidate update.
After training, the gates exhibit a clear division of labor. The first round remains conservative and establishes a global contextual state; the second opens the write path and refines that state. The gates also adjust their update magnitude according to token difficulty, allowing harder predictions to receive more iterative computation.
This mechanism stabilizes representations; it does not provide true adaptive compute. A gate can control how much is written, but it cannot make an easy token skip the loop entirely. Zhipu itself identifies adaptive computation as an unresolved next step.
2. Globally Shared and Window-Local KV Caches Avoid Full-Copy Growth
A naive implementation retains a complete KV cache for every round, making cache memory grow approximately linearly with the number of rounds. Using a conventional K/V layout, the full-context cache for one layer is roughly 2×L×d_kv values per token. Two independent rounds would require around 2×R×L×d_kv, multiplied again by the number of layers.
GLM-5.4 instead shares selected global KV entries across rounds while maintaining an independent KV region for newly generated tokens inside a sliding window. The two regions may cover the same positions: the shared cache preserves the first round's contextual representation, while the window cache captures second-round local updates. Conceptually, the incremental cache falls from a full O(L) copy to an additional O(w) window.
This is not free. Shared global entries can become stale, while the local window requires careful handling of position encoding, cache replacement, and eviction. Zhipu has not disclosed the window size, KV-head configuration, cache precision, or peak memory under varying concurrency. The claim that deployment-cost growth remains controlled at a 1M-token context therefore cannot yet be reproduced from hardware-level data.
3. Reusing Sparse-Attention Indices Avoids a Second Retrieval Pass
The GLM-5.4 base uses sparse attention. In the second loop round, the model directly reuses the KV blocks selected by the first round's indexer rather than running another full index search. This eliminates the additional indexer computation and memory traffic. Zhipu says the result is nearly equivalent to recomputing the indices for every round.
The cost is that the second round is constrained by the first round's candidate set. If a location only becomes important later in the reasoning chain and was missed initially, repetition cannot retrieve it. Index recall, the number of candidate blocks, and quality loss on long-context tasks require independent ablation.
What the Published Evidence Shows—and What It Omits
Zhipu first validated Loop scaling on bases ranging from 1B and 4B to 30B and 750B. In a controlled 30B experiment using the same architecture as the 750B base, the parameter count was unchanged and the Loop version required only about 10% more overall training compute, yet it showed a clear improvement over the non-looped baseline. After 200K-token SFT, the 30B model exhibited larger Loop gains in mathematical reasoning, long-context tasks, and code.
Two findings matter for production engineering. First, the longer the original chain of thought, the greater the benefit attributed to looping, aligning with the demands of long-horizon software engineering and planning. Second, average output length fell by 10%–14% on evaluations including GPQA and MMLU-Pro, mainly through shorter chains of thought. This suggests that some reasoning moved from the external token stream into internal loop depth. It does not prove that total computation fell, because the looped portion still requires additional forward execution.
Zhipu evaluated GLM-5.4 across 200 real programming scenarios and reported strong visual coding, visual reproduction, and long-horizon performance. Public demonstrations include an MV whose visuals are rendered in real time through frontend code, a 3D bird-watching experience generated from mathematical geometry and custom GLSL without external models or textures, and a six-axis robotic-arm animation produced through coordinated use of FreeCAD, Blender, and audio tools. These cases show that code execution can extend into multimedia and engineering workflows, but they remain selected demonstrations rather than reproducible benchmarks.
Important details are still missing: absolute pass rates for the 200 scenarios, repository composition, judging models, tool scaffolds, variance across repeated samples, and whether all baselines received identical context and reasoning budgets. The claim that GLM-5.4 offers the strongest coding experience among domestic models is subjective, while the 2–3T intelligence claim lacks a published measurement method. Zhipu also acknowledges that the model can enter an extended reflection mode. That behavior may improve long-horizon tasks, but it can increase token consumption and timeout risk; production deployments need explicit reasoning budgets and termination policies.
Inference Speed and System Co-Design
Zhipu reports generation speeds of up to 200 tokens per second off-peak and 70–80 tokens per second during peak periods. At the system level, the company splits KV caches by distance, reuses sparse-attention indices, and fuses core operators to reduce the memory round trips introduced by looping.
The announcement does not identify GPU models, input and output lengths, batch size, concurrency, quantization method, time to first token, or time per output token. Tokens per second is closer to single-request decoding speed and cannot be equated with aggregate multi-tenant throughput. At a 1M-token context, cache footprint, prefix-cache hit rate, and scheduling may matter more to real cost than peak generation rate.
Practical Deployment Guidance
- Separate the model from its integration layer. GLM-5.4 is now available to all GLM Coding Plan users, with quota increased 1.5-fold for V2, V3, and team plans and integrations across several coding platforms. ZCode is Zhipu's official agent harness for the model, jointly tuned for inference and tool use and supporting BYOK. AutoClaw is a local client that adds AutoGLM browser control and more than 50 skills. Harness-level performance should not be attributed automatically to the foundation model.
- Wait for clear API and weight-release terms. The API awaits safety review, and open weights remain only a plan to release responsibly. No license, checkpoint format, quantization build, or hardware requirement has been published. If 750B-class weights are eventually released, ordinary local deployment will not be practical; teams should first evaluate quantization error, loop-kernel support, and multi-device efficiency.
- Measure cost per completed repository task. Beyond tokens per second, track total tokens per merged pull request, wall-clock time, tool-call count, retries, recovery rate, and human-intervention rate. Long-horizon systems should be compared on total cost to completion rather than single-turn speed.
- Account for KV memory and scheduling independently. A 1M-context test should cover different cache policies, concurrency levels, and prefix-hit rates while recording peak GPU memory, KV footprint, TTFT, TPOT, and tail latency. Reusing sparse indices saves retrieval computation; it does not erase the cost of context storage.
- Enforce execution boundaries. Once a coding agent receives shell, filesystem, and network permissions, stronger models also expand the potential blast radius of mistakes. Production deployments still require sandboxing, least privilege, confirmation for dangerous commands, network allowlists, and complete trajectory auditing.
Engineering Assessment
GLM-5.4 matters less because of the informal “2–3T-class” label than because it shifts model scaling from parameter growth toward effective computational depth. Gated updates, cross-round KV sharing, sparse-index reuse, and operator fusion absorb much of the engineering cost of that shift. If the 30B ablation and 750B serving results can be independently reproduced, the approach has real value. If its gains depend heavily on a specific post-training recipe or sparse-retrieval assumption, transferability remains uncertain.
The next milestone is not simply adding more loop rounds, but implementing true adaptive computation: spending less on easy tokens, more on difficult ones, and keeping total latency predictable.
— END —Source: Zhipu AI Research (2026-11-22)
Tags: #GLM-5.4 #Loop Transformer #Zhipu AI #Generalized Coding #KV Cache
Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.
Community Comments