Your privacy choices

Allow optional cookies for referral attribution, visit analytics, and Google Ads purchase measurement.

Back to blog

GLM-5.4's Three Engineering Changes: Making One Extra Loop Cheaper

Loop TransformerKV cachesparse attentiongatingGLM-5.4

Turning an existing model into a looped one sounds like "run the same layers one more time". The hard part is what an extra round does to activation scale, and whether memory and retrieval costs double with it.

Zhipu is direct about this. To balance looping quality against deployment cost, the team ran a series of experiments and then made three changes for the 750B-scale model: gated progressive updates, globally shared KV cache with an independent sliding window, and reuse of sparse-attention indices. The English blog titles the section Architectural Modifications at 750B Scale. All three aim at the same thing: keep the cost of "thinking one more round" as low as possible.

This article explains, following the official description, what problem each change addresses. It is not an implementation guide, and it does not supply hyperparameters that Zhipu did not state.

1. Gated progressive updates: don't overwrite and blow up the scale

The official post begins with a problem that appears when converting an existing model. If middle layers are looped and each round's output simply overwrites the hidden state, activation norms inflate excessively with the number of rounds, and later layers receive representations that drift away from the scale and distribution the original model expects.

GLM-5.4 gives each round its own per-token gate, which writes a proportion of that round's candidate change back into the residual stream instead of replacing it outright.

After training, Zhipu observed that the gates divide the work:

  • The first round builds the global context state. For most positions it writes back gently with small gate values, which keeps the scale stable.
  • The second round reuses that state to refine the result. It opens the gates and writes back fully.
  • The gates also adjust step size according to how hard a token is to predict. At harder positions the first-round write grows somewhat, so complex predictions benefit more from the multi-round iteration.

One distinction matters. This "step size by difficulty" is a change in write-back magnitude within a given round. It is not the adaptive number of loop rounds that Zhipu mentions. The post names "giving tokens of different difficulty different amounts of compute" as a question still to be answered. The division of labor in the gates must not be described as variable-round looping that already exists.

2. Globally shared KV cache plus independent sliding window: one more round, almost no extra full-context cache

The naive approach keeps a full KV cache for every loop round, so memory grows in proportion to the number of rounds. That may be tolerable at short context, but the official post stresses deployment cost at 1M-token context.

GLM-5.4 shares KV across rounds and then uses a sliding window to add local information from the new round:

  • The second round reuses the sparse KV selected in the first round.
  • It also keeps the KV generated by the second round inside a sliding window.
  • The two sets of KV can cover the same positions, so the model reads the first round's context representation and also uses the updated local representation from the second.

The extra cost of one more round is therefore one window's worth of KV, not a whole second full-context cache. The official conclusion is that at 1M context this keeps GLM-5.4's deployment-cost increase over GLM-5.3 controlled. The English blog adds that the two sets of KV may overlap at the same positions. The two language versions agree, and the English one states the overlap more plainly.

In the availability section, the official post describes the same design from the inference-system side: a KV cache split by distance, so the second loop adds almost no memory. This is the same design as above, not a separate caching strategy.

3. Reusing sparse-attention indices: no extra retrieval cost

The official post says the GLM-5.4 base uses sparse attention. If the indexer ran again in every loop round, retrieval cost would grow with the number of rounds. GLM-5.4 lets the second round use the indices the first round's indexer produced, so it adds no indexer overhead at all.

Zhipu also gives a result: in its experiments, this performs almost the same as recomputing the indices each round (the English text says "nearly identically"). That is an official experimental conclusion, not a third-party replication. The indexer's algorithm, budget and layer placement are not detailed in the technical blog, and this article adds nothing there.

Taken together, the second and third changes make a practical point. An extra loop adds almost no memory and no retrieval cost. Add operator fusion and fewer round trips of intermediate results through memory, and you can see why Zhipu still states speeds of up to 200 tokens/s off-peak and 70–80 tokens/s at peak on a looped architecture. Those speeds are the official availability claims. This article records them as stated and does not present them as measured.

What the three changes serve: converting an existing base

If a looped model were trained from scratch, the design space would look different. GLM-5.4 took another route and converted an already trained 750B-scale base into a Loop Transformer. The engineering problem then becomes how to run 28 layers for one more round without disturbing the original representation scale or driving up serving cost. All three changes serve that constraint. For the training path, see Why Convert a Pretrained 750B Base.

Because the cost has been pushed down, one over-reading needs avoiding. A low cost does not mean an extra loop is free, and it does not mean the loop count can rise without limit. Zhipu itself lists "how the benefit changes as loop rounds and model size keep growing" as an open question. The published design is still two rounds, not a verified arbitrary-depth loop.

For the more basic structural difference, see What Is a Loop Transformer. To compare against the earlier weight-sharing design, see Loop Transformer vs Universal Transformer.

Sources and verification notes

  • First-party Chinese: Zhipu, GLM-5.4: Toward Generalized Coding, the Surprise of the First Loop Transformer. The names and mechanisms of the three changes, and the statement that three changes were made for the 750B-scale model, come from this post.
  • First-party English: the Z.ai technical blog. Used to check the hybrid KV, index reuse and the 1M-context deployment-cost wording.
  • Machine Heart's explanation of the three changes largely retells the official post. Use it as a cross-check, not as a replacement for the first-party text.
  • 200 tokens/s and 70–80 tokens/s are official speed claims, not third-party or independent measurements.

Sources were checked on November 23, 2026 (Singapore time, UTC+8).