Blog
GLM-5.4loop transformerGLM-5.4 architecture

GLM-5.4 Loop Transformer Explained: How It Works

GLM-5.4 reuses a block of layers twice to perform like a 2-3 trillion parameter model at about 750B. Here is how the loop transformer works.

Portrait of Luis Chavez-Mattos
Edited by Luis Chavez-Mattos, Director, Product··RSS

For Engineering

Extreme close-up of stacked brushed steel slabs with one small crimson pin in sharp focus against softly blurred layers.

What is a loop transformer?

A loop transformer is an AI model design that sends text through the same group of layers more than once, reusing the same weights each time, instead of adding new layers. A normal language model is a stack of layers, and your text passes through each one exactly once. A loop transformer reruns part of that stack. You get a deeper network without adding parameters. GLM-5.4, from Z.AI, is its first flagship model built this way.

TL;DR

  • GLM-5.4 is built at roughly 750 billion parameters but Z.AI says it reaches intelligence comparable to 2 to 3 trillion parameter models.
  • The trick is a middle block of 28 layers that runs twice, between 26 opening layers and 24 closing layers.
  • Looping adds depth of thinking, not size, so the model does not need a bigger set of weights to do more computation per answer.
  • Z.AI tested a 30 billion parameter version with and without the loop. Every test improved, with the biggest gains of roughly 8 to 11 points on math and science reasoning, and answers used up to about 15% fewer tokens.
  • The launch post reportedly had no benchmarks, so the "2 to 3 trillion" comparison is Z.AI's claim, not an independently verified result.
  • As of the sources here, GLM-5.4 is not available through an API and the weights are not released. Z.AI says open weights will come after safety work.

How does the GLM-5.4 loop actually work?

Think of reading a hard paragraph, then rereading it with the first read already in your head. The second read is better because of the first. A loop transformer does the same thing inside the model.

Here is the path your text takes in GLM-5.4:

StageLayersPasses
Opening layers26Once
Middle block28Twice, same weights
Closing layers24Once

The model stores 78 distinct layers of weights (26 + 28 + 24). Because the middle block runs twice, the text goes through 106 layers of computation (26 + 56 + 24). The model's size on disk and in memory is set by the 78. The depth of thinking is set by the 106.

That gap is the whole idea. In a standard model, more depth means more layers, which means more parameters, which means a bigger, slower, more expensive model. Looping breaks that link.

Why would reusing layers make a model smarter?

Each pass through the middle block refines what the previous pass understood. The first pass builds a rough reading. The second pass works from that reading instead of from raw input.

Z.AI's argument, as relayed by reviewers, is that different kinds of work want different things. Large-scale software engineering, cybersecurity, 3D modeling and physical control benefit from more computation depth. Memory-heavy tasks, where the model needs to recall lots of facts, benefit more from extra parameters, since parameters are where the model stores what it knows.

That is a useful way to read the design. It is a bet that for reasoning-heavy and coding-heavy work, rereading beats a bigger library.

What does the 30B experiment show?

The most concrete evidence in the public material is an ablation. An ablation is a test where you change one thing and hold everything else fixed. Z.AI took a smaller 30 billion parameter version of the same design and tested it with and without the loop, keeping the parameter count identical.

The reported results:

  • Every test improved with the loop on.
  • The biggest jump came on the hardest category, math and scientific reasoning, with gains of roughly 8 to 11 points.
  • General knowledge and instruction following improved less, but still improved.
  • Answers were shorter, using up to about 15% fewer tokens.

That last point matters. You might expect a model that "thinks more" to ramble more. Here the extra thinking happens inside the loop, not in the written output. A token is a small chunk of text the model reads or writes, and most paid AI usage is billed by tokens. Fewer tokens for a better answer is a direct cost benefit.

Keep the limits in mind. This was a 30B model, not GLM-5.4 itself, and the numbers come from Z.AI. The result shows the design helps at small scale. It does not prove the 2 to 3 trillion comparison for the flagship.

What stops the second pass from going wrong?

Running the same layers twice sounds like it should be unstable. Numbers inside a neural network can grow larger with each repeated step until the output is garbage. Z.AI added gates between passes that stop the numbers from blowing up. A gate is a learned control that limits how much of a signal gets through.

The second pass also reuses the first pass's memory and attention choices. Attention is how the model decides which parts of your text matter for each word it produces. Reusing that work means the extra loop does not make the model much slower or more expensive to run, according to the description of the design. A reviewer who tested the model did report a lot of throttling the day before and said he did not see that speed then, so treat "not much slower" as a design goal and check it against your own use.

Is GLM-5.4 really as good as a 2 to 3 trillion parameter model?

Nobody outside Z.AI can say yet. The company compares it to models in that size range. One reviewer named Qwen 4 Max and Kimi K3.1 Pro as examples. But the launch post reportedly included essentially no benchmark numbers.

What we have instead is anecdotal testing. One reviewer ran big coding tasks, including a browser-based operating system, a 3D city game and a C++ skateboarding game. Those ran for hours, and he called some results the best he had seen from an open-weights-bound model. Another reviewer showed Blender scripts, 3D scenes and a long creative-writing test. These are impressive demos, but demos are not measurements. Wait for independent benchmarks before treating the headline claim as settled.

Can you use GLM-5.4 today?

Only in a limited way. In the sources, the model was not available through an API, and the weights were not released. The way in was Z.AI's coding plan.

One reviewer reported that on maximum reasoning effort, usage drained fast. He moved from a $65 a month plan to a $144 a month plan, and said the five-hour usage limit could run out before a single task finished. That is one person's experience, but it is a useful warning. Heavy, long-running tasks on a new model can burn through a plan quickly.

Z.AI says it plans to open-source the weights after what it calls safety hardening. Reviewers worry that this could mean capabilities get trimmed, such as cybersecurity skills, as has happened with other open-weight releases. That is a concern, not a confirmed outcome.

Z.AI also says this design will carry into its next, significantly larger model. Reviewers mention rumors of a multi-trillion parameter model, but that is unconfirmed.

What does this mean for you?

You do not need to understand layers to use any of this. But the design points to a few practical things.

If you use AI for analysis, coding or technical writing: expect models that reason better without getting bigger or more expensive per answer. The efficiency gain is aimed at exactly that kind of work.

If you pick tools for a team: stop treating parameter count as a quality score. A 750B model may match a much larger one, and the reverse can happen too. Run a real task from your own work through each candidate, and compare the answer and the token use.

If you watch costs: look at output length and total usage, not just the price list. Shorter answers at equal quality are real savings.

If you are a manager or buyer: be skeptical of launch claims with no benchmarks. Ask for independent results, and test on a small batch of your own tasks first.

What you can do this week: pick three tasks you do often, such as summarizing a contract, cleaning a messy spreadsheet or drafting a report. Save the exact prompts and use them as your own test set whenever a new model arrives.

How could you track model tests without another subscription?

If you start comparing models on your own tasks, a spreadsheet gets messy quickly. With Remy, you can describe a small internal tool in plain English: a form where teammates log a task, which model they used, the quality score they gave it and the tokens it consumed, plus a dashboard that shows which model wins for which kind of work. Remy builds and deploys it as a full-stack app, with a database and sign-in included. Remy's model catalog is nearly 400 models, and AI tokens are billed at cost, so a tool like this can also run the comparisons itself.

Frequently Asked Questions

5 questions

What is GLM-5.4?

GLM-5.4 is a flagship model from Z.AI. It is built at roughly 750 billion parameters and is the company's first flagship built on a loop transformer, and Z.AI describes it as the start of "generalized coding."

How many layers does GLM-5.4 have?

It uses 26 opening layers, a middle block of 28 layers that runs twice, and 24 closing layers. That is 78 distinct layers of weights but 106 layers of computation per pass through the model.

Does looping make the model slower?

Somewhat, because there is more computation, but the design reuses the first pass's memory and attention choices to limit the cost. Z.AI frames the extra loop as not making the model much slower or more expensive. One reviewer found maximum-effort use slow and heavy on plan limits, so test it on your own workload.

Will GLM-5.4 be open source?

Z.AI says it plans to release open weights after completing safety hardening. No date was given in the sources, and the weights were not out at the time of the reviews.

Is a loop transformer better than a bigger model?

Not in every case. Z.AI's own view is that loops help most on reasoning-heavy and coding-heavy work, while memory-heavy tasks benefit from more parameters. The reported 30B experiment showed gains across the board, but a bigger model can still win where raw stored knowledge matters.

How we source, write, and correct our articles. Editorial standards

Related articles

Straight to your inbox.
New pieces as they publish. No noise.