Reported by The Decoder
Z.ai is moving its flagship model to a loop architecture that runs some of its layers twice. With GLM-5.4, the company wants to mark the start of "Generalized Coding," where code also generates videos, games, and CAD models.
Following OpenAI, Z.ai is introducing GLM-5.4, its first large model built on a loop transformer. While standard language models use each layer once per pass, GLM-5.4 runs a block of shared layers multiple times, refining the intermediate results from the previous pass to make the network deeper without adding parameters. OpenAI has used a similar architecture since GPT-6 Astra . According to Z.ai, the 750-billion-parameter model reaches performance comparable to models with 2 to 3 trillion parameters.
The team retrained the GLM-5 base model released in February into a loop model that runs 28 layers twice. Loop models trained from scratch have so far performed worse than models without shared weights under the same compute budget, Z.ai writes .
More from the original report
Converting the model introduces a problem, Z.ai says. If the model simply overwrites intermediate states on each pass, activations grow sharply from round to round, leaving subsequent layers with values outside the range they were trained on.
To handle this, GLM-5.4 uses dedicated gates for each token and pass to control how much of the new output flows back into the data stream. According to Z.ai, the model builds context cautiously on the first pass and writes its changes back in full on the second. On difficult tokens, Z.ai says, the first pass steps in more strongly.
Because the second pass would otherwise double memory usage, both passes share the KV cache, the temporary memory for previously processed tokens. The second pass stores its own extra values only in a small local window. As a result, Z.ai says, the overhead compared to GLM-5.3 stays manageable even at a 1-million-token context.
To save on compute as well, the model uses sparse attention to pick the most relevant earlier tokens upfront rather than scanning the entire context every time, a standard technique. The second pass then reuses that selection from the first instead of making…

