GLM 5.4 Architecture: How the Loop Transformer Works
Dec 2, 2026

GLM 5.4 Architecture: How the Loop Transformer Works

GLM 5.4 architecture explained: 28 shared GLM-5 layers run twice, gated updates, hybrid KV cache, sparse index reuse, and what the design means for speed and cost.

Quick answer: The GLM 5.4 architecture is a Loop Transformer. Instead of stacking more layers, Z.ai takes 28 layers from the GLM-5 base model and runs them twice per token, so the network gets deeper without adding parameters. The model is about 750B in scale, and Z.ai claims it performs like a 2T–3T parameter model. Three engineering changes make the loop practical: gated progressive updates, a hybrid KV cache, and sparse-attention index reuse, plus fused kernels. It was built by continued training of an existing base, not trained from scratch.

Most GLM 5.4 coverage repeats "loops 28 layers twice" and stops. This guide explains what each part of the GLM 5.4 architecture does, why Z.ai made each choice, and what it means for you as a user: speed, memory, output length and cost. Every architectural fact below comes from Z.ai's GLM-5.4 model documentation, checked on December 2, 2026. Where Z.ai has not published a detail, such as the active-parameter count, we say so.

GLM 5.4 Architecture at a Glance

GLM 5.4 architecture componentWhat Z.ai published
DesignLoop Transformer
Shared block28 layers reused from the GLM-5 base model
Iterations2 passes per token
Scale~750B (active parameters not published)
Claimed levelComparable to 2T–3T parameter models
TrainingContinued training of a pre-trained base
StabilityGated progressive updates per iteration, per token
MemoryHybrid KV cache: shared global KV plus a second-pass sliding window
AttentionSecond pass reuses the first pass's sparse-attention indices
SystemsFused core kernels to cut memory reads and writes
Scales tested1B, 4B, 30B and 750B
Context / output1M tokens / 128K tokens

Why the GLM 5.4 Architecture Loops Layers

Z.ai splits hard tasks into two kinds. Some are memory-bound: they need more parameters to store facts. Others are reasoning-bound: they need more computation per step. Large software projects, security work, 3D modeling and physical control fall in the second group.

Adding parameters helps the first kind. For the second, the GLM 5.4 architecture adds depth instead. Running the same 28 layers twice doubles the computation spent refining each token's hidden state, while the weights stay the same size.

The idea behind the GLM 5.4 architecture is not new. The 2018 Universal Transformer paper proposed shared-weight depth. What is new is applying it to a ~750B production model and getting it to train stably at that scale.

The pain point this guide solves: "Loop Transformer" sounds like marketing until you see the mechanics. Our addition over launch coverage is a component-by-component breakdown tied to practical effects you will notice when you use the model.

The Four Pieces of the GLM 5.4 Architecture

1. Gated progressive updates

In a looped design like the GLM 5.4 architecture, running a block twice can make activations grow with each pass until training becomes unstable. Z.ai gives each iteration its own per-token gates that control how much of the new update is written back into the residual stream. The second pass refines the first pass's result rather than overwriting it, which keeps activation norms in check.

2. Hybrid KV cache

A naive loop would need a full KV cache for each pass, doubling memory for long contexts. In the GLM 5.4 architecture, both loops share the global KV cache, and the second pass adds only its own sliding window. Z.ai's summary: an extra loop costs one sliding window of KV cache rather than a full context cache. That is why GLM 5.4 can keep a 1M-token context without doubling memory per request.

3. Sparse-attention index reuse

The GLM 5.4 architecture inherits sparse attention from the GLM-5 family, which first computes which tokens each position should attend to. GLM 5.4's second loop reuses the indices from the first loop, so the extra pass adds zero indexing overhead.

4. Fused kernels

At the systems level of the GLM 5.4 architecture, Z.ai fused core kernels to reduce memory reads and writes. Looping doubles compute per token, and fusion keeps that from turning into a doubling of memory traffic.

How the GLM 5.4 Architecture Was Trained

Z.ai did not pretrain the GLM 5.4 architecture from zero. It took an already pre-trained GLM-5 base and converted it into a looped model through continued training. Z.ai says pretraining looped models from scratch still lags at equal compute, so conversion was the cheaper, more reliable path. It validated the approach at 1B, 4B, 30B and finally 750B.

In a 30B iso-parameter ablation (same parameter count, with and without looping), the looped version used about 10% more total training compute. On that 30B test, Z.ai reports average output length dropped 10–14% on benchmarks such as GPQA-Diamond and MMLU-Pro. Z.ai's reading: part of the reasoning moves from visible thinking tokens into the extra depth.

What the GLM 5.4 Architecture Means for You

GLM 5.4 architecture effectWhyWhat to do
Strong per-token reasoningTwo passes per tokenUse it for hard, multi-step coding and analysis
Possibly shorter answers10–14% shorter output at 30BTrack output tokens; it may lower cost per task
But "marathon thinking"Z.ai's flagged weakness on hard problemsCap time or tokens on your hardest prompts
Long context without double memoryShared KV plus a sliding window1M context stays practical
Big hardware to self-host~750B weightsPlan multi-GPU servers if weights ship
SpeedUp to 200 tokens/s off-peak, 70–80 at peak on Z.aiBatch heavy jobs off-peak

The two middle rows show the GLM 5.4 architecture pulling in opposite directions. The looped depth can make normal answers shorter, while Z.ai itself says GLM 5.4 tends to get caught in long reflection loops on hard problems. On real workloads, measure it: per-task output tokens tell you which effect wins.

GLM 5.4 vs GLM 5.3 Architecture

Compared with the GLM 5.4 architecture, GLM 5.3 was built on the GLM 5.2 base with scaled long-horizon reinforcement learning and was text-only. GLM 5.4 changes the structure itself: looped depth plus native video, image, text and file input. On the API, Z.ai says GLM 5.4's text parameters are the same as GLM 5.3's, so code that calls GLM 5.3 needs only a model-name change. For the full feature comparison, see GLM 5.4 vs GLM 5.3.

What Z.ai Has Not Published About the GLM 5.4 Architecture

  • Active parameters per token
  • Total layer count of the GLM-5 base and which 28 layers are reused
  • A full benchmark table for the 750B model
  • Weights or a technical report you can inspect

Until those arrive, treat the GLM 5.4 architecture's 2T–3T claim as Z.ai's own assessment, not an independent result.

Test the GLM 5.4 Architecture Yourself

The fastest way to see the GLM 5.4 architecture's behavior is to run the same hard prompt on GLM 5.4 and GLM 5.3 and compare output length and answer quality. You can do that side by side on glm5.app, or read the GLM 5.4 model page for specs and access in one place.

FAQs About GLM 5.4 Architecture

What architecture does GLM 5.4 use?

The GLM 5.4 architecture is a Loop Transformer: 28 layers from the GLM-5 base, weight-shared and run twice per token, at about 750B scale.

Is the GLM 5.4 architecture mixture-of-experts?

Z.ai has not described GLM 5.4's expert layout or active parameters, so this cannot be confirmed from official sources.

Why does the GLM 5.4 architecture make it stronger?

It spends twice the computation refining each token without adding parameters, which helps reasoning-bound tasks more than memory-bound ones.

Does the GLM 5.4 architecture make it slower?

It doubles per-token compute, but shared KV cache, index reuse and fused kernels offset much of it. Z.ai reports up to 200 tokens/s off-peak.

Is the GLM 5.4 architecture open source?

The GLM 5.4 architecture design is documented, but the weights and code have not been released. See GLM 5.4 download for status.

Sources

Architecture details summarize Z.ai's documentation as of December 2, 2026. The 2T–3T comparison is Z.ai's claim and has not been independently verified.

Start Using GLM 5 Today

Try GLM 5 free — reasoning, coding, agents, and image generation in one platform.