[KongchangAI]
· 3 min read· 1,505 words

GLM-5.4 Loop Transformer: 75B Parameters Deliver Trillion-Scale Reasoning

GLM-5.4 Loop Transformer: 75B Parameters Deliver Trillion-Scale Reasoning

GLM-5.4 uses a Loop Transformer to lift a 750B model to 2–3T-scale reasoning without adding parameters.

GLM-5.4 converts layers 27–54 of a 750-billion-parameter pretrained base into a loop structure, achieving reasoning performance close to 2–3 trillion parameter models without new parameters. Key innovations include gated progressive updates to prevent activation explosion, cross-loop KV sharing with a 128-token sliding window to minimize extra-loop memory cost, and sparse attention index reuse to save compute. Adding only ~10% training compute yields significant gains on AIME 25, GPQA Diamond, and other benchmarks, while average output length drops 10–14%, showing reasoning shifts from explicit text into implicit loop depth. The architecture also supports generalized coding tasks like music videos, six-axis robotic arm modeling, and complex games.

As the parameter scaling race gradually hits its ceiling, a long-overlooked technical path is regaining attention. According to the YouTube channel AI Paper Slop's interpretation of the latest technical documentation, GLM-5.4 transforms a 750-billion-parameter pretrained base into a Loop Transformer, achieving reasoning performance close to that of 2–3 trillion parameter models without adding any new parameters. The core idea: shift the burden of reasoning from explicit output tokens into the implicit depth of the loop structure, letting the model "think first, speak later."

Training strategy comparison diagram

How the Loop Architecture Works: Repeating Only the Middle 28 Layers

The Loop Transformer is not an entirely new concept. According to the video analysis, the idea of weight-shared depth looping dates back at least to the 2018 Universal Transformer. But early loop models trained from scratch often lagged behind standard Transformers at equal compute. GLM-5.4's key difference: it was not trained from scratch but adapted from a 750-billion-parameter pretrained model through continued training.

Specifically, layers 27 through 54—28 layers in total—are isolated so that data loops through this block twice. The video uses a vivid analogy: faced with a thick technical manual, you can buy the full 2,000-page edition and read it cover to cover, or you can take a thinner manual and read the hardest chapters twice. The latter avoids the deployment overhead of building a trillion-parameter behemoth while preserving the basic language capabilities already present in the pretrained base. Continued training only needs to teach the model how to use looping for higher-order reasoning, rather than learning grammar and semantics from scratch.

Universal Transformer is an architectural variant proposed by Google in 2018. Its core idea is weight sharing along the depth dimension: the same set of Transformer layers is applied repeatedly, with each iteration's input coming from the previous output, using positional encodings and timestep embeddings to distinguish rounds. Theoretically, this looping gives the model Turing-machine-like computational capability, able to handle reasoning chains of arbitrary depth. In practice, however, training loop models from scratch faces optimization difficulties: gradients propagated back through multiple loops tend to be unstable, and loop models often require more training steps to converge at equal compute, causing early experiments to lag behind parameter-stacked standard Transformers. GLM-5.4's breakthrough lies in bypassing the from-scratch training problem—leveraging the stable representations already present in the pretrained base, it only needs continued training to adapt to the loop structure, thereby unlocking the potential of the loop architecture.

Activation Explosion and Gated Progressive Updates

The direct mathematical problem introduced by loop layers is activation inflation. The video points out that if hidden states are directly overwritten across multiple loop iterations, the activation norm grows sharply with the number of iterations, causing the model's final layers to receive representations far outside the training distribution—effectively going "deaf."

GLM-5.4's solution is gated progressive updates: each token's each iteration introduces an independent gate that writes candidate updates into the residual stream proportionally, like a valve. The first loop uses a smaller gate value, conservatively building global context and stabilizing numerical scale—like a painter laying down a very light pencil sketch. The second round opens the gate on the stable sketch for full refinement. The gate also adjusts dynamically based on token difficulty—harder tokens receive more aggressive updates in the first round, because complex predictions benefit more from iterative refinement.

The residual stream is the core information channel running through all layers in a Transformer. Each layer's output is added back into the residual stream, allowing information to pass across layers. In a Loop Transformer, the same set of layers is applied multiple times; if every loop writes updates directly into the residual stream, the activation norm grows exponentially with loop count, causing numerical instability and representation collapse. Gated progressive updates control the update magnitude by multiplying each write by a learnable gate coefficient (typically normalized to 0–1 via sigmoid), similar to the gating mechanism in LSTM. This design allows the model to dynamically regulate the amount of information injected per loop, avoiding activation explosion while preserving the advantages of the residual stream.

Hybrid KV Cache: Making Extra Loops Nearly Memory-Free

Hardware bottlenecks are equally thorny. Conventionally, looping twice means doubling KV cache usage, which is nearly fatal at the 750-billion-parameter scale. The video explains that GLM-5.4 adopts a hybrid cache scheme combining cross-loop KV sharing with an independent local sliding window: the second loop directly reuses the sparse KV selected in the first round, preserving global memory, while maintaining a sliding window strictly limited to 128 tokens that holds the immediate context newly generated in the second round.

Complementing this is the reuse of sparse attention indices. The base model already uses sparse attention, and the second loop directly reuses the attention indices generated by the first-round indexer, eliminating recomputation overhead. The video claims experiments show this reuse performs almost identically to recomputing indices from scratch, with the extra loop's cache cost amounting to only a small sliding window, keeping deployment costs manageable at million-token context lengths. System-level kernel fusion further reduces intermediate GPU memory reads and writes; according to the video, inference speed reaches 200 tokens per second during off-peak hours and still 70–80 tokens per second under peak load.

The KV cache (Key-Value Cache) is a key optimization technique in autoregressive inference. When generating each new token, the model needs to perform attention computation with the Key and Value vectors of all previous tokens. To avoid recomputation, these vectors are cached. However, cache size is proportional to sequence length and consumes substantial memory in long-context scenarios. For a Loop Transformer, maintaining an independent KV cache for each loop would double memory overhead. GLM-5.4's hybrid cache scheme shares Key/Value across loops and maintains only a small sliding window for newly generated local context, greatly reducing the memory footprint of extra loops. Sliding window attention is a common sparse attention pattern that focuses only on the most recent fixed number of tokens, controlling computation while maintaining local coherence.

Benchmarks: Shorter Output, Higher Scores

After 200K long-context SFT with thinking mode enabled, the loop version adds only about 10% training compute yet delivers significant benchmark gains. According to the data cited in the video: AIME 25 up 11.3 points, GPQA Diamond up 8.7, AALCR up 7.3, MMLU Pro up 3.4, IF Bench up 3.3. The longer the reasoning chain, the more pronounced the benefit.

A counterintuitive phenomenon: average output length on most benchmarks actually dropped by 10% to 14%. At a time when models generally boost scores by generating ultra-long chains of thought, producing fewer tokens yet scoring higher shows that reasoning has not disappeared—it has shifted from explicit text into the implicit depth of the 28-layer loop. The model no longer "speaks" long stretches of reasoning but completes them silently internally.

Generalized Coding: From Music Videos to Six-Axis Robotic Arms

The long-chain reasoning capability enabled by loop depth directly supports what the paper calls "generalized coding"—applying coding and vision capabilities to scenarios requiring strict multi-step causal chains and global logical consistency, such as large-scale software engineering, 3D modeling, and physical control.

Multi-step causal chain diagram

Cases cited in the video include: generating a complete music video "Hello World" with self-narration, synchronizing audio, visual logic, and narrative; building a six-axis robotic arm with engineering-grade CAD modeling and FreeCAD, where joint math code must be precisely correct; writing a complete game with character movement, physics engine, maps, and combat systems; and generating an interactive 3D birdwatching scene from scratch using pure mathematical geometry and custom GLSL shaders. The video emphasizes that GLSL shaders are pure mathematical descriptions telling the GPU how to compute light and shadow, extremely difficult to fake through hallucination.

GLSL (OpenGL Shading Language) is a programming language for writing GPU shaders, widely used in real-time graphics rendering. Shader code runs directly on the graphics card, computing each pixel's color, lighting, and geometric transformations. Due to the GPU's parallel architecture and strict mathematical requirements, GLSL code must precisely describe physical models of light and shadow; any logic error produces visual artifacts. Thus, generating an interactive 3D scene from scratch with pure mathematical geometry and custom GLSL shaders demands deep understanding of spatial relationships, vector operations, and the rendering pipeline—far beyond simple pattern matching, making it a touchstone for testing a model's long-chain reasoning and precise code generation capabilities.

Boundaries and Open Questions

The video also honestly presents the limitations acknowledged in the paper. Most prominent is the model's tendency to fall into overly long "marathon thinking loops"—extended reflection does steadily improve accuracy, but runaway loops remain a real flaw. Additionally, how to achieve adaptive compute (letting harder tokens dynamically receive more iterations), and how returns change when loop count scales with model size, remain unanswered.

The significance of this work lies in proving that computational depth and parameter scale can advance in parallel. For years the industry assumed reasoning meant more text on screen, but GLM-5.4 suggests that a considerable portion of complex reasoning may properly belong in the silent depths of the architecture.

#GLM-5.4#Loop Transformer#circular Transformer#gated progressive updates#KV cache sharing#generalized coding#long-chain reasoning
Share:

Related articles