How Z.ai's GLM-5.4 Loop Transformer Trades Parameters for Depth
Most frontier labs spent 2026 scaling parameter counts upward to squeeze more reasoning out of every forward pass, shipping models such as GPT-6.1 Terra, Claude Fable 5.2, and Gemini 4 Neon. On November 23, 2026, Z.ai to
Most frontier labs spent 2026 scaling parameter counts upward to squeeze more reasoning out of every forward pass, shipping models such as GPT-6.1 Terra, Claude Fable 5.2, and Gemini 4 Neon. On November 23, 2026, Z.ai took a structural detour by launching GLM-5.4, its first flagship model built on a Loop Transformer architecture rather than a larger parameter footprint.
Instead of training a multi-trillion-parameter network from scratch, Z.ai adapted its existing roughly 750B-parameter GLM-5 mixture-of-experts base through continued training so that 28 middle layers run twice per token pass. As detailed in DataCamp's technical review of GLM-5.4 and MarkTechPost's architecture breakdown, Z.ai claims the extra pass gives GLM-5.4 reasoning parity with 2T to 3T parameter models while adding native vision support and boosting GLM Coding Plan weekly quotas by 50%.
Early independent testing reveals a sharp trade-off behind that headline claim: GLM-5.4 surfaces subtle security bugs that competing models miss, yet it can burn over four times as long and fifteen times as many tokens on agentic suites due to what Z.ai itself calls "marathon thinking" loops. We have not run GLM-5.4 against local or private repositories; all parameter figures, 30B ablation scores, KingBench 4 numbers, and Coding Plan pricing below come from Z.ai's launch disclosures and published third-party evaluations.
How Z.ai's Loop Transformer works without blowing up KV memory
In a standard decoder-only transformer, an input token travels through each layer exactly once before producing a next-token prediction. In a looped transformer, a shared block of layers executes multiple iterations in sequence, refining hidden activations before handing them to the final output head. Think of it as rereading a dense paragraph twice before writing a summary rather than hiring a larger team to read it once.
Z.ai noted in its technical post that training a looped transformer from scratch still lags standard unshared models under equal pre-training compute. Converting an already pre-trained 750B GLM-5 base via continued training bypassed that pre-training penalty, though making a two-pass loop work at 1M-token context lengths required three engineering fixes:
Expand
Artificial neural network interpolation and extrapolation plot illustrating model depth behavior
Image: Jhedengren via Wikimedia Commons, CC BY-SA 4.0
- Per-token gated residual writes. Simply overwriting hidden states across two passes causes activation norms to explode, feeding out-of-distribution values to downstream layers. Z.ai added independent per-token gates for each iteration. During training, the first pass learns to write small conservative updates that establish global context, while the second pass opens the gates to refine predictions (and writes more aggressively on the first pass when a token is difficult).
- Hybrid KV cache with sliding windows. Keeping a full key-value (KV) cache for both passes at 1M tokens would double serving memory. GLM-5.4's second loop reuses the sparse KV entries selected during the first pass and maintains fresh KV entries only inside a local sliding window, keeping memory overhead close to GLM-5.3.
- Sparse attention index reuse. Rather than recomputing which earlier tokens each query attends to, the second loop reuses the exact attention indices computed by the first loop's indexer with zero extra indexing overhead.
Z.ai also fused GPU kernels across the looped passes to cut intermediate memory traffic, reporting off-peak serving speeds of up to 200 tokens per second and 70 to 80 tokens per second under peak load.
Comparing GLM-5.4 against frontier open and closed coding models
Z.ai had not published a formal model card, official 750B benchmark table, or downloadable Hugging Face weights as of November 23, 2026. The comparison below pairs Z.ai's disclosed specifications with independent third-party numbers from AICodeKing's KingBench 4 suite.
| Model | Architecture | Total parameters | Context window | Weights & API status (Nov 2026) | KingBench 4 / independent notes |
|---|---|---|---|---|---|
| GLM-5.4 (Z.ai) | Loop Transformer (28 GLM-5 layers x 2 passes) | ~750B scale (active undisclosed) | 1M tokens in blog (512K recommended) |
Hosted only (Coding Plan, ZCode, Z.ai Chat); weights planned | 7th overall, 1st open model; 431 min, ~1.04M tokens |
| GLM-5.3 (Z.ai) | Standard MoE | Undisclosed | 1M tokens (128K max output) | API and Coding Plan live | Terminal-Bench 3.0 score: 28.3 |
| Gemini 4 Neon (Google) | Frontier MoE | Undisclosed | 1M tokens | API and Google AI Pro live | Finished KingBench 4 in 109 min (~70K tokens) |
| Kimi K3.1 Pro (Moonshot) | Mixture-of-Experts | 2.8T (104B active) | 1,048,576 tokens | Weights on Hugging Face; API live | Strong open-weight baseline with multimodal input |
| DeepSeek-V4.1-Flash | MoE + Engram memory | 552B backbone + 196B Engram | Up to 1M tokens | MIT weights on Hugging Face; API live | DeepSWE v1.1 score: 74.2 (NVIDIA card) |
The gap between GLM-5.4 and Gemini 4 Neon on KingBench 4 illustrates why raw tokens-per-second throughput is only half the story. Even at 200 tokens per second, taking 1,128 reasoning steps and 1.04 million tokens caused GLM-5.4 to take nearly four times longer in wall-clock time than Gemini 4 Neon's 244 steps and 70,000 tokens.
What Z.ai's 30B ablation study shows about reasoning depth
Because Z.ai withheld official 750B benchmark tables at launch, the cleanest controlled evidence for the Loop Transformer design comes from Z.ai's iso-parameter 30B ablation study, where a standard 30B model and a looped 30B model shared identical parameter counts and differed only by the 2-pass loop (using roughly 10% extra training compute):
- AIME25 math reasoning jumped from 19.17 to 30.42 (+11.3 points), with average output length slipping 2% (-635 tokens).
- GPQA-Diamond graduate science rose from 47.58 to 56.26 (+8.7 points), while average output length dropped 11.7% (-2,473 tokens).
- AA-LCR long-context reasoning improved from 40.33 to 47.67 (+7.3 points), with 9.7% shorter outputs (-539 tokens).
- MMLU-Pro and IFBench rose +3.4 points (71.65 to 75.05) and +3.3 points (50.20 to 53.47), cutting output tokens by 14.9% and 13.0% respectively.
In the 30B experiment, looping moved some chain-of-thought work into implicit hidden-state depth, making final written answers shorter. At 750B scale on multi-step agentic coding, however, independent reviewers observed the opposite: the model frequently enters prolonged self-correction cycles ("marathon thinking") before emitting code. If you build evaluation pipelines for models like these, check our guide on how to evaluate LLMs without lying to yourself and how prompt caching cuts latency and token cost.
"Generalized Coding" demos and where GLM-5.4 actually excels
Z.ai markets GLM-5.4 around "Generalized Coding," pitching code generation plus its newly added vision input as a universal compiler for non-software artifacts. Launch demos included a self-narrated music video ("Hello World"), a 6-axis robotic arm scripted via FreeCAD's Python API, a complete physics-and-combat game, and an interactive 3D bird-watching scene built with custom GLSL shaders.
Expand
Close-up of a developer screen displaying programming code and AI action menus
Independent testers drew a sharper boundary around where GLM-5.4 belongs in a real engineering stack. While DataCamp's review cautioned against using GLM-5.4 as a primary front-end or 3D coding agent, it stood out as a cautious code reviewer and security auditor, catching subtle application bugs and security vulnerabilities that Claude Fable 5.2 missed. On tool calling, GLM-5.4 posted a 1.56% initial failure rate (11th out of 17 models tested), yet recovered 66% of failed calls through automatic retries, beating every Claude and Codex model in the test.
Effort settings, Coding Plan access, and timeout traps
GLM-5.4 is live today in Z.ai Chat, the ZCode desktop harness (macOS, Windows, and Linux Beta), and the GLM Coding Plan (listed at $12.60/month for Lite, $56 for Pro, and $117.60 for Max). Z.ai states that GLM-5.4 consumes at least a third fewer credits per token than GLM-5.3 on the Coding Plan, translating to roughly 50% more weekly quota. Public API access and open weights on Hugging Face have no firm release dates yet.
If you wire GLM-5.4 into OpenCode or Claude Code (glm-5.4 or glm-5.4[1m] for the 1M-context variant), configure three settings immediately before running a job:
-
Set
/effortexplicitly tohigh(ormedium, which maps tohighon the Coding Plan). If you omit the effort parameter, Z.ai defaults GLM-5.4 tomax. In independent security-audit runs,maxeffort timed out mid-thought without returning an answer, while the mid-tier setting completed cleanly. -
Cap context at
512000tokens for coding. Even though the model accepts 1M tokens, Z.ai's own Coding Plan documentation recommends capping client context windows at 512,000 tokens for stronger coding accuracy. - Raise agent HTTP timeouts. Default 60-to-120-second harness timeouts will kill long-horizon GLM-5.4 tasks before its second-pass reasoning finishes.
Treat GLM-5.4 as a specialist second-opinion reviewer for security audits, FreeCAD/Python scripting, and tricky backend refactors rather than a drop-in replacement for fast daily autocomplete. ## Why looped transformers are returning in late 2026
Looped neural architectures are not new; Google Research proposed the Universal Transformer back in 2018, and several academic groups tested recurrent-depth language models at small parameter counts. What kept frontier labs away was training efficiency: a looped model trained from scratch tends to trail a standard unshared transformer at identical pre-training FLOPs.
Z.ai's practical contribution with GLM-5.4 is proving that you can take an already trained 750B-scale mixture-of-experts checkpoint and convert its middle layers into a two-pass loop through continued training, validating the scaling curve across 1B, 4B, 30B, and 750B checkpoints before shipping. For infrastructure teams, that suggests a middle path between training ever-larger 3-trillion-parameter weights and paying steep inference memory bills, provided engineers can rein in marathon thinking loops at the decoding layer.
Before adopting GLM-5.4 inside automated CI pipelines, engineering leads should also track token burn alongside wall-clock latency. Because a single Coding Plan prompt at high effort can trigger dozens of internal verification loops, billing predictability will depend heavily on how Z.ai prices looped output tokens once the public API opens.
Once Z.ai publishes the full 750B model card, public API rates, and open weights, teams will finally be able to measure whether looped depth beats standard MoE scaling on cost per solved ticket.
Originally published on Mango Developer.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes â full credit and traffic to the original publisher.
