GLM-5.4: Z.ai's loop transformer coding model, and what's missing
Z.ai has released GLM-5.4, which it describes as its first Loop Transformer model. It runs 28 layers of the GLM-5 base twice to add depth without adding parameters, supports 1M tokens of context and 128K of output, and is available now only through the GLM Coding Plan. The API waits on a security assessment, and no benchmark numbers are published in text.
Z.ai has released GLM-5.4, its new flagship model and, according to its developer documentation, the first built on a Loop Transformer architecture. Instead of adding parameters, it runs a block of layers twice, which Z.ai says gives it intelligence "comparable to 2T-3T parameter models". For engineers the short version is: you can try it today through the GLM Coding Plan in your existing coding tools, but there is no API yet, and you will need to run your own comparisons because the published results are charts rather than numbers.
What Z.ai released
From the documentation page and the linked announcement:
| Item | GLM-5.4 |
|---|---|
| Architecture | Loop Transformer: 28 layers of the GLM-5 base looped for two iterations |
| Context window | 1M tokens |
| Maximum output | 128K tokens |
| Input | Text, image, video and file |
| Output | Text |
| Capabilities | Thinking mode, streaming, function calling, context caching, structured output |
| Streaming speed | Up to 200 tokens per second off-peak, 70 to 80 at peak |
| Access | All GLM Coding Plan users |
| API | Not yet; "will be made available upon completion of the security assessment" |
Users on weekly-quota Coding Plans get 1.5 times their GLM-5.3 quota for GLM-5.4. The page gives no API pricing, no total parameter count, and says nothing about open weights or a licence. The earlier GLM-5, 5.2 and 5.3 models have weights on Hugging Face; at the time of writing GLM-5.4 does not.
How the loop transformer works
A normal transformer passes each token through every layer once. GLM-5.4 takes 28 middle layers of the GLM-5 base model and runs them twice, so the model gets more depth, and more computation per token, from the same weights. It was made by continued training of the already pre-trained base model, not trained from scratch. Z.ai reports validating the approach at 1B, 4B, 30B and 750B base-model scales, and says a 30B looped model beat its unlooped version for about 10% more training compute.
Looping naively causes problems, and the documentation describes three fixes.
Gated progressive updates
Overwriting hidden states on each pass makes activation norms grow, so later layers see inputs outside their expected range. GLM-5.4 adds a per-token gate for each iteration that controls how much of each update is written back to the residual stream. After training, Z.ai says, the first pass writes conservatively and builds global context, while the second pass refines with wider gates, and harder tokens get bigger first-pass updates.
Hybrid KV cache
Keeping a full KV cache for each loop would double memory at long context. Instead, the second pass reuses the sparse KV entries the first pass selected and keeps its own new entries in a sliding window. An extra loop therefore costs one sliding window of cache rather than a second full-context cache. Z.ai says this keeps the deployment cost increase over GLM-5.3 "well under control" at 1M context.
Sparse attention index reuse
The base model uses sparse attention with an indexer that chooses which positions to attend to. The second loop reuses the first loop's indices instead of recomputing them, which Z.ai reports performs nearly the same as recomputing.
The practical meaning: compute per token goes up, but memory and parameter count stay close to the base model's. Whether that shows up as higher latency for you depends on Z.ai's serving, which is why the published streaming figures are worth checking against your own usage.
What the results claim
The documentation reports the biggest gains in maths, scientific reasoning and long-context tasks, and says average output length fell 10% to 14% on GPQA-Diamond and MMLU-Pro in the 30B ablation, meaning shorter answers for similar or better quality. The headline comparisons are given as a win-rate chart and an iso-parameter chart, not as numbers in text, so we can't quote scores. The announcement's title says the model is aimed at "generalized coding", but no coding benchmark figures are given in text either.
What engineers should do with it
- If you already pay for the GLM Coding Plan, GLM-5.4 is available in the coding tools you use with it, with a larger weekly quota than GLM-5.3. Try it on real tasks from your backlog, not toy prompts.
- If you build on the API, wait. There is no API model, no price and no date. Don't plan a migration until those exist.
- If you need self-hosting, nothing changes yet. No GLM-5.4 weights are published. For local work, smaller open models such as Inkling 2 Mini remain the options.
- Run your own evaluation. With no numbers in text, compare GLM-5.4 to your current model on a fixed set of your own tasks, with the provider pinned and the same harness. Score whether the change actually works, not whether the agent says it does. Our write-up of Hugging Face's guide to agentic evaluations covers how to do this without fooling yourself.
A new model is easiest to judge in one narrow role first, such as code review or test writing, where you can compare its output side by side with your current model before trusting it with whole tasks.
Open questions
- When will the API ship, and at what price?
- Will GLM-5.4 weights be released, as earlier GLM-5 models were, and under what licence?
- How does the second loop affect time to first token and throughput at long context, compared with GLM-5.3?
- What are the coding benchmark scores, and on which harness were they measured?
Sources
FAQ
What is a loop transformer?
It is a transformer that runs some of its layers more than once per token, adding depth and computation without adding parameters. GLM-5.4 loops 28 layers of the GLM-5 base model for two iterations, with gates and a shared KV cache to keep the extra pass stable and cheap in memory.
Is the GLM-5.4 API available?
Not yet. Z.ai says the model API will be released after a security assessment is completed, with no date or pricing given. GLM-5.4 is currently available only to GLM Coding Plan subscribers.
What is GLM-5.4's context window?
GLM-5.4 supports a 1M-token context window and up to 128K output tokens. It accepts text, image, video and file input and produces text.
Is GLM-5.4 open source?
Z.ai's documentation says nothing about open weights or a licence for GLM-5.4, and no GLM-5.4 weights appear on Z.ai's Hugging Face page at the time of writing. Earlier models, including GLM-5.3, are published there.
Written by the CodeBeast Team with AI assistance. Spotted a mistake? Email support@codebeast.ai.