GLM-5.4 Loop Transformer Architecture: 28 Layers, Run Twice
GLM-5.4 runs 28 layers of the GLM-5 base model twice for every token it generates. And Z.ai says that one design choice lets a model coverage describes at roughly 750 billion parameters reach what the company calls "intelligence levels comparable to 2T-3T parameter models." That is the Loop Transformer architecture in a single sentence.
Z.ai calls GLM-5.4 its first flagship model built on it.
In a standard Transformer, each layer runs once per forward pass.
GLM-5.4 instead re-runs a middle block of weight-shared layers for a second iteration.
And each iteration refines the hidden states the previous pass produced. Z.ai says this enables "deeper reasoning without increasing parameter count." The mechanism is documented in detail; the comparability claim is the vendor grading its own homework.
The gap between those two things is where your token bill lives.
The Stack: 78 Distinct Layers, 106 Executions Per Token
Sebastian Raschka's architecture gallery has the cleanest breakdown of the full stack. GLM-5.4 opens with 26 layers that run once, loops a middle block of 28 layers that runs twice. And closes with 24 layers that run once. That works out to 106 layer applications per token from 78 distinct layers, with the looped block sitting at decoder layers 27 through 54.
The second trip through the middle block reuses the exact same weights.
Because duplicating them would defeat the entire premise.
The part that makes looping usable instead of chaotic is gating. GLM-5.4 adds a per-token gate for each iteration.
And each gate controls how much of that pass's update enters the residual stream.
The model decides token by token how much of the second pass's refinement to keep. A loop with no gate has no way to decline the second pass's changes. And the gates are what turn a blind replay into a conditional second look.
Z.ai also did not train this from scratch. GLM-5.4 was built by continued training of the pretrained GLM-5 base model.
The loop is a retrofit onto an architecture that already worked, which lowers the risk of the structural bet. It as well makes the loop's contribution harder to isolate from the base model's existing quality, which matters when you ask what the second pass actually bought.
The Second Pass Copies The First Pass's Index Work
The engineering detail that impressed me sits in the attention layer.
GLM-5.4's base model uses sparse attention. And a looped design has an obvious failure mode: the second pass doubles the indexing work. Z.ai's docs state the second loop "directly reuses the attention indices generated by the first loop's indexer, adding zero indexing overhead." No second indexing pass happens at all.
The second pass too gets a smaller menu to read from.
Per Raschka's gallery, GLM-5.4 pairs Multi-head Latent Attention with DeepSeek Sparse Attention. And on the second pass each middle layer attends to the sparse keys and values selected during the first pass, plus its own 128-token sliding window. The second pass is not a full re-read of the context.
It is a targeted re-read of what the first pass already decided mattered.
Read those two facts together and the design becomes clear.
The loop buys a second round of computation per token. And the index reuse plus the 128-token window keep that second round from costing a full second pass. That is the whole trick: depth paid for in compute, then discounted by reusing work the model already did.
They Validated The Loop Before Betting The Flagship On It
The part I respect most is that Z.ai did not ship a loop on faith. Coverage reports the architecture was validated progressively at 1B, 4B, 30B. And 750B scales before it went into the flagship. At 30B, the model was tested with and without the loop, which is the correct experiment: same weights, looped and unlooped. So the second pass's contribution is measurable on its own.
Most architectural claims arrive as a press release with a benchmark table and no ablation behind it.
This one at least comes with a stated validation ladder you can ask follow-up questions about.
The caveat is real, though. The with-and-without comparison exists at 30B, and the flagship ships at roughly 750B. Behavior that holds at 30B does not automatically hold at 750B.
And the "comparable to 2T-3T parameter models" framing is Z.ai's own characterization, not a third-party finding.
Treat the mechanism as documented and the headline claim as unverified until something independent, or your own eval, says otherwise.
What The Loop Means For Your Token Bill
Now the part that matters to you. The parameter count on a model page was never the number you pay. You pay for compute per token. And a looped model spends more compute per token than its parameter count implies: 106 layer applications from 78 distinct layers means every token is heavier than the "750B" label suggests. Z.ai is betting that extra depth per token is worth more than extra parameters per token. And that is a bet about where capability comes from, not just a specs line.
For a small operation, this reframes model-picking entirely. The question was never "how many parameters does it have." The question is what a completed task costs you and whether it passes your test suite. A looped 750B model that behaves like a 2T model is a win for you only if the per-token price reflects the 750B cost rather than the 2T capability. Vendor architectures never show up on your invoice; prices and pass rates do.
My rule, and I hold to it on every pipeline I run: no model switches on architecture news. A model earns a slot by beating the incumbent on a fixed set of tasks I actually ship, at a price I have already computed. GLM-5.4's loop is genuinely interesting engineering that earns it a place on the test list, not a place in production.
The Takeaway
GLM-5.4's Loop Transformer architecture is a clean idea executed with unusual care: 28 layers run twice on shared weights, gated per token, with the second pass reusing the first pass's attention indices so the extra depth does not cost a full second pass. Whether it performs like a 2T-3T parameter model is a claim Z.ai makes about itself. And the only benchmark that settles it for you is the one you run.
Pull up your most-shipped automation task, price it per completed run on whatever model you use today.
And hold that number as the bar. When GLM-5.4 or any looped model clears it on the same eval, switch.
Until then, read architecture news the way I do: as a shortlist for testing, not a reason to migrate.
Comments ()