Loop Transformer Explained: How Repeating 28 Layers Twice Works
This article breaks down the Loop Transformer approach, where a shared set of 28 layers runs twice to increase effective compute depth without duplicating parameters. It explains what is actually looped, the three engineering changes that make the second pass practical, how internal looping differs from chain-of-thought tokens, and what to watch when evaluating deployment costs.
Why “Effective Compute Depth” Became a Separate Discussion
In a conventional stacked Transformer, capability tends to scale with the number of layers and the parameter count: more layers mean more room for complex nonlinear transformations. But this path has a high marginal cost. Every additional layer adds a new set of weights, and memory and bandwidth pressure rise during both training and inference.
The Loop Transformer offers a different approach: a group of layers that share weights is executed repeatedly, with the hidden state from the previous round feeding into the next one for further processing. Parameters are not duplicated, but the computation is unrolled further, which decouples effective compute depth from parameter count. After pretraining was complete, a large model base was further trained to introduce a looping structure, running 28 of its layers for two rounds. This brought the idea into validation at a larger model scale for the first time.
One point needs to be stated up front: parameter reuse does not mean computation is free, nor does it guarantee that every task runs faster. To judge whether it is worth adopting, you have to look at three things separately: model parameters, internal computation, and chain-of-thought tokens.
What Exactly Is Being Looped
The object being looped is a group of computation layers inside the model, not the input text and not an answer that has already been generated. The hidden state produced in the first round becomes the input to the second round, while the weights remain the same set.
A useful analogy is a group of analysts repeatedly revising the same working draft: the people are not duplicated, but the draft keeps getting updated. This analogy only illustrates parameter reuse; what is actually passed along is a high-dimensional numerical representation, not a piece of written text.
Conceptual illustration (not a runnable implementation):
Input↓Pre-processing (embedding, etc.)↓Initial hidden state h0↓┌─────────────────────────────┐│ Shared loop block (same weights) ││ round 1: h0 → h1 ││ round 2: h1 → h2 │└─────────────────────────────┘↓Post-processing (normalization / output projection)↓Predict the next token
This rules out two common misunderstandings: it does not run the same input several times unchanged, and it does not resubmit the conclusion of the first pass to a chat interface and ask again. Weights are shared across rounds, but the hidden state keeps changing.
What Running 28 Layers Twice Means
According to the official technical description, the base model starts from a model that has completed pretraining and is further trained to introduce a looping structure, so that 28 layers execute two rounds, without duplicating a comparable set of layer weights for the second round.
For this segment alone, the execution count can be understood as 28 × 2 = 56 layer computations. This number describes the computational unrolling of that segment; it is neither the total number of layers in the model nor a doubling of parameters. The network also contains other layers, gating modules, and cache designs.
A naive implementation creates two practical problems: repeated writes cause the hidden state scale to inflate, and cache usage doubles. The three supporting changes given in the official description target exactly these two issues:
- Gated progressive updates: control the proportion of each round’s candidate changes that are written back into the hidden state, suppressing excessive growth in representation scale and letting the two rounds take on different roles rather than repeating the same work.
- Global KV shared across rounds, with independent local sliding windows retained: the second round reuses the sparse KV from the first round while keeping new information from its own window, holding the extra cache footprint within a manageable range.
- Reuse of sparse attention indices: the second round follows the indices selected in the first round, eliminating the cost of repeated retrieval.
This also explains why simply wrapping an ordinary model in a for loop does not produce the same result. The gains come from trained division of labor between rounds and the engineering support around them, not from repeated calls at the syntax level.
How It Differs from Chain of Thought: Internal Compute Is Not Output Tokens
Looping happens inside the forward pass and produces no visible text; chain-of-thought tokens are intermediate steps written out explicitly, and they consume context length and decoding time. The two can be combined but cannot replace each other: the former increases the compute per forward pass, while the latter increases sequence length.
In engineering terms, the latency growth from looping shows up in the time and peak memory of a single forward pass, whereas chain of thought shows up in token count and context budget. When planning capacity, the two are measured with completely different metrics.
Practical Recommendations
- Start with a small-sample controlled evaluation to confirm the gains cover the extra compute, and avoid assuming that deeper is automatically better.
- Pay attention to cache and bandwidth: sharing KV across rounds and reusing indices are the key levers for controlling cost.
- Monitor the numerical distribution of hidden states; an abnormal gated update ratio often appears before quality degrades.
- On the deployment side, combine container platforms for elastic scaling, and use logging services and monitoring alerts to track per-round latency and cache hit rates, turning loop overhead into observable metrics.
In summary, the value of the Loop Transformer lies in trading parameter reuse for effective compute depth, while its cost and stability depend on the training strategy and systems engineering around it. Understanding that what loops is the hidden state, what is shared is the weights, and what increases is internal computation is what allows a rational architecture decision.
