Today ainotis Join

My notis

ResearchPublished ExplainedAll news from that day

How a Loop Transformer gets depth by running shared layers twice in GLM-5.4

Z.ai's GLM-5.4 runs 28 layers of its GLM-5 base model twice, and Z.ai says that makes the network deeper without adding parameters.

Share

Check our sources · 22 facts from 2 sources
Block diagram of GLM-5.4: a prelude, then Loop Pass 1 and Loop Pass 2 over the same layers 27 to 54, then a coda and the LM head.Image: Z.ai
source · The company's own image of its product, used to report on it

Key points

  1. Z.ai says a Loop Transformer runs a group of weight-shared layers for several iterations, each refining the previous pass, which gives a deeper network without more parameters.
  2. Z.ai says looped models trained from scratch still lag unshared models at the same pre-training compute, so it adapted an already pre-trained base model through continued training.
  3. In Z.ai's comparison on a 30B model with about 10% more training compute, average output length dropped by 10-14% on benchmarks such as GPQA-Diamond and MMLU-Pro.

What happened

Z.ai's new flagship, GLM-5.4, runs 28 layers of its GLM-5 base model twice. That design is called a Loop Transformer: a group of layers that share the same weights is run several times on the same text, and each pass refines the result of the one before.

In a standard Transformer, each layer runs once per forward pass, so depth equals the number of distinct layers. In a Loop Transformer, as Z.ai describes it, a group of weight-shared layers runs for multiple iterations, refining the hidden states from the previous pass. The network gets deeper without gaining parameters.

The idea is not new. Z.ai itself points to the 2018 Universal Transformer paper, from Google Brain researchers, which proposed weight-shared depth.

That paper's Figure 1 shows the model repeatedly refining the vector representation of every position in parallel, using self-attention and a recurrent transition function, with parameters tied across positions and steps.

Its authors note that a standard Transformer, with its fixed stack of distinct layers, lacks the bias towards iterative transformations that recurrent networks have, and that it fails on some simple tasks when inputs are longer than any seen in training.

The paper also explains what sharing weights changes. In a standard Transformer the number of sequential operations is fixed by the number of layers, whatever the input size.

Because the Universal Transformer shares weights across steps, the number of steps can vary, and the paper adds a halting mechanism that sets it per position. In its tests the Universal Transformer scored a 0.9 BLEU improvement over a Transformer on WMT14 English-German translation.

Z.ai says looped models trained from scratch still lag unshared models given the same pre-training compute, so it adapted an already pre-trained base model through continued training. It made three changes for its 750B-scale model.

Per-token gates control how much each pass writes back, so the first pass writes conservatively and the second refines. A hybrid key-value cache lets the second loop reuse the first pass's cache and keep only a sliding window of its own, so an extra loop costs one sliding window of cache rather than a full copy.

And the second loop reuses the first loop's sparse-attention indices.

Z.ai's published comparison is on a 30B model with the same design as the 750B base. With about 10% more training compute and the same parameter count, the looped version showed clear gains, and average output length fell by 10 to 14% on benchmarks such as GPQA-Diamond and MMLU-Pro. Z.ai reads that as part of the reasoning moving from written tokens into the loop's depth.

The limits are Z.ai's to state, and it states two. GLM-5.4 tends to get caught in overly long "marathon thinking" loops. And it lists open questions, including how to give harder tokens more iterations and how the returns from looping behave as loop count and model size grow.

What it means for you: the claim that GLM-5.4 is comparable to a 2T-3T parameter model is Z.ai's own. The model is available to GLM Coding Plan users now, and its API waits on a security assessment.

What it means for you

Our view

Looping gives a deeper network without more parameters, as Z.ai describes it, and the useful question for a buyer is what that does to cost and quality on your own work. Z.ai's evidence for the design is its own 30B comparison.

Its statement that GLM-5.4 reaches intelligence levels comparable to 2T-3T parameter models is Z.ai's claim alone, and Z.ai itself lists marathon thinking loops and unsolved questions about adaptive compute. The Model API is not yet available, so for now Z.ai offers it only to GLM Coding Plan users.

If you test GLM-5.4 for coding, record output length and total tokens used on your own tasks next to accuracy.

It adds no new facts.

Share this story

Your reaction

We count reactions per story and day, never who reacted. The counts help us choose what goes in the monthly issue. If you are signed in, your own page shows yours too.

Check our sources

Every sentence above is checked against these 2 sources.

1 GLM-5.4 overview (Z.ai developer documentation)Z.ai · 23 Nov 2026 · 15 facts Open the source archived copy
  1. Z.ai's documentation says GLM-5.4 loops 28 layers of the GLM-5 base model for two iterations.

    GLM-5.4 loops 28 layers of the GLM-5 base model for two iterations.
    cite
  2. Z.ai says in a standard Transformer each layer runs once per forward pass, whereas in a Loop Transformer a group of weight-shared layers runs for multiple iterations, refining the hidden states from the previous pass.

    In a standard Transformer, each layer runs once per forward pass. In a Loop Transformer, a group of weight-shared layers runs for multiple iterations, refining the hidden states from the previous pass.
    cite
  3. Z.ai says this gives a deeper network without increasing the parameter count.

    This gives us a deeper network without increasing the parameter count.
    cite
  4. Z.ai says the idea is not new and that the 2018 Universal Transformer proposed weight-shared depth.

    The idea is not new. The 2018 Universal Transformer proposed weight-shared depth
    cite
  5. Z.ai says looped models trained from scratch still lag behind unshared models under the same pre-training compute budget, so it adapted an already pre-trained base model into a Loop Transformer through continued training.

    However, while weight sharing improves parameter efficiency, looped models trained from scratch still lag behind unshared models under the same pre-training compute budget. Instead of pre-training from scratch, we adapted an already pre-trained base model into a Loop Transformer through continued training.
    cite
  6. Z.ai says it made three changes at the 750B scale: gated progressive updates, a hybrid KV cache, and sparse attention index reuse.

    To balance performance gains with deployment costs at the 750B scale, we made three changes after extensive experimentation: Gated Progressive Updates ... Hybrid KV Cache (Global Sharing + Independent Sliding Window) ... Sparse Attention Index Reuse
    cite
  7. Z.ai says GLM-5.4 adds independent per-token gates for each iteration; the first pass writes conservatively with small gate values to keep scales stable and the second pass reuses this state to refine the output, opening the gates to write full updates.

    GLM-5.4 adds independent per-token gates for each iteration to proportionally write candidate updates back into the residual stream. ... The first pass builds global context and writes conservatively with small gate values to keep scales stable. The second pass reuses this state to refine the output, opening the gates to write full updates.
    cite
  8. Z.ai says that in its hybrid KV cache the second loop reuses the sparse KV selected in the first pass while keeping its own newly generated KV within a sliding window, so an extra loop costs one sliding window of KV cache rather than a full context cache.

    the second loop reuses the sparse KV selected in the first pass, while retaining its own newly generated KV within the sliding window. ... As a result, an extra loop only costs one sliding window of KV cache rather than a full context cache.
    cite
  9. Z.ai says the second loop directly reuses the attention indices generated by the first loop's indexer, and that its experiments show this performs nearly identically to recomputing indices on every pass.

    The second loop directly reuses the attention indices generated by the first loop’s indexer, adding zero indexing overhead. Our experiments show this performs nearly identically to recomputing indices on every pass.
    cite
  10. Z.ai says that on a 30B model with the exact same architecture as its 750B base, an iso-parameter comparison with only about 10% more total training compute showed clear gains for the looped version.

    On a 30B model with the exact same architecture as our 750B base, we ran a controlled iso-parameter comparison. With identical parameter counts and only ~10% more total training compute, the looped version showed clear gains
    cite
  11. Z.ai says average output length drops by 10-14% across most benchmarks such as GPQA-Diamond and MMLU-Pro in that comparison, and that part of the reasoning shifts from explicit output tokens into the implicit depth of the loop.

    Across most benchmarks like GPQA-Diamond and MMLU-Pro, average output length drops by 10–14%, mostly from shorter chains of thought. In effect, part of the reasoning shifts from explicit output tokens into the implicit depth of the loop.
    cite
  12. Z.ai says GLM-5.4 tends to get caught in overly long "marathon thinking" loops.

    Most notably, it tends to get caught in overly long “marathon thinking” loops, though this prolonged reflection and self-correction does consistently improve accuracy beyond its parameter count.
    cite
  13. Z.ai says open questions include how to achieve adaptive compute so harder tokens dynamically get more iterations, and how the returns of looping behave as both loop count and model size keep growing.

    We are exploring how to achieve adaptive compute so harder tokens dynamically get more iterations, and how the returns of looping behave as both loop count and model size keep growing.
    cite
  14. Z.ai says GLM-5.4 reaches "intelligence levels comparable to 2T-3T parameter models".

    Toned down to what the source says
    GLM-5.4 is our first flagship model built on the Loop Transformer architecture, reaching intelligence levels comparable to 2T-3T parameter models.
    cite
  15. Z.ai says GLM-5.4 is available to all GLM Coding Plan users now, and that the Model API will be made available upon completion of the security assessment.

    GLM-5.4 is now available to all GLM Coding Plan users. ... The Model API will be made available upon completion of the security assessment.
    cite
2 Universal Transformers (Dehghani, Gouws, Vinyals, Uszkoreit, Kaiser), ICLR 2019arXiv · 5 Mar 2019 · 7 facts Open the source archived copy
  1. The Universal Transformer paper, published at ICLR 2019, is by Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit and Lukasz Kaiser, who did the work at Google Brain.

    Authors:Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, Łukasz Kaiser ... Comments: Published at ICLR2019 ... Work performed while at Google Brain.
    cite
  2. The paper's Figure 1 caption says the Universal Transformer repeatedly refines a series of vector representations for each position of the sequence in parallel, combining information from different positions using self-attention and applying a recurrent transition function across all time steps; the figure itself is labelled "Parameters are tied across positions and time steps".

    Toned down to what the source says
    Figure 1: The Universal Transformer repeatedly refines a series of vector representations for each position of the sequence in parallel, by combining information from different positions using self-attention (see Eqn 2) and applying a recurrent transition function (see Eqn 4) across all time steps
    cite
  3. The paper says the Transformer, with its fixed stack of distinct layers, forgoes the inductive bias of recurrent networks towards learning iterative or recursive transformations, and fails to generalize in some simple tasks when string or formula lengths exceed those seen in training.

    Notably, however, the Transformer with its fixed stack of distinct layers foregoes RNNs' inductive bias towards learning iterative or recursive transformations. ... popular feed-forward sequence models like the Transformer fail to generalize in many simple tasks that recurrent models handle with ease, e.g. copying strings or even simple logical inference when the string or formula lengths exceed those observed at training time.
    cite
  4. The paper's Appendix B says a standard Transformer's number of sequential operations is constant, independent of input size and determined solely by the number of layers.

    While a standard Transformer executes a total number of operations that scales with the input size, the number of sequential operations is constant, independent of the input size and determined solely by the number of layers.
    cite
  5. The paper's Appendix B says varying the number of steps dynamically after training is enabled by sharing weights across sequential computation steps in the Universal Transformer.

    Varying the number of steps dynamically after training is enabled by sharing weights across sequential computation steps in the Universal Transformer.
    cite
  6. The paper's abstract says it adds a dynamic per-position halting mechanism, which it found improves accuracy on several tasks.

    We also add a dynamic per-position halting mechanism and find that it improves accuracy on several tasks.
    cite
  7. The paper's abstract reports a 0.9 BLEU improvement over Transformers on the WMT14 English-German translation task.

    machine translation where UTs achieve a 0.9 BLEU improvement over Transformers on the WMT14 En-De dataset.
    cite

Topics

The morning email

On the mornings we publish: the three top stories and up to four short ones. Free.

We email you a link to confirm. An issue may include one sponsor, always labelled Sponsored · Advertisement. Our emails count opens and clicks, not who made them. Unsubscribe in one click. What we keep