28 Layers Twice Reaches 2-3T: GLM-5.4 Moves Thinking From Token Space Into Activation Space, and Hides the Bill in Sliding-Window KV and a Fixed Loop Count
On the evening of November 23, Zhipu AI released GLM-5.4, its first flagship built on Loop Transformer architecture. The official post is blunt: “Intelligence from computational depth — running two rounds of iterative reasoning over 28 layers of a 750B base, reaching the intelligence level of a 2-3T model.”
That sentence carries three layers of information worth peeling apart:
First, it was not trained from scratch — an existing base was retrofitted. Second, the looping happens in 28 layers, not all of them. Third, the loop count is fixed at two, not adaptive.
Each of those three carries a cost, and the costs are of entirely different kinds. This article aims to make clear what a Loop Transformer actually does, what it buys, and what it pays.
Part One: The Mathematical Nature of Looping, and Why It Is Not Just a Deeper Network
Start with definitions. A standard Transformer forward pass is:
h_0 = Embed(x)
h_1 = F_1(h_0)
h_2 = F_2(h_1)
...
h_L = F_L(h_{L-1})
y = Head(h_L)
L layers, each with distinct parameters. Depth is L, parameter count proportional to L.
A Loop Transformer is:
h_0 = Embed(x)
for t in 1..k:
h_t = F(h_{t-1}) # note: the same F
y = Head(h_k)
One function F iterated k times. Depth is k, but parameters are just one layer’s worth.
The key difference is not “deeper” — it is “the same function applied repeatedly.”
Mathematically this is an iterated map, a dynamical system. Its properties differ completely from “distinct functions in series”:
First, parameter efficiency is k-fold. For the same parameter budget, the looping version gets k times the effective depth. This is what Zhipu means by “deeper network without increasing parameter count.”
Second, expressiveness is constrained by F’s iteration properties. A series F_L ∘ … ∘ F_1 can express arbitrarily complex functions (each layer free). F^k can only express “F to the k-th power” — a restricted function family. F must be a function suitable for iteration: it cannot diverge too fast, and it cannot collapse to a fixed point too fast (or the second round does nothing).
Third, looping is inherently input-dependent depth. If F contains some gating or conditioning, different inputs can take different effective step counts. In theory this is more flexible than fixed-depth Transformers — provided the gating is well designed.
Fourth, gradient propagation changes. In a series network gradients pass through L distinct Jacobians; in a looping network the gradient is the product of the same Jacobian, k times. Two consequences: easy explosion/vanishing (the same matrix multiplied k times, spectral radius decides), and — all rounds share one accumulated gradient, which is both efficiency and constraint.
The “gated update” Zhipu mentions exists precisely for the first consequence: gating controls the update magnitude per round, preventing the hidden state from drifting or exploding under repeated iteration. This is not an optional optimization; it is a required component of looping architecture.
# -*- coding: utf-8 -*-
"""Loop depth vs serial depth: params, compute, expressiveness constraint"""
from dataclasses import dataclass
@dataclass
class Config:
d_model: int = 6144 # hidden dim (illustrative for 750B scale)
layers: int = 28 # layers participating in the loop
loops: int = 2 # loop rounds
params_per_layer_b: float = 1.2 # params per layer (billions, illustrative)
def compare(c: Config):
serial_layers = c.layers
serial_params = serial_layers * c.params_per_layer_b
serial_flops_units = serial_layers
loop_params = c.layers * c.params_per_layer_b # params unchanged
loop_flops_units = c.layers * c.loops # compute doubles
loop_effective_depth = c.layers * c.loops
print(f"{'':<22}{'serial(28L)':<18}{'loop(28L x2)'}")
print(f"{'params (rel.)':<22}{serial_params:<18.1f}{loop_params:.1f}")
print(f"{'compute (rel.)':<22}{serial_flops_units:<18}{loop_flops_units}")
print(f"{'effective depth':<22}{serial_layers:<18}{loop_effective_depth}")
print()
print(f"depth per param improves {loop_flops_units/serial_flops_units:.1f}x")
print(f"but compute also rises {loop_flops_units/serial_flops_units:.1f}x")
compare(Config())
print()
print("Key: 'same parameter count' does NOT mean 'same compute'.")
print(" Looping buys depth with FLOPs, not with parameters.")
This comparison is the first key to understanding GLM-5.4.
“A 750B model reaching 2-3T intelligence” accurately means: with 750B parameters, paying close to 2x (or more) FLOPs, achieving what previously required a 2-3T model.
What it saves is memory and weight-loading bandwidth, not compute.
This matters enormously, because it determines where the architecture has an advantage:
- Memory-constrained, compute-abundant settings (consumer deployment, edge inference, multi-instance concurrency limited by memory): looping wins clearly, because weights are stored once.
- Compute-constrained, memory-abundant settings (large-scale training, high-throughput serving): no advantage, possibly worse, since it has fewer parameters for the same FLOPs.
Zhipu choosing this path is consistent with its situation: it runs large-scale inference on domestic chips (officially claiming 100,000-card-scale domestic deployment), and domestic chips typically have weaker per-card memory and bandwidth than international flagships, but card count can be stacked. Under that constraint, “trade more card-time for less memory” is a rational engineering choice.
Part Two: Why 28 Layers
This is an easily overlooked but critical detail: the loop happens in 28 layers, not across all of the 750B model’s layers.
Why?
Reason one: protecting pretrained knowledge. If all layers shared weights, the entire model would compress into one iterated map, and the layered features learned in pretraining (lexical in shallow layers, syntactic in middle, semantic in deep) would be forcibly unified. That destroys a lot of accumulated knowledge.
The official statement confirms this: “We retrofitted a previously trained 750B standard base, which reduces compute overhead and avoids wasting the massive knowledge accumulated during pretraining.”
Reason two: compute budget. Looping all layers doubles FLOPs outright — unacceptable for inference cost. Looping only 28 layers (assuming 60-80 total) adds roughly 28/70 ≈ 40%. That is a tolerable increment.
Reason three (inference): placement matters. Putting the loop in the middle layers means iterating at a point where “features are abstract but not yet output” — which matches the intuition of “iterative refinement.” In shallow layers you iterate low-level features (little gain); in deep layers you iterate near-output representations (prone to overfitting to a pattern).
# -*- coding: utf-8 -*-
"""Where to loop and how much: FLOPs overhead vs benefit"""
from dataclasses import dataclass
@dataclass
class Plan:
name: str
total_layers: int
loop_layers: int
loops: int
def flops_overhead(p: Plan) -> float:
base = p.total_layers
extra = p.loop_layers * (p.loops - 1)
return extra / base
plans = [
Plan("28L x2 rounds", 70, 28, 2),
Plan("28L x3 rounds", 70, 28, 3),
Plan("56L x2 rounds", 70, 56, 2),
Plan("all 70L x2", 70, 70, 2),
]
print(f"{'plan':<18}{'FLOPs add':<12}{'param save':<12}{'knowledge risk'}")
for p in plans:
oh = flops_overhead(p)
saved = 1 - 1 / p.loops if p.loop_layers == p.total_layers else p.loop_layers / p.total_layers
risk = "high" if p.loop_layers / p.total_layers > 0.7 else ("med" if p.loop_layers / p.total_layers > 0.4 else "low")
print(f"{p.name:<18}{oh:<12.0%}{saved:<12.0%}{risk}")
print()
print("28L x2: FLOPs +40%, params saved 40% (within the loop segment), knowledge risk low")
print("This is the intersection of three constraints: compute budget / memory saving / knowledge retention")
This arithmetic explains why “28 layers x 2 rounds” rather than some other combination. A 40% FLOPs increase is a magnitude where you can feel the depth benefit without losing control of inference cost.
Incidentally, it also explains why Zhipu says “a significantly larger base model will meet you soon” — JPMorgan research cites a roughly 3-trillion-parameter flagship in Q4, about 4x the current base. Once parameter scale rises, the marginal value of looping declines, because a 3T model already has enough depth. So GLM-5.4’s looping is more of a “compensate for limited parameters with computational depth” phase, not an endpoint architecture.
Part Three: The Core Controlled Experiment — Moving Thinking From Token Space Into Activation Space
This is GLM-5.4’s most theoretically valuable part and the most easily overlooked.
The official controlled experiment: a 30B model at fixed parameter count, with looping enabled, moves AIME25 from 19.17% to 30.42% and GPQA-Diamond from 47.58% to 56.26%, while average output length on benchmarks drops 10-14%.
Those three numbers must be read together, because jointly they point at one conclusion.
First two: scores jump. AIME25 gains 11.25 points (58.7% relative), GPQA-Diamond gains 8.68.
Third: output length drops 10-14%.
Scores up, output shorter. Under the traditional CoT frame this is impossible — gaining score normally requires generating more thinking tokens.
This is the looping architecture’s core claim: move “thinking more” from token space into activation space.
Compare the two kinds of “thinking more”:
CoT-style: the model generates thinking tokens, each passing through a full forward pass. More thinking means more tokens, compute grows linearly. And intermediate results must be discretized into tokens — a lossy process. A continuous reasoning state compressed into one word from a finite vocabulary necessarily loses information.
Loop-style: the model does several forward passes at the same position, iterating the hidden state in continuous space. More thinking means more rounds, compute grows linearly. But intermediate results stay in continuous hidden space, with no discretization loss.
# -*- coding: utf-8 -*-
"""CoT-style vs loop-style thinking: information loss and compute efficiency"""
import math
def cot_cost(thought_tokens: int, layers: int) -> int:
return thought_tokens * layers
def loop_cost(loops: int, layers_looped: int, layers_total: int) -> int:
return layers_total + (loops - 1) * layers_looped
def info_loss_cot(vocab: int, state_dim: int) -> float:
bits_per_token = math.log2(vocab)
return bits_per_token / state_dim
print("Scenario: need N extra units of thinking compute")
print()
print(f"{'method':<18}{'compute(layer-fwd)':<20}{'intermediate form':<18}{'info loss'}")
print(f"{'CoT(20 tokens)':<18}{cot_cost(20, 70):<20}{'discrete tokens':<18}{info_loss_cot(150000, 6144):.6f}")
print(f"{'loop(2x,28L)':<18}{loop_cost(2, 28, 70):<20}{'continuous state':<18}{'0 (no discretization)'}")
print()
print("CoT reruns all layers per extra thinking token;")
print("looping reruns only the loop segment, and the state never leaves continuous space.")
print()
print("This explains the official data: score up + output length down 10-14%")
print("-- iteration that used to require generated tokens now happens in hidden space.")
That arithmetic yields two conclusions:
First, looping is more compute-efficient. To get “a bit more thinking,” CoT reruns all layers per thinking token; looping reruns only 28. The FLOPs increment for the same depth gain is far smaller.
Second, looping has no discretization loss. This is the deeper advantage. CoT’s intermediate state must be a token from a vocabulary of ~150,000, each carrying about 17 bits. A hidden state is a 6144-dimensional continuous vector carrying orders of magnitude more. So each loop round has higher information density than one CoT token.
Those two advantages stack into “score up + output shorter.”
But a discount is required: the official data is a 30B controlled comparison, not 750B. Looping’s benefit may be larger on small models (which lack depth) and diluted on large ones (which already have depth). Zhipu has not published a 750B loop-on/off comparison. That is the most critical missing data.
Part Four: Cost One — The Boundaries of “One More Round Costs Almost No Memory”
The official claim: “with gated updates, sliding-window KV cache, and sparse index reuse, one more round costs almost no extra memory.”
That is correct, but you need to understand why, and where it holds.
Why no extra memory? Because looping shares weights. Two rounds use the same 28 layers; no second copy. Intermediate hidden states are temporary and released after the forward pass. So weight memory is unchanged.
What about KV cache? This is the crux. A standard Transformer’s KV cache stores K and V per layer. If two loop rounds need two copies, memory doubles.
Zhipu’s answer is sliding-window KV cache — keep only the KVs within a recent window. That bounds KV total regardless of loop count.
But sliding windows cost something: long-context accuracy degrades. KVs outside the window are dropped, so the model cannot see far information. That is why sparse index reuse is also needed — some sparse retrieval mechanism to bring back distant important KVs.
# -*- coding: utf-8 -*-
"""Sliding-window KV + sparse index: memory saving vs long-context accuracy"""
def kv_memory_mb(seq_len: int, layers: int, d_model: int,
bytes_per_elem: int = 2, window: int | None = None) -> float:
effective_len = min(seq_len, window) if window else seq_len
return 2 * layers * d_model * effective_len * bytes_per_elem / (1024 ** 2)
print("1M context, 70 layers, d_model=6144, FP16")
seq = 1_000_000
print(f"{'strategy':<24}{'KV memory':<16}{'long-context visibility'}")
print(f"{'full KV':<24}{kv_memory_mb(seq, 70, 6144):>10.0f} MB{'full'}")
for w in (32768, 131072, 262144):
m = kv_memory_mb(seq, 70, 6144, window=w)
print(f"{'window '+str(w//1024)+'K':<24}{m:>10.0f} MB"
f"only last {w//1024}K, far parts via sparse index")
print()
print("For comparison: 2 loop rounds without shared KV would double this")
print(f" 2 rounds, unshared KV: {kv_memory_mb(seq, 70, 6144)*2:>10.0f} MB")
print()
print("Conclusion: 'one more round costs no extra memory' holds,")
print(" at the price of long-context visibility depending on sparse index recall.")
That arithmetic shows: full KV at 1M context is 840 GB — completely infeasible. Sliding to 32K gives 27 GB — feasible. So the sliding window is not an optimization; it is a requirement.
The cost is explicit: beyond 32K, the model can only reach information through a sparse index, and the index is lossy. The official spec claims 1M context, but actual quality at 1M depends on sparse index recall — a number not published.
This is an important boundary: “supports 1M context” and “performs well at 1M context” are two different things. The former is a capability claim; the latter a quality claim.
Part Five: Cost Two — Fixed Two Rounds Means Simple Tasks Also Overthink
One honest line in the official post, picked up separately by iHeima: “GLM-5.4 easily enters a long-thinking mode; on difficult tasks nearly all steps enable reasoning, making completion time long, even though token output speed is not slow.”
That reveals a bigger problem than it appears to.
A fixed two rounds means every task runs two rounds regardless of difficulty. A “what’s the weather” query and a “prove this inequality” task pay the same loop compute.
That is economically irrational. Ideally loop count should adapt: one round for simple, two for medium, three or four for hard. That is adaptive computation.
# -*- coding: utf-8 -*-
"""Fixed rounds vs adaptive rounds: how much compute is wasted"""
from dataclasses import dataclass
@dataclass
class TaskMix:
name: str
share: float
needed_loops: int
mix = [
TaskMix("simple (lookup/format)", 0.50, 1),
TaskMix("medium (edit/summarize)", 0.35, 2),
TaskMix("hard (long reasoning)", 0.15, 4),
]
FIXED = 2
fixed_cost = FIXED * sum(t.share for t in mix)
adaptive_cost = sum(t.share * t.needed_loops for t in mix)
print(f"{'task type':<28}{'share':<8}{'ideal':<8}{'waste under fixed=2'}")
for t in mix:
waste = (FIXED - t.needed_loops) * t.share
print(f"{t.name:<28}{t.share:<8.0%}{t.needed_loops:<8}{waste:+.2f} round-equiv")
print()
print(f"fixed 2 rounds total : {fixed_cost:.2f} round-equiv")
print(f"ideal adaptive total : {adaptive_cost:.2f} round-equiv")
print(f"waste : {(fixed_cost/adaptive_cost - 1):.0%}")
print()
print("Note hard tasks are UNDER-thought (-0.30) while simple ones are OVER-thought (+0.50).")
print("Fixed rounds are not a middle ground: wrong at both ends.")
The conclusion is counterintuitive: fixed two rounds is not a compromise — it is wrong at both ends.
- For 50% simple tasks, the extra round is pure waste (+0.50 round-equivalents)
- For 15% hard tasks, two rounds is not enough (ideal 4), so they are under-thought (-0.30)
- Overall compute waste is about 20%, but more importantly, the performance ceiling on hard tasks is capped
Zhipu admits the model “easily enters a long-thinking mode; on difficult tasks nearly all steps enable reasoning” — which in effect means the model compensates for insufficient loop count with CoT. That is, on hard tasks it runs both two loop rounds and long CoT, and the two stack into long latency.
This explains why the official material flags this as “a weakness to watch” rather than a strength. The real solution is adaptive looping (deciding whether to iterate further based on task difficulty or intermediate confidence), but Zhipu has not stated whether GLM-5.4 implements it — and from “fixed two rounds,” most likely not.
Part Six: Retrofitting a Base — a Smart Engineering Decision and Its Costs
Zhipu is explicit: not trained from scratch, but “retrofitting a previously trained 750B standard base.”
The benefits are clear:
First, compute saved. Training a 750B model from scratch takes tens of thousands of card-months. Retrofitting only requires continued training of the loop portion.
Second, knowledge preserved. Language, world knowledge, and code accumulated in pretraining all survive. Training a looping model from scratch would require relearning all of it — and a looping architecture might learn it worse, given its expressiveness constraints.
Third, speed. GLM-5.3 shipped in August, GLM-5.4 in November — three months. From scratch is impossible.
But the costs are equally clear:
Cost one, inter-layer asymmetry. 28 layers share weights, the rest are independent. That means two different computational modes inside one model: looping and non-looping segments. The asymmetry may limit overall representational consistency. Ideally a native looping architecture would be designed as such from the start.
Cost two, the loop segment’s weights were trained under a non-looping objective. In base pretraining those 28 layers each worked independently, each receiving the previous layer’s output. Now sharing weights across two rounds demands the same parameters play different roles in different rounds. That requires additional training to adapt, and the degree of adaptation is unknown.
Cost three, you cannot verify how good a native looping architecture would be. Results from the retrofit route do not represent the theoretical ceiling of looping. A from-scratch looping model might be better or worse — that experiment was not run.
# -*- coding: utf-8 -*-
"""Retrofit vs from-scratch: cost and uncertainty trade-off"""
from dataclasses import dataclass
@dataclass
class Route:
name: str
pretrain_card_months: float
extra_train_months: float
knowledge_risk: str
ceiling_visibility: str
routes = [
Route("from-scratch loop", 3.0, 3.0, "high (relearn everything)", "visible (true ceiling)"),
Route("retrofit base", 0.0, 0.4, "low (knowledge kept)", "invisible (hybrid)"),
]
print(f"{'route':<20}{'pretrain(k card-mo)':<22}{'extra train':<14}{'knowledge risk':<28}{'ceiling'}")
for r in routes:
print(f"{r.name:<20}{r.pretrain_card_months:<22.1f}"
f"{r.extra_train_months:<14.1f}{r.knowledge_risk:<28}{r.ceiling_visibility}")
print()
print("Retrofit saves about 87% of compute (3.0+3.0 -> 0+0.4)")
print("Cost: you never learn the true ceiling of native looping.")
That comparison shows: retrofitting is the optimal way to get visible returns under limited compute, but it abandons an important scientific question — the ceiling of looping itself.
It also explains Zhipu’s “significantly larger base model next”: if a 3T base is trained, looping’s marginal value declines, and it may not be needed. Looping is a patch for constrained parameter scale, not an endpoint.
Part Seven: Relationship to the November 22 Piece, and Small Models vs Flagships
The November 22 article covered “three Loop Transformer releases in three days”: SenseNova Loop-9B, LoFT, and Inkling 2 Mini. Their common trait was small-scale experimentation — Inkling 2 Mini is 26B of weights computing 48 layers.
GLM-5.4 is the first to move looping to domestic flagship scale. That jump brings three changes:
Change one, looping goes from “all layers” to “some layers.” Small models can loop everything (26B running 48 layers) because their pretrained knowledge is small and the cost of disruption is low. A flagship cannot — 750B of knowledge is too expensive, so only 28 layers are touched.
Change two, looping goes from “architecture choice” to “architecture retrofit.” Small models were designed as looping from the start; the flagship was modified.
Change three, the constraint shifts from “expressiveness” to “cost.” Small-model looping is mainly to get sufficient depth under limited parameters; flagship looping buys extra depth within a compute budget, with a harder cost constraint.
Together these three mean: the scalability of looping architecture has not been validated. It works on small models, it works “after retrofit” on a flagship, but “how good a native looping architecture would be at flagship scale” is a blank.
Part Eight: Judgments and Boundaries
Three judgments:
First, the correct reading of “750B reaching 2-3T” is “trade 750B of memory for 2-3T results, at close to 2x FLOPs.” What it saves is weight-loading bandwidth and memory, not compute. In memory-constrained, compute-stackable settings (domestic chips at scale) that is the right choice; in compute-constrained settings there is no advantage. Only with this understood can you judge for whom the architecture is useful.
Second, looping’s real value is not “saving parameters” but “moving iteration into continuous hidden space.” The combination in the 30B experiment — scores up while output length drops 10-14% — is unreachable under traditional CoT. It proves that for the same “think a bit more,” iterating in continuous space is more information-efficient than generating in discrete token space. That insight extends beyond GLM-5.4: future reasoning-efficiency gains may come more from “thinking more in hidden space” than from “generating more thinking tokens.”
Third, fixed two rounds is this generation’s biggest design compromise and the most likely improvement point for the next. Zhipu itself admits the model “easily enters a long-thinking mode,” meaning it uses CoT to compensate. What should be done is adaptive looping (round count by difficulty or confidence), which would solve both “wasted on simple” and “insufficient on hard.” If GLM-5.5 adds adaptive looping while scaling parameters, that would be a substantive architectural advance.
What must be discounted or left pending verification:
- “2-3T intelligence level” is Zhipu’s own framing, with no stated benchmark or comparison set. A broad range claim, unverifiable.
- The most critical missing data: a 750B loop-on/off comparison. What was published is a 30B comparison (AIME25 19.17→30.42). Small models gaining more from looping is expected (they lack depth); the gain at large scale may be significantly diluted. Without this, the contribution of “28 layers x 2 rounds” at 750B cannot be assessed.
- The 200 real-world coding scenarios have no published scores. Official wording is only “performs well” — a qualitative statement.
- AICodeKing’s private evaluation (GLM-5.4 33.2 vs GPT-6.2 Astra 33.6 vs Opus 5.5 34.7) is third-party with undisclosed methodology. The spread is within 5%, which is inside the noise band of a private eval; do not over-read it.
- KingBench 4 “first among open models” deserves a caveat: GLM-5.4’s weights are not open yet. Zhipu says it “plans to open-source responsibly” with no timeline. Until weights ship, the “open model” positioning is premature.
- TokenRa’s pricing (input $0.09/M, output $0.33/M) is not official. Zhipu has not published pricing.
- “Up to 200 tokens/s” is peak, off-peak. Peak hours run 70-80 tokens/s — a 2.5x difference. Latency-sensitive applications must use the latter.
- Actual quality at 1M context is unpublished. With sliding-window KV plus sparse index, long-context recall quality is the key metric, and the official material gives only window size and capability claims (images/video/text/files), not long-context benchmark scores.
- Looping’s scalability is unvalidated. Small-model full looping, flagship partial looping, native flagship looping — none of the three is complete, so “is looping the next mainstream architecture” cannot be answered yet.
- This article’s FLOPs increment estimate (+40%) assumes roughly 70 total layers. Actual layer count is undisclosed; treat it as an order-of-magnitude reference.
One last observation. The timing of GLM-5.4 is interesting: GLM-5.3 in August was “parameters unchanged, only more post-training,” GLM-5.4 in November is “change the architecture,” and December is planned as “4x parameters to 3T.”
Three months, three steps, three completely different directions: post-training scaling → architecture innovation → parameter expansion.
That order is not arbitrary. It reflects a reality: under compute constraints, there is a priority order for capability gains — first squeeze existing parameters (post-training), then improve parameter efficiency via architecture (looping), and only then expand parameters (3T).
With unlimited compute the order would reverse: expand first, optimize later. So GLM’s path is the optimal path under compute constraints, not the optimal path in technical terms.
That distinction matters: it implies that if the compute constraint lifts, GLM may return to a “parameters first” path, and looping architecture is merely a product of this phase.