GLM-5.4: Z.ai's First Loop Transformer and the Push Toward Generalized Coding

A2Agent Team ยท 2026-11-27T00:00:00Z

Z.ai released GLM-5.4 on November 23, 2026. It's the company's first flagship built on a Loop Transformer, an architecture that makes the model reason more deeply by reusing layers it already has instead of adding new ones. Z.ai is also using the launch to push a direction it calls Generalized Coding: using code as a general tool for video, games, 3D scenes and engineering design, not only for building software.

For now, GLM-5.4 is only available inside Z.ai's own products. API access and open weights are both promised for later.

The Loop Transformer

In a standard Transformer, each layer runs once per forward pass. A Loop Transformer runs some of its layers more than once, so the model can refine its internal representation using the result of the previous pass. That adds computational depth without adding parameters.

GLM-5.4 starts from the GLM-5 base model, which has about 750 billion parameters, and runs 28 of its layers twice. Z.ai didn't train a looped model from scratch. It adapted the already-trained GLM-5 base through continued training, and says looped models trained from scratch still trail standard models at the same compute budget. The company says it tested the approach on 1B, 4B, 30B and 750B base models, and claims GLM-5.4 performs like a model of 2 to 3 trillion parameters.

GLM-5.4 architecture diagram: a 26-layer prelude, a 28-layer block (layers 27 to 54) run in two loop passes joined by damp gates, a 24-layer coda, and a per-layer cache that passes first-pass KV latents and top-k indices to the second pass

Z.ai's architecture diagram shows how the layers are split. The first 26 layers (the prelude) run once. Layers 27 to 54 run twice, with the second pass sharing the first pass's weights. The last 24 layers (the coda) run once before the output head. The input embedding combines text embeddings with projected features from a 24-layer vision encoder.

Running layers twice normally costs extra memory and time, so Z.ai added three techniques to keep that in check:

  • Gates on each token control how much each pass writes back, which keeps the repeated computation stable.
  • A hybrid KV cache means the second pass only needs one sliding window of cache, not a full-context cache.
  • The second pass reuses the sparse-attention indices from the first, so the model doesn't have to work out what to attend to twice.

In a controlled comparison at the 30B scale, the looped version needed about 10% more training compute and improved most on math, scientific reasoning and long-context tasks. Its average output length also fell by 10 to 14% on benchmarks such as GPQA-Diamond and MMLU-Pro. If that holds at full scale, it suggests that more thinking inside the model can replace some of the long chain-of-thought text models usually write, which would make answers both faster and cheaper.

Generalized Coding

The architecture changes how the model reasons. Generalized Coding is about what it's used for. AI coding has mostly meant code completion, debugging, building software and automating tasks. Z.ai wants GLM-5.4 to use code as the underlying tool for a much wider range of work, and its launch demos show what that looks like:

  • A self-narrated "Hello World" music video, generated and edited through code
  • A complete game with character movement, physics, maps, combat and art assets
  • An interactive 3D bird-watching scene built from mathematical geometry and custom GLSL shaders
  • An engineering-grade CAD model of a six-axis robotic arm in FreeCAD

GLM-5.4 game demo: a brick-built island with a minifigure-style character, an "Island Map" minimap and a timer

GLM-5.4 3D scene demo: a fluffy white long-tailed tit on a snowy branch with red berries, next to a panel of rendering and pose controls

GLM-5.4 CAD demo: a rendered orange six-axis robotic arm on a black base

In each case, the model is writing code to design, simulate or produce something that isn't software. GLM-5.4 also adds vision, which GLM-5.3 lacked, so it can read screenshots and images while it works. That matters for visual tasks like matching a design or checking a render.

These are Z.ai's own demos. They show what the model can do on tasks Z.ai picked, not how often it succeeds on yours.

Speed and availability

Z.ai says GLM-5.4 generates up to 200 tokens per second off-peak and 70 to 80 tokens per second at peak load. The KV cache, sparse attention and low-level inference work are meant to keep the extra loop from raising serving costs much.

The model has a 1M-token context window. It's live for GLM Coding Plan subscribers in ZCode and Z.ai Chat, under the model name glm-5.4 (or glm-5.4[1m] in Claude Code), and Z.ai says weekly-quota subscribers get 50% more GLM-5.4 usage than they had with GLM-5.3. The regular pay-per-token API isn't open yet. Z.ai says it will open after a safety evaluation, and the weights will be released after further safety hardening.

What's still missing

Z.ai hasn't published a benchmark table for GLM-5.4. It says scores will come later, so the 2-to-3-trillion-parameter claim can't be checked yet. All the speed figures are Z.ai's own.

Early testing has been mixed. Simon Willison, who reached the model through a Coding Plan key, ran his pelican-on-a-bicycle test at several effort levels and found the results close in quality to GLM-5.3's. Z.ai also says the model can sometimes get stuck in very long "marathon thinking" loops, though it argues the extra self-correction still improves accuracy.

GLM-5.4 is also another release built on the GLM-5 base rather than a new base model, the same pattern as GLM-5.3. We expected that in our GLM-6 post, and it means GLM-6 is likely still to come.

What it means

GLM-5.4 matters for two reasons beyond the version bump. The Loop Transformer is a different way to get more reasoning out of a model: run the same layers twice instead of making the model bigger, at about 10% extra training compute in Z.ai's tests. And Generalized Coding points AI coding at video, games, 3D and engineering design, where the model uses code to build things instead of helping people write it. Whether either idea holds up depends on the benchmarks and independent tests that haven't arrived yet.

GLM on A2Agent

A2Agent carries GLM-5.3, GLM-5.3 Flash and the rest of the GLM family alongside DeepSeek, Kimi, MiniMax and Qwen, behind one API key with OpenAI-compatible and Anthropic-compatible endpoints. We'll add GLM-5.4 once Z.ai opens API access. See the Models page for current availability and prices. New accounts get $5 in free credit.

Sources