
What Z.ai announces
Over the past three months, the Z.ai team scaled two things at once: the depth of the loop and the size of the model. They say the first surprise came from the architecture itself: if you run the same block of layers several times, the model reasons more deeply with the same weights and, according to them, matches much larger models.
That leads to their two main claims:
- Intelligence comparable to models with 2 to 3 trillion parameters. That's Z.ai's claim. The article shows no evidence for that comparison, so I read it as a claim, not a result.
- The start of "generalized coding": code as the foundation for far more tasks than software.
They also admit a flaw: the model tends to get stuck in overly long thinking loops, what they call "marathon thinking". The interesting part is that this long reflection, correcting itself along the way, consistently improves accuracy, beyond what you'd expect from its parameter count.
Reasoning needs compute, not storage
Z.ai starts from an idea from its GLM-5.3 technical blog:
- memory-heavy tasks improve with more parameters, because there's more room to store facts;
- reasoning-heavy tasks improve with more effective compute, meaning more computation steps for each answer.
And the tasks they care about are the second kind: large-scale software engineering, cybersecurity, 3D modeling or physical control. They're all extremely long chains of reasoning, where the model has to follow many steps of cause and effect while keeping the whole thing consistent. That, they say, can't be solved by stacking parameters or memorizing more data.
Standard vs looped transformer
In a standard transformer, each layer runs once per forward pass. In a looped transformer, a group of layers that share weights runs several times in a row, and each round refines the state left by the previous one. The result is a deeper network with exactly the same parameters.
The idea isn't new. The Universal Transformer proposed sharing weights across depth back in 2018, and recent work on recurrent depth and looped language models has shown gains at small scales. The catch is different: sharing weights saves parameters, but with the same pre-training budget a looped model trained from scratch still falls behind a standard one.
Not starting from scratch
So Z.ai didn't start from scratch. It took a base model that was already pre-trained and turned it into a looped transformer through continued training. It's like extending a house that's already built instead of putting up a new one. According to the team, this raises the intelligence ceiling with a relatively small compute overhead (they don't give the number for the big model; for the test model they do, see below).
The GLM-5.4 diagram
GLM-5.4 takes 28 layers of the GLM-5 base model and runs through them twice. Their architecture figure shows the whole thing:
- prelude: 26 input layers (L1-26), run once;
- loop: 28 layers (L27-54) that run twice with the same weights;
- coda: 24 final layers (L55-78) before the output.
All in a model of about 750 billion parameters. At that scale, just repeating layers isn't enough: after extensive experimentation, they made three changes to balance the gains against the cost of serving it.
Change 1: gates that write step by step
When you turn the middle layers of a trained model into a loop and each round overwrites the hidden state, the size of the activations (their norms) blows up from one round to the next. The layers after it then receive values outside the scale and distribution they expect.
Z.ai's fix is independent gates per token and per round, which decide how much of each candidate update gets written into the residual stream. In their figure, round k computes xk = xk−1 + βk·(hk − xk−1): with a small β barely anything changes; with β = 1, the full update goes in.
After training, the gates split the work:
- The first round builds the global context and writes carefully, with the gate almost closed, so the scale stays stable.
- The second reuses that state to refine the output and opens the gate fully.
They also adjust the step size to each token's difficulty: on the hardest tokens, the first round writes more aggressively, so those complex predictions get more out of the second round's refinement.
Change 2: a hybrid KV cache
While generating, the model keeps a KV cache of what it has already read, so it doesn't recompute it. Done naively, each round of the loop needs its own full cache, and memory gets multiplied by the number of rounds.
Z.ai builds on sharing the cache across rounds and adds a sliding window:
- the second round reuses the sparse cache selected by the first;
- and keeps its own fresh cache, but only within a sliding window of the latest tokens (128 in their figure).
The two can overlap at the same positions, so the model attends both to the context from the first round and to the updated version from the second.
The result: an extra round doesn't cost a cache of the whole context, just one window. And with contexts of a million tokens, according to Z.ai, the increase in deployment cost over GLM-5.3 stays "well under control". They don't give a number.
Change 3: reusing the attention indices
The base model uses sparse attention: an indexer picks which tokens to look at. The second round doesn't recompute those indices; it directly reuses the ones the indexer produced in the first, so indexing costs nothing extra. According to their experiments, it performs almost the same as recomputing them every round.
Does it work at scale?
For Z.ai, looping is a test of what they call scaling correctness: any architecture change has to keep working as the model grows. So before using it in their flagship, they validated it step by step on base models with 1B, 4B, 30B and 750B parameters.
The clean comparison was done on the 30B model, which has the same architecture as the big one: two versions with exactly the same parameters, a standard one and a looped one. The looped one used only about 10% more total training compute. The results, after long-context fine-tuning at 200K and with thinking mode on:
| Benchmark | Baseline | + Loop | Gain | Avg. length |
|---|---|---|---|---|
| AIME25 (math) | 19.17 | 30.42 | +11.3 | −635 tokens (−2%) |
| GPQA-Diamond (hard science) | 47.58 | 56.26 | +8.7 | −2,473 tokens (−11.7%) |
| AA-LCR (long context) | 40.33 | 47.67 | +7.3 | −539 tokens (−9.7%) |
| MMLU-Pro (general knowledge) | 71.65 | 75.05 | +3.4 | −863 tokens (−14.9%) |
| IFBench (instruction following) | 50.20 | 53.47 | +3.3 | −763 tokens (−13.0%) |
Keep in mind: this is the 30B test model, not GLM-5.4. The article gives no such table for the big model.
The team's first conclusion: the longer the reasoning chain, the more the loop helps. The biggest gains are in math, scientific reasoning and long context, exactly what generalized coding needs.
Thinking with fewer tokens
The second conclusion is more surprising: the looped model writes less. The article's text talks about answers 10-14% shorter on most benchmarks; in its own table, average length drops between 9.7% and 14.9% on four of the five, mostly because the chain of thought gets shorter. On math (AIME25) it barely changes: 2%.
Z.ai's reading: part of the reasoning moves from the tokens the model writes into the implicit depth of the loop.
Speed
According to Z.ai, GLM-5.4 reaches 200 tokens per second off-peak and holds 70-80 at peak load. Getting there with a multi-round architecture meant designing the model and the inference infrastructure together: on top of the memory savings from the cache and the indices, they fused the core kernels to cut down intermediate memory reads and writes, the fragmented overhead that looping amplifies.
Generalized coding
The article's second big idea. For Z.ai, code has become the foundation for extending what a model can do. Since going all in on coding in early 2025, they have unlocked agentic engineering, long-horizon tasks and cybersecurity. Now they're going after generalized coding, which they say has a higher ceiling and broader impact; GLM-5.4 is just the starting point.
With improvements in both coding and vision, they show four demos that go beyond traditional software:
- Video: "Hello World", a music video narrated in the model's own voice, produced by writing code to generate and edit it.
- Engineering: a six-axis robotic arm, with engineering-grade CAD modeling in FreeCAD.
- Games: a complete game built in one go, with character movement, physics, maps, a combat system and the art.
- 3D: an interactive close-up bird-watching experience, generated from scratch using only mathematical geometry and hand-written GLSL shaders.
These demos were picked by the team itself, so they don't measure anything, but they show where they want to go.
Where to try it and what's next
Z.ai offers it in its GLM Coding Plan, in its ZCode editor and in its chat. The API is "coming soon". As for open weights, they say they'll release them responsibly after completing the necessary safety hardening, with no date.
And they leave open questions:
- Adaptive compute: giving harder tokens more rounds dynamically.
- How the gains scale as both the number of rounds and the model size keep growing.
They're not choosing between scaling depth and scaling size: they're going for both. GLM-5.4 validates computational depth, and their next, "significantly larger" model will carry forward what they learned here. They say it will be ready soon.
In short
GLM-5.4 runs 28 layers of GLM-5 twice to think deeper with the same weights. To make it work at 750 billion parameters without blowing up the cost, it adds per-token gates, a hybrid KV cache with a sliding window, and reuses the attention indices. In their 30B test model, the loop gains accuracy, especially on long reasoning chains, and writes fewer tokens. The rest (the comparison with 2-3 trillion parameter models, generalized coding) is Z.ai's bet, and the next model will show how far it goes.
Sources
- Z.ai, "GLM-5.4: Toward Generalized Coding with Our First Loop Transformer", November 23, 2026.
- The video on my channel: Articulator EN · Articulator ES.