News

Why Z.ai’s GLM-5.4 runs the same 28 layers twice

Z.ai’s new coding model applies the same layers twice. A controlled test shows what the idea can do at a smaller scale, while ZCode offers a way to tune how long the model thinks.

Milo · FoxAI World3 min read
18
Milo sits beside a laptop and a looping stack of layers beneath the Z.ai logo.GLM-5.4’s second pass

Conceptual cover created with AI.

A one-line edit and a change that touches several files ask very different things of a coding model. With GLM-5.4, Z.ai has changed how its model works through each step of generation. It sends its intermediate result through the same 28 layers twice, giving the second pass a chance to refine what the first pass worked out.

What happens on the second pass

Z.ai adapted an already trained GLM-5 base model at roughly the 750-billion-parameter scale. Layers are stages that transform information as it moves through the model. Parameters are learned values that determine how those stages work. In this Loop Transformer design, the repeated block shares the same weights, so the second pass adds computation without duplicating those parameters.

Z.ai describes the first pass as building a picture of the wider context. The second updates that internal representation more substantially. It reuses some information held in the first pass’s cache and keeps a smaller cache for recent positions. That design avoids storing a full copy of the context for each pass.

Milo points to two stacks of layers connected by circular arrows on a diagram.
AI-generated conceptual illustration.

What Z.ai measured at a smaller scale

Z.ai compared two versions of a 30-billion-parameter test model with the same parameter count. The looped version took about 10 percent more computing work to train. The company reports its biggest gains on maths, scientific reasoning and tasks involving long inputs. On most of the benchmarks it describes, average output length fell by 10 to 14 percent, largely because the model generated fewer intermediate reasoning tokens. A token is a unit of text, often part of a word.

Z.ai also compares GLM-5.4’s capabilities with those of models with two to three trillion parameters. The controlled figures above describe the smaller experiment. A comparison of the flagship model on a particular task still depends on how that task is measured.

From visual input to code

GLM-5.4 can take images, video, text and files as input and returns text. You can supply an image as a reference for a coding task, and the model can return code for another tool to run. Z.ai illustrates the idea with code for editing video and a six-axis robot arm modelled in FreeCAD, a computer-aided design application. In the FreeCAD example, the deliverable is a digital design.

Access and how much time to give a task

GLM Coding Plan includes the model on Lite, Pro, Max and Team, in ZCode and other compatible tools. The current eligible plans offer 50 percent more usable tokens within the same quota than with GLM-5.3. Legacy V1 plans can access GLM-5.4 with their existing benefits. Z.ai says access through the general model API, the interface for developers’ own software, will follow a security assessment.

ZCode starts at Max reasoning effort. Z.ai reports that GLM-5.4 sometimes spends a long time reasoning, and ZCode offers lower effort settings. For a small, clearly specified edit, I’d start lower because the result is quick to check. For a change with several dependencies, I’d give the model more room and measure the time until the change passes review. The rate at which text appears measures only one part of that work.

Ask AI about this article

Opens in a new tab with the question filled in.

Sources and research

Written by FoxAI World. The cover and illustrations are AI-generated conceptual artwork.

Your favourites

This list stays in this browser on your device. No account is needed, and other visitors cannot see it.

Use a story’s bookmark button to add your first favourite.