GLM-5.4 runs 28 layers twice. Does your app send two requests?

Understand GLM-5.4’s 28-layer loop, distinguish internal compute from API retries and agent turns, and test a coding upgrade on a task with known answers.

Published
On this page

What goes into the second pass?

Press Send once and the second pass inside GLM-5.4 does not trigger another request from your client. Z.ai's Loop Transformer changes how the model processes information inside a forward pass. That distinction matters when you look at a trace, estimate the cost of a coding task or decide whether an upgrade improved your application.

Z.ai describes a block of 28 layers that runs twice.[1][5] The second pass reuses the block's weights and receives an internal state that the first pass has already updated. Think of the weights as learned transformation rules and the state as the representation being transformed. Applying the same rules to the updated state can refine it further.

Count only that block and you get 28 × 2 = 56 layer executions, or 28 additional executions compared with one pass. You cannot derive the entire network's layer count, its parameter count or the duration of a response from that calculation. The earlier Universal Transformer paper is useful background on applying shared transformations repeatedly to refine representations.[2]

Three places where repetition can occur

What repeatsWhere you can observe itWhat the application should track
A block of layers inside the modelThe architecture documentation describes it. An application trace ordinarily records the external request.Submit the input once and read the response as usual.
A client retries a timed-out submissionRequest logs and the client's retry historyReconcile each attempt and its usage, including any duplicated business action.
A coding assistant reads a file and asks the model to continueTool traces and subsequent model requestsCount the requests and tool work needed until the task passes acceptance.

An engineer can enter “fix the order export” once while the assistant reads a file, changes a function and runs tests. That one instruction may lead to several model interactions. To price the ticket, reconcile the actual requests and applicable usage records. To measure turnaround, start with submission and stop when the tests pass. The model's internal pass count supplies neither measurement.

Test the change on a task with a known answer

Z.ai describes a controlled experiment at the 30B scale that held parameter count constant and used about 10% more total training compute for the looped model. That figure concerns the training run.[5] It cannot predict your invoice or latency for a single order export.

For a coding comparison, ask each assistant to modify a CSV aggregation function. The function must multiply quantity by unit price and sum the results, including refunds recorded as negative quantities. Prices are integer cents. Give each candidate the same starting repository, files, tool permissions and acceptance tests.

csvcode
sku,quantity,unit_cents
CUP,3,1250
CUP,-1,1250
BOWL,2,825

The first test should return 4150 cents: 3750 minus 1250 plus 1650. Change the final quantity from two to three and the expected total becomes 4975 cents. The second case catches a patch that hardcodes the first answer. For each run, record whether the tests passed, the actual model request count, time to an accepted patch and any help from a human. These fixtures are answer keys for a comparison you can run. We did not benchmark GLM-5.4 on them.

Where to try 5.4 and how to check the SmarToken catalog

On December 1, 2026, Z.ai's model guide listed GLM-5.4 access through its Coding Plan and said its separate Model API would become available after its security assessment. On the same date, the public SmarToken catalog listed glm-5.2, glm-5.3, glm-5.3-flash and glm-5.3-flashx.[4] Check the live catalog for the exact ID before changing an app. When comparing 5.4 in a coding client with an existing workflow, record the client and tools used in each run as well as the model name.

Sources

  1. Z.ai GLM-5.4 architecture and access guide
  2. Dehghani et al., Universal Transformers
  3. GLM versions and access on SmarToken
  4. Current SmarToken model catalog
  5. Z.ai GLM-5.4 Loop Transformer technical blog