Code is changing the landscape with GLM-5.4’s loop architecture
A layer block executed twice: GLM-5.4 combines loop reasoning and vision to extend code to video, gaming, and CAD.
A six-axis robotic arm modeled in FreeCAD, a game with movement and combat, a 3D birdwatching scene: the demonstrations of GLM-5.4 place programming in the service of visual and technical productions. The model writes code to build these objects and experiences. The design of the arm here falls under CAD, with no demonstration of fabrication or physical validation.
The technical presentation published by Z.ai Z.ai gives this orientation the name of “Generalized Coding”. The announced vision capabilities are meant to strengthen work on visual outputs. A music clip titled “Hello World”, presented as narrated by the model, also illustrates the use of code to produce video. These examples show the intended uses, without constituting a systematic comparison of their quality with that of other models. Added depth to an already trained model
The central change concerns the flow of information through the network. In a classic Transformer, each layer is executed once during a pass. Here, the same 28-layer block of the GLM-5 base model is traversed twice, with shared weights. The second pass reworks the representations produced by the first: more computation is devoted to transforming them without adding a new parameter block.
The construction starts from a pretrained model, adapted by continued training. The team explains that it chose this route because loop-trained models starting from scratch remain less effective than their equivalent without layer sharing at equal pretraining budget. This is the laboratory’s first flagship model based on this architecture, whose principle has precedents in research.
At the scale of 750 billion parameters described for GLM-5.4, reusing the layers poses a stability problem. Changes that are too large to internal representations can disrupt the following layers. Control mechanisms specific to each token and each pass therefore modulate the updates. According to the team’s observations, the first pass mainly builds the context, while the second provides more substantial adjustments. The detailed results focus on a 30-billion-parameter model
To examine the effect of the loop, the laboratory presents a controlled comparison on a 30-billion-parameter model, sharing the architecture of its 750-billion base. The number of parameters remains identical between the compared versions, but the looped variant receives about 10% additional training compute. The measurements are carried out after a phase of supervised long-context learning, with reasoning mode enabled.
The reported gains mainly concern mathematics, scientific reasoning, and long-context tasks. On most of the cited tests, including GPQA-Diamond and MMLU-Pro, the average length of outputs decreases by 10 to 14%, mainly thanks to shorter written reasoning traces. These figures describe the 30-billion-parameter trial, not a result directly transferable to GLM-5.4.
The laboratory also claims that its model reaches a level comparable to that of 2,000- to 3,000-billion-parameter networks. This comparison remains a claim by the publisher, separate from the controlled trial presented. The publication also acknowledges a tendency toward excessively long reasoning, referred to as “marathon thinking,” despite the token savings observed in the smaller-scale tests. Containing the cost of the second pass
Reusing the layers does not make the additional compute free. A simple implementation would keep a complete cache for each iteration, multiplying memory needs. The described mechanism shares part of the KV cache, which stores the representations useful to attention, between the two passes. The second adds its own recent information in a sliding window, rather than a second cache covering the entire context.
The positions selected by the first pass attention mechanism are also reused in the second. Computation operations have been grouped to limit intermediate memory reads and writes. On its infrastructure, the laboratory reports up to 200 tokens per second during off-peak hours and 70 to 80 during periods of heavy load. These throughput figures do not, by themselves, give the time needed to complete a creative task or a long reasoning sequence.
The offered access goes through the GLM Coding Plan, ZCode and Z.ai Chat. API access is announced after a security evaluation. The release of the weights is still planned after security work, with no date or license specified in this presentation.