Z.ai says GLM-5.4 runs 28 layers twice per token for more depth
A transformer language model normally sends each token through its stack of layers once. Z.ai says its new flagship GLM-5.4 sends every token through a block of 28 layers twice, reusing the same weights on the second pass. The model gets more computation per token without a single extra parameter.
The surprise is how Z.ai got there. Looped models trained from scratch, the company writes, "still lag behind unshared models under the same pre-training compute budget". So it did not start from scratch: it took its already trained 750B-parameter GLM-5 base model and turned its middle layers into a loop by continuing the training. Z.ai claims the result reaches "intelligence levels comparable to 2T-3T parameter models". That is its own claim; the page publishes no benchmark table for the 750B model, and no independent evaluation has appeared yet.
In short
28 layers of the 750B base that run twice per token; ~10% extra training compute in Z.ai's 30B looped test; 10–14% shorter answers on most benchmarks in that test; 128 tokens the only new KV cache the second pass keeps
- Z.ai's developer page, updated on 23 November 2026, calls GLM-5.4 its first model built on a Loop Transformer. It accepts video, image, text and file input, with a 1M-token context and up to 128K output tokens.
- In a controlled test on a 30B model with the same architecture as the 750B base, the looped version beat an unlooped twin with the same parameter count on all five benchmarks shown, with gains of 3.3 to 11.3 points.
- The looped 30B model also wrote less: Z.ai says average output fell by 10–14% on most benchmarks, "mostly from shorter chains of thought".
- Z.ai names one weakness: the model "tends to get caught in overly long 'marathon thinking' loops".
How does GLM-5.4 run layers twice?
Z.ai's architecture diagram splits the model into three parts. By our count from it, that is 78 stored layers:
So each token passes through 26 + 2 × 28 + 24 = 106 layers' worth of computation (our arithmetic) from 78 layers of weights. The idea itself is old, as Z.ai notes, citing the 2018 Universal Transformer, which shared weights across depth. More recently, Thinking Machines Lab's Inkling 2 Mini, released on 20 November, runs its middle 12 layers three times. GLM-5.4 applies the idea to a far larger model, and does it by adapting one that already exists.
Z.ai says turning a trained model into a loop needed three changes.
- Gates on each pass. Simply overwriting the hidden state on each pass made the size of the activations blow up, so the layers after the loop received numbers outside the range they were trained on. GLM-5.4 adds a separate gate per token for each pass, which decides what fraction of the new update to write back. After training, Z.ai says, the first pass learned to write cautiously with small gate values, and the second pass opened the gates to write full updates. On harder tokens, the first pass writes more.
- A cheap memory for the second pass. A model keeps a "KV cache" of every earlier token so it does not recompute them. A naive loop would keep a full cache for each pass, doubling that memory. Instead, the second pass reuses the cache entries the first pass selected and keeps its own new entries only for a short sliding window, 128 tokens in the diagram. Z.ai says an extra loop therefore costs "one sliding window of KV cache rather than a full context cache", which matters at 1M-token contexts.
- No second search. The base model uses sparse attention: an indexer picks which earlier tokens each token looks at (the top 2,048, per the diagram). The second pass reuses the first pass's picks instead of searching again, adding no indexing cost. Z.ai says this performs "nearly identically" to recomputing the picks on every pass.
The 30B test
Before committing the flagship, Z.ai says it tried the loop on 1B, 4B, 30B and 750B base models. Its controlled comparison used the 30B model: same parameter count, about 10% more total training compute for the looped version, evaluated after long-context fine-tuning with thinking mode on.
Source: Z.ai's ablation table on the GLM-5.4 page.
The largest gains came in maths, scientific reasoning and long-context tasks. Z.ai reads the shorter outputs as "part of the reasoning shifts from explicit output tokens into the implicit depth of the loop". The cut was smallest on AIME25, at 2%, so the 10–14% figure covers most benchmarks, not all.
These are Z.ai's own numbers, on a 30B test model, not on GLM-5.4 itself. The page also shows a chart of GLM-5.4's win rate against GLM-5.3 (51.1% wins, 25.7% ties, 23.1% losses) and two rival models, but does not say what tasks were judged or by whom.
Speed
Looping means more computation per token, which could slow generation. Z.ai says GLM-5.4 reaches up to 200 tokens per second off-peak and holds 70–80 tokens per second at peak load. Besides the cache and index savings, it says it fused core GPU kernels to cut the memory reads and writes that looping multiplies.
Terms in plain English
Where things stand
The page says the Model API will open after a security assessment. Z.ai calls GLM-5.4 its "first step with looped architectures" and lists open questions: how to give harder tokens more passes automatically, and how the gains from looping change as loop count and model size grow. It says its next, "significantly larger" model will carry these lessons forward.
Sources
- GLM-5.4 - Overview, Z.ai developer document, updated 23 November 2026
- Introducing Inkling 2 Mini, Thinking Machines Lab, 20 November 2026 (for comparison)
Sources
Related stories
- Aleph Alpha explains how Kolibri 1.1 reads long inputs faster
- OCTOPUS shrinks an AI model's memory cache to 2 bits, authors say
- Z.ai releases GLM-5, an open 744-billion-parameter model
- OpenAI sets out three ways it measures model alignment
- Ai2 releases Molmo 3, an open model that judges depth in photos
- Natural Language Processing: From Theory to Practice
More from Teach the Bot
- Most multi-step AI benchmark tasks fail review, a preprint says
- Thinking Machines releases Inkling 2 Mini, an open looped model
- OpenAI releases MedChemBench, a test of AI on drug chemistry
- A projection layer keeps neural models of chaos bounded, MIT says
- OpenAI says safeguards cut distillation attacks from 54% to 0.2%