GLM-5.4 runs part of its network twice. Z.ai unveiled its new flagship model on November 22 and 23 and calls it the company’s first large Loop Transformer: 28 layers taken from the GLM-5 base model process every token in two passes, without adding a single parameter. Z.ai claims this puts the model on par with systems that normally need 2 to 3 trillion parameters. For now, only GLM Coding Plan subscribers can use it, through their coding tools, ZCode and Z.ai Chat. The pay-as-you-go API and the open weights are still on hold.
That makes the release worth a closer look for two reasons. The architecture is a serious attempt to scale compute depth rather than model size. And if your team already works in Claude Code, Cline or Codex, you can plug GLM-5.4 in today through the Coding Plan. We read Z.ai’s technical blog post and the developer docs, and below we separate what the company shows from what it simply asserts.
How GLM-5.4 differs from GLM-5.3
In a standard Transformer, each token passes through each layer exactly once. A Loop Transformer sends the hidden states through a block of weight-shared layers several times, and each pass refines what the previous one produced. You get a deeper network while the weights take up the same memory.
The concept has been around for a while. The Universal Transformer paper from 2018 already shared weights across depth, and later research on recurrent depth showed gains on small models. Z.ai is upfront about the catch: looped models trained from scratch usually trail regular models on the same pre-training budget. So instead of training GLM-5.4 from zero, the team converted an existing pre-trained base model into a Loop Transformer through continued training, which keeps the extra compute modest.
The reasoning behind it is straightforward. Tasks that lean on stored knowledge benefit from more parameters. Tasks built on long causal chains, such as large software projects, security analysis or 3D modelling, benefit more from extra compute per token. GLM-5.4 is aimed squarely at the second group.
Three tricks that keep the second pass affordable
Wrapping a loop around 28 layers sounds trivial. On a model in the 750-billion-parameter class with a one-million-token context, it quickly turns into a memory and cost problem. Z.ai describes three changes meant to contain it.
The first is about stability. If you simply run the middle layers of a finished model twice, activation norms blow up and downstream layers receive values at a scale they were never trained on. GLM-5.4 therefore writes each pass back into the residual stream through its own per-token gates. According to Z.ai, the gates settled into a clear split during training: the first pass builds global context and writes cautiously, the second pass refines and opens the gates wide. On harder tokens, even the first pass writes more aggressively.
The second targets the KV cache. A naive implementation keeps a full cache for every loop iteration, so memory grows with the loop count. In GLM-5.4, the second pass reuses the sparse KV cache selected during the first and only keeps a local sliding window for its own new values. An extra loop therefore costs one window, not a whole context cache. At a million tokens, that is the difference between viable and prohibitively expensive.
The third concerns the base model’s sparse attention. The second pass reuses the attention indices the indexer computed in the first, so there is no additional indexing work. Z.ai says this performs almost exactly like recomputing the indices on every pass. In production, the company quotes up to 200 tokens per second off-peak and 70 to 80 tokens per second at peak load, helped by fused kernels.
What the 30B ablation shows, and what it doesn’t
The most telling figure in the report doesn’t come from GLM-5.4 itself. Z.ai validated the architecture step by step on base models with 1, 4, 30 and 750 billion parameters. On the 30B model, which shares the architecture of the large base model, the team ran a controlled comparison: identical parameter count, roughly 10 percent more training compute for the looped version, measured after 200K-token long-context fine-tuning with thinking mode enabled.
Two results stand out. The biggest gains show up in maths, scientific reasoning and long-context tasks. Responses also get shorter: on benchmarks such as GPQA-Diamond and MMLU-Pro, average output length drops by 10 to 14 percent, mostly because the visible chain of thought shrinks. Z.ai’s reading is that some of the reasoning moves out of generated tokens and into the extra depth of the loop.
That is a reasonable interpretation, but it was measured on a 30B test model and published by the vendor. The blog offers no equally controlled comparison for the 750B model, only the claim that it is “comparable to 2T-3T parameter models”. Independent benchmarks were not available at the time of writing. If you are considering GLM-5.4, test it on your own workload rather than trusting leaderboards.
Marathon thinking is a known weakness
Z.ai is unusually candid about the limits. The model tends to get stuck in very long reasoning phases, which the blog calls “marathon thinking”. That extended self-correction does push accuracy beyond what the parameter count would suggest, but it costs time and quota.
It ties in with a detail from the docs you should know before wiring the model into a coding agent. The default reasoning effort is max. Turning thinking off in your client doesn’t give you a plain answer model either; per the docs, it maps to low, which still does some light reasoning. Values like medium or high map to high, and anything unrecognised falls back to max. For routine jobs such as renames or small refactors, it pays to dial the effort down deliberately.
Setting up GLM-5.4 in Claude Code and Cline
According to Z.ai’s model switching guide, GLM-5.4 is available on every Coding Plan tier: Lite, Pro and Max. On weekly quota plans, the GLM-5.4 allowance is 1.5 times that of GLM-5.3. You need a Z.ai API key from the Coding Plan and the right endpoint: https://api.z.ai/api/anthropic for Claude Code, https://api.z.ai/api/v1 for Codex, and https://api.z.ai/api/coding/paas/v4 for other OpenAI-compatible tools.
In Claude Code, add these keys to ~/.claude/settings.json without replacing the rest of the file:
{
"env": {
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]"
}
}
The [1m] suffix switches on the one-million-token context. If Claude Code complains that the model doesn’t exist, Z.ai says updating Claude Code fixes it. Run /status in a session to confirm the switch, and use /effort to change the reasoning level. In Cline, pick “OpenAI Compatible”, enter the coding endpoint as the base URL, set the model to glm-5.4 and the context window to 1,000,000. Image input works too: according to the spec sheet, the model accepts text, images, files and video and can return up to 128K tokens.
No API and no weights yet
For many companies, the most important line in the announcement is the least flashy one. The standard model API will only open after a security assessment, and Z.ai plans to release the weights “responsibly” once safety hardening is done. There is no date for either, and the licence for the eventual weights is unknown. That sets GLM-5.4 apart from its predecessor, whose open weights featured in our piece on an exploit experiment with GLM 5.3.
In practice, using GLM-5.4 today means sending code and context to Z.ai’s own infrastructure. Since October 16, Z.ai has kept keys for the standard API and the Coding Plan separate, which tidies up billing but doesn’t change where your data goes. For projects involving customer data or strict compliance rules, that is a very different proposition from a self-hosted open-weight model. Add to that the policy debate around Chinese models in enterprise use, which we covered when a US report on Chinese open-weight models came out. If you need open weights for a large model right now, recent releases such as Tencent Hy4 are the more practical option.
Our take
GLM-5.4 matters less for any single benchmark score than for the direction it signals. Z.ai shows that an existing large model can be retrofitted into a Loop Transformer, and it is quite specific about what breaks along the way: exploding activations, a doubled KV cache, duplicate indexing. The next step it hints at, adaptive depth that gives harder tokens more passes, follows naturally. Z.ai says a significantly larger successor is already on the way.
Our advice is to keep the test simple. If you already pay for the Coding Plan, run GLM-5.4 against your current model on two or three real tasks from your own repository, and watch runtime and quota usage as closely as the output. Everyone else can wait for the API and the promised weights. Only then can anyone independently check whether the loop delivers what the 30B ablation suggests.
Sources: Z.ai blog “GLM-5.4: Toward Generalized Coding with Our First Loop Transformer” (Nov 23, 2026), Z.ai developer docs on GLM-5.4 and on switching models in the Coding Plan, Universal Transformer paper (arXiv 1807.03819). All performance figures are vendor claims.



