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

Loop Transformer Explained: 28-Layer Loops and a New Approach to Reasoning

Loop Transformer Explained: 28-Layer Loops and a New Approach to Reasoning

Loop Transformer makes shared-parameter layers execute repeatedly to increase computational depth without adding parameters.

The article analyzes the fourth path to improving large models—Loop Transformer, which avoids adding network layers and instead makes a middle group of layers participate in computation repeatedly. GLM-5.4's 78 layers perform 106 layer computations after looping the middle 28 layers, and Inkling 2 Mini's 24 layers produce 48 layer computations by looping the middle 12 layers three times. Because the second round receives updated internal state, combined with gating, looping is not mechanical repetition. Multi-hop lookup experiments show benefits continue up to 10 loops, but on most tasks gains diminish after three. The article distinguishes Loop Transformer from Chain of Thought and notes that looping increases computational opportunities rather than factual knowledge, with extra compute and latency costs, and a future direction of dynamically allocating loop counts.

Large model capability gains are usually attributed to three paths: more parameters, more data, and more inference tokens. But two recent models—GLM-5.4 and Thinking Machines' Inkling 2 Mini—demonstrate a fourth path: instead of adding new layers, run the existing network layers multiple times. This technique is called Loop Transformer, and this article analyzes it from three angles: architecture, benefits, and costs.

What Loop Transformer Actually Changes

In a traditional Transformer, each layer has independent parameters. A 78-layer model consists of 78 distinct sets of network layers executed in sequence, with information processed layer by layer like an assembly line, ultimately predicting the next token. To increase depth, you must add layers and parameters.

Loop Transformer takes a different approach: rather than adding new layers, it makes a certain group of middle layers participate in computation repeatedly. According to a breakdown by a Bilibili creator, GLM-5.4 has 78 distinct Transformer layers, divided into the first 26 layers, the middle 28 layers, and the final 24 layers. The normal flow is 26→28→24, but after the middle 28 layers finish processing, GLM-5.4 does not proceed directly to the final 24 layers. Instead, it feeds the output of those 28 layers back into themselves for another pass. The actual execution path thus becomes 26→28→28→24, totaling 106 layer computations, but with only 78 layers' worth of parameters.

After the middle 28 layers finish processing

The second run reuses the same set of parameters without duplicating new layers. This is the core of Loop Transformer: sharing parameters while increasing computational depth.

Traditional Transformer layers have independent parameters, so increasing depth necessarily increases parameter count. Weight tying is not a new concept—early language models reused weights between input embeddings and output projections, and ALBERT compressed model size through cross-layer parameter sharing. Loop Transformer pushes this idea to its limit: not only sharing weights but also making the same group of layers execute multiple times within a single forward pass, thereby increasing the depth of the computation graph without changing the parameter count. This design borrows the iterative idea from recurrent neural networks (RNNs) but retains the Transformer's parallel attention structure, so training can still use teacher forcing and gradient checkpointing to control memory overhead.

Why Repeated Computation Isn't Just Spinning in Place

The key question is: does running the same parameters twice simply repeat the same thing? The answer is no. On the second computation, the input the model receives has already changed—during the first loop, the middle 28 layers received the output of the first 26 layers; after one round of processing, the model's internal state has been updated, and the second round receives the updated information.

You can think of it like reading a complex article: the first pass grasps the overall structure, and the second pass uses that understanding to verify and correct details. According to official descriptions, GLM-5.4 also designed a gating mechanism that controls how much new information from each round of computation is written back into the internal state. The first round makes smaller changes, mainly to establish context; the second round uses the existing state for further processing.

So looped computation doesn't make the model mechanically repeat the same action

Thinking Machines' Inkling 2 Mini adopts a similar approach: of its 24 layers, the first 6 execute normally, the middle 12 run three times, and the final 6 execute normally, so 24 distinct layers produce 48 layer computations in practice.

The gating mechanism plays a role similar to "residual scaling" in looped architectures. Not all new information generated in each loop iteration is written into the hidden state; a learnable scalar or vector gate determines the write-back ratio. This helps mitigate gradient explosion or vanishing in deep loops and lets the model autonomously adjust the magnitude of each round's update. From an optimization perspective, the unrolled computation graph is equivalent to a deep network with shared weights, and gradients propagate back along the loop path during backpropagation. The gate parameters can therefore learn a policy for "when to change more and when to change less," preventing multiple rounds of computation from degenerating into an identity mapping.

Multi-Hop Lookup Experiment: The Practical Benefit of Looping

Thinking Machines designed an experiment called NHOP Lookup specifically to test the model's ability to look up information in sequence. For example, three tables respectively record which order a work order corresponds to, which warehouse ships the order, and which city the warehouse is located in. To find the shipping city for work order A17, the model must chain together multiple pieces of information; the answer may be just two words, but the information chain is long.

The researchers trained the model on large amounts of synthetic data to perform such tasks and varied the number of loops to observe the effect. Results showed that as the number of loops increased, the model's ability to complete multi-hop lookup tasks improved, with gains continuing up to 10 loops. However, the officially released Inkling 2 Mini uses a fixed three loops; the variable-loop version was not officially released.

It really can bring benefits

This suggests that in tasks requiring chained information, increasing the number of internal computation rounds can indeed yield benefits. But different tasks have different demands on computational depth, and simple tasks may not need multiple loops.

Multi-hop lookup is a classic task for evaluating a model's compositional generalization ability, requiring the model to chain multiple independent facts into a reasoning chain. The core difficulty of such tasks lies in maintaining and passing intermediate results, not in fact memorization itself. Looped computation gives the model the opportunity to repeatedly refine intermediate representations in its hidden state, so the gains are significant. Note, however, that NHOP Lookup uses synthetic data for training—the model has never seen real-world knowledge. The experiment measures the upper bound of reasoning depth at the architectural level, not factual recall ability. This also explains why gains can continue up to ten loops on specific tasks, while general tasks often saturate after three.

Difference from Chain of Thought: Internal Computation vs. External Generation

Loop Transformer and Chain of Thought (CoT) address problems at different levels. Chain of Thought lets the model generate a passage of reasoning text before answering, externalizing intermediate steps; Loop Transformer, before generating the next token, lets the network layers run several more rounds in the hidden state.

One expands reasoning by generating more text, the other increases internal computational depth by repeatedly executing network layers. The two are not in conflict and can be combined. This also means that when evaluating reasoning models, besides looking at how many reasoning tokens they generate, you can also consider how much computation they perform internally before each token.

Costs and Boundaries: Looping Isn't Free

Parameter sharing does bring advantages: you don't need separate parameters for each round of computation. But fewer parameters does not mean lower computational cost—each additional round of network layers consumes extra compute, and inference latency may increase accordingly.

More loops isn't always better either. Thinking Machines' experiments found that on many tasks, performance gains begin to diminish after more than three loops, and only specific tasks like multi-hop lookup still benefit when increased to ten loops.

On many tasks

Moreover, when the same group of network layers runs repeatedly, ensuring stable information updates each round and optimizing the extra computation and caching overhead are problems that must be solved in practical applications.

More importantly: looped computation increases opportunities for processing information and reasoning; it does not conjure new factual knowledge out of thin air. Things the model didn't originally know won't become known just by running more times. Loop Transformer provides a new computational path, not a universal solution.

Inference latency and compute overhead are the core constraints on deploying Loop Transformer. Each additional loop linearly increases the FLOPs of the forward pass, and during autoregressive generation this process repeats for every token, amplifying latency noticeably. Engineering practice often mitigates this with KV cache reuse, loop-layer quantization, or early exit. In addition, a fixed number of loops means the computational budget cannot adapt to input difficulty—simple samples still cost the same compute—contrasting with the research direction of adaptive computation. The benefit boundary of looped architectures essentially depends on how much a task demands "internal serial computation depth," not on parameter capacity.

From Fixed Loops to Dynamic Allocation

GLM-5.4's 78 layers and 106 computations, and Inkling 2 Mini's 24 layers and 48 computations, show that this architecture has entered real models. More noteworthy is the future direction: if a model can dynamically decide the number of loops based on task difficulty—fewer rounds for simple problems, more for complex ones—the allocation of computational resources will become more flexible. This may be the most promising evolution direction for Loop Transformer.

One-line Summary

Loop Transformer makes layers with shared parameters execute repeatedly, increasing computational depth without adding parameters.

Paragraph Summary

The article analyzes the fourth path to improving large models—Loop Transformer, which does not add network layers but instead makes a middle group of layers participate in computation repeatedly. GLM-5.4's 78 layers actually perform 106 layer computations after looping the middle 28 layers, and Inkling 2 Mini's 24 layers produce 48 layer computations by looping the middle 12 layers three times. Because the second round receives updated internal state, combined with a gating mechanism, the loop is not mechanical repetition. Multi-hop lookup experiments show loop benefits can continue up to 10 iterations, but on most tasks gains diminish after three. The article also distinguishes Loop Transformer from Chain of Thought: the former increases internal computational depth, the latter externalizes reasoning steps. Finally, it notes that looping increases computational opportunities rather than factual knowledge, and brings extra compute and latency costs; the future direction is dynamic allocation of loop counts.

#Loop Transformer#GLM-5.4#Inkling 2 Mini#Chain of Thought#multi-hop lookup#parameter sharing#adaptive computation
Share:

Related articles