
Depth and size are two different things
In an ordinary transformer, each token is represented by a vector, the residual stream. A layer reads this vector (and, through attention, the vectors of the other tokens), computes an update and adds it to the stream; the next layer reads the result and adds its own. A 40-layer model applies 40 updates in a row (80 if you count the attention and MLP blocks separately).
Two quantities are hiding here, and in an ordinary transformer they are tied together:
- size: how many parameters the model stores;
- depth: how many sequential steps of computation each token goes through.
Each new layer adds one step and one set of weights. If you want a deeper model, you have to store a bigger one.
A looped transformer unties the two: you take a block of layers and apply it several times, feeding its output back into its input. Three passes through a 12-layer block give 36 steps of computation for the price of 12 layers of weights.
In practice, you don't loop the whole network. There are three parts:
- the prelude: a few layers that run once and turn tokens into the model's internal representation;
- the core: the block that gets repeated;
- the coda: a few final layers, also run once, that turn that representation into a prediction for the next token.
The intuition, according to Thinking Machines, is that the first and last layers translate between tokens and internal concepts, while the middle layers do the more abstract work. Translation only needs to happen once; the abstract work might benefit from more rounds.
Why now
Reusing layers is not new. The Universal Transformer (2018) already applied the same layer over and over; ALBERT (2019) shared weights across all its layers to make BERT smaller; theory papers then showed that a looped transformer can emulate a programmable computer, and that a few layers looped many times can match much deeper models on reasoning tasks. In 2025, Huginn introduced the prelude/core/coda vocabulary, and ByteDance's Ouro models pushed looped pretraining to several trillion tokens.
So why this sudden wave? The author suggests two possible reasons:
- Reasoning needs steps, not storage. Labs want models that reason more, and reasoning seems to need sequential steps more than storage. Chain of thought is one way to get there; looping is another way to spend more compute when answering.
- Memory is scarce. Models increasingly run where memory is scarce and compute is relatively cheap: a laptop, a single GPU, a phone. Every stored parameter takes up memory, while another pass through weights already in memory costs comparatively little. (That said, GLM-5.4 is not meant to run at home.)
Inkling 2 Mini: designed to loop
Thinking Machines' Inkling 2 Mini has 24 layers in four blocks of six. The first block (the prelude) runs once; the two middle blocks (the core, 12 layers) run three times; and the last one (the coda) runs once. That's 48 layer applications per token from 24 layers of weights.
It is also a mixture-of-experts model: 26.4B parameters in total, with each token routed to 8 of 128 experts in each layer. One pass activates 3.4B, and each extra pass through the core adds about 1B. At three passes it does the work of a 5.4B-active model while storing the weights of a 26B one. The checkpoint weighs about 20 GB: small enough for a 32 GB laptop.
Three details of the loop:
- Every pass restarts from the prelude's output, and passes 2 and 3 also receive a "message" from the previous pass, merged in through a learned gate.
- That gate starts fully closed: at first, each pass behaves like a non-looped model, and the gate opens progressively during training. According to Thinking Machines, this let them introduce looping partway through training without destabilizing the model.
- Each of the 48 layer applications keeps its own KV cache, so the memory cost of attention still grows with the number of passes.
The release includes some measurements. Looping the middle 12 layers beat looping the last 12 on 27 out of 28 evaluations. And compared with a non-looped model from the same series, the non-looped one cost 7.5% less compute to train, but needed 140% more inference compute to reach the looped model's loss (measured on long agentic traces).
Thinking Machines also released a research variant, TML-d24-varloop-research, trained with 1 to 5 passes so you can choose how many to run when you load it. Its numbers come at the end.
GLM-5.4: a large model converted into a looped one
Z.ai's GLM-5.4 is a different beast: around 750B parameters, and it was not trained as a looped model from scratch. Z.ai took the already pretrained GLM-5 base and converted it, through continued training, into a model that runs 28 of its layers twice. Their reason: "looped models trained from scratch still lag behind unshared models under the same pre-training compute budget."
Converting a model that was never meant to loop has a problem. If the second pass simply overwrites the hidden states, Z.ai writes, "activation norms blow up across iterations", and downstream layers receive vectors of a size and distribution they have never seen. Their fix is a gate per token and per pass, which decides what fraction of each update gets written back. After training, the first pass writes cautiously and the second one opens the gate wide; harder tokens get larger first-pass updates.
To keep the cost down, the second pass reuses the attention cache selected by the first one and keeps only a short sliding window of its own ("an extra loop only costs one sliding window of KV cache rather than a full context cache"), and it also reuses the first pass's sparse-attention indices.
Their evidence: a controlled test on a 30B model. At equal parameter count, the looped version cost about 10% more training compute and improved results, mostly in math, scientific reasoning and long-context tasks.
| Inkling 2 Mini | GLM-5.4 | |
|---|---|---|
| Total size | 26.4B (MoE) | ~750B |
| Looped part | middle 12 of 24 layers | 28 layers of the GLM-5 base |
| Passes | 3 (1 to 5 in the research variant) | 2 |
| Connection between passes | restart from the prelude + gated "message" | per-token, per-pass gate on the update |
| Training | looping introduced during training | converted from a trained non-looped model |
| Attention cache | one per layer application | first pass's cache + a sliding window |
A treasure hunt for tiny transformers
The labs can compare looped and ordinary models with billions of parameters; the author can't. But the claims are about principles (depth versus storage, reasoning versus knowledge), and principles can be tested on a small scale with a much simpler task.
The task is a treasure hunt: every clue tells you where the next one is hidden, and you follow them to the last one. There are 64 symbols (the nodes). The input is a set of arrows a → b that link the nodes into several separate chains; they come in random order and the model has no positional information at all, so the input really is an unordered set. The last token is the query, one of the nodes, and the model must output the last node of its chain.
For example: if the query is 17, the chain is 17 → 42 → 3 → 28, and no arrow leaves 28, so the answer is 28, after three hops. A real input uses all 64 nodes: in that example, 15 chains and 49 arrows in random order, each one a single token, followed by the query.
What's nice about this task is that the number of hops is a dial: you set exactly how many reasoning steps each question requires. And there is nothing to memorize, since everything is in the input. It is a stripped-down version of something language models do all the time: following a variable through a program, or chaining "the manager of the manager of Alice".
All models share the same ingredients: 128-dimensional vectors, 4 attention heads, one prelude layer, one coda layer and a core that is either looped or not. They have between 0.6 and 2 million parameters, and each trains in 3 to 30 minutes on a single A10G GPU (on Hugging Face Jobs). The maximum chain length grows progressively during training (a curriculum), because in a first pilot, models trained directly on long chains learned nothing at all.
Stored layers or applied layers?
The author trained two families on chains of up to 48 hops. In the looped family, the core is a single layer repeated one to four times; in the deep family, the core has one to four distinct layers, each run once. Counting the prelude and the coda, both apply 3 to 6 layers per token (L). The difference is what they store: the looped models always have 0.63 million parameters, while the deep ones grow from 0.63 to 1.22 million.
Before the results, a prediction. The naive strategy is to follow one arrow per layer: six layers, six hops. But attention allows something much better, a classic trick from parallel computing: pointer jumping. Every arrow a → b asks, all at the same time, "where does b point?". After one round, every node knows the node two steps ahead; in the next, four; then eight, sixteen… With L layers, a model can in principle follow chains of up to 2^L − 1 hops: 7 with 3 layers, 15 with 4, 31 with 5 and 63 with 6.
The results:
- With 3 layers, the model follows chains of exactly 7 hops and then collapses, just as predicted.
- With 4 layers, the deep model reaches 14-15 hops (over two training runs) and the looped one 10-11.
- With 5 layers, both fall short of the theoretical 31: 16-19 for the looped model, 15 for the deep one.
- With 6 layers, both solve every chain up to 48 hops.
On the longest chains, accuracy seems to recover, but it is not a real improvement: it is an elimination artifact (on a long chain, few other chains are left, so the model guesses the answer more easily).
The summary figure tells the story. Against layers applied, the two families track each other: the looped one ahead at five layers and behind at four. Against stored parameters, the looped models go from 7 to 48 hops without gaining a single parameter. For following a chain, what matters is how many layers are applied, not how many are stored. That is exactly the bet behind looped models.
Memorizing facts: where parameters win
Now the opposite question. Most of what a language model knows is not in its input (the capital of Peru, the year a paper came out): it has to be stored in the weights. Does looping help there?
The author used three models with a two-layer core:
- shallow: the core runs once (4 layers applied, 0.83M parameters);
- looped: the core runs four times (10 layers applied, 0.83M parameters);
- deep: eight distinct core layers (10 layers applied, 2.0M parameters).
All three had to memorize a table of one million random facts: a subject of four symbols and an answer, one of 64 symbols. It is like "the capital of Peru is Lima", written in a code where nothing means anything; subjects that share three symbols have unrelated answers, so the only way to get a row right is to have memorized it. A million is more than any of these models can hold.
The shallow model stores 299,000 facts and the looped one 294,000: it applies two and a half times as many layers, and it makes no difference. The deep model, with 2.4 times as many parameters, stores 662,000.
Divide the stored information (6 bits per answer) by the number of parameters and you get about 2 bits per parameter for all three: 2.17, 2.13 and 1.97. That is close to what Allen-Zhu and Li (2024) measured in language models: about 2 bits of knowledge per parameter, whatever the architecture. Knowledge lives in the parameters, and passes don't add parameters: looping gives you more reasoning steps for the same memory, but no extra memory.
Choosing the number of passes at test time
So far, each looped model was trained and tested with a fixed number of passes. Inkling's research variant was trained with a random number of passes (1 to 5) so you can choose it at use time, and the author did the same: a two-layer core, with 1 to 6 random passes at each training step and chains of at most 16 hops. Then he tested it on chains of up to 48 hops, with 1 to 16 passes.
Each extra pass extends the reach (longest chain solved at 90% accuracy or more): 7 hops with one pass, 16 with two, 24 with three, 36 with six and 38 with seven, one more than it ever saw in training. No training chain was longer than 16 hops: from three passes on, the model solves problems longer than anything it was trained on.
It is not just a matter of compute. A model with exactly the same architecture, always trained with 4 passes, uses the same compute at 4 passes; yet it breaks down at 18 hops, while the variable-loop model reaches 29. It seems that training with a random number of passes forces the model to learn a procedure that keeps working when you repeat it, and that also carries over to longer chains.
But there is a limit. Beyond six or seven passes, the reach stops growing. In the first run it even decreases (31 hops at 10 passes, 25 at 16); in the second it stays flat around 30. Running the loop much longer than in training buys nothing, and it can even hurt.
Watching the loop work
Because this model was trained to answer after any number of passes, you can do something impossible with an ordinary network: stop it after pass 1, 2 or 3 and read its answer at each stage. For chains of 16, 24 and 32 hops, the author looks at how much probability the model gives to each node along the chain after each pass.
When it hasn't finished, the probability concentrates in a very specific place. After pass 1, at the node 8 hops down the chain; after pass 2, 16. On 24-hop chains it reaches the end at pass 3, and on 32-hop chains (twice as long as anything seen in training) it gets there partially at pass 3 and mostly at pass 4. Each of the first passes doubles how far the model can see.
This is pointer jumping again, but now we can watch it happen. Nobody taught the model this algorithm: it found it on its own, and it uses each pass through its core to perform one doubling. The author is honest about the second training run, where the picture is blurrier: the intermediate guesses move forward (about 13, then 15, then 21 hops), but without the clean 8-then-16 pattern. Doubling is one solution training can find, not the only one.
And the end of a chain is a natural resting point: once the model points at it, there is nowhere further to go, and the answer stays put. That is why extra passes do little harm, at least at first.
Keeping the loop stable
That leaves the engineering problem Z.ai describes: what happens to the internal state when you loop many times? The author compared three ways of connecting one pass to the next:
- plain repeat: the output of one pass is the input of the next;
- re-adding the prelude output at every pass (the variant used in all the previous figures; Inkling also restarts every pass from the prelude output);
- gated update: the core proposes a new state and one learned number per token decides how much of it to write (0 = keep the old state, 1 = replace it). It is his simplified version of GLM-5.4's gates, shared across passes so the model can run any number of them.
Without a gate, the size (norm) of the query token's internal vector grows steadily, by about 50 per pass once the answer has been found, reaching 17 to 27 times its initial size after 16 passes. This is the blow-up Z.ai describes, reproduced in a model with less than a million parameters, and a plausible cause of the decline in reach in the first run. It is not always fatal: in the second run, the norm grows just as much and the reach holds.
With the gate, the norm stays flat in both runs and the reach never degrades: 26 to 28 hops from 5 passes all the way to 16 (24-25 in the second run). The price is that it reaches less far at its best: 28 hops versus 38.
The most beautiful part is the gate value at the query token, pass after pass. It is wide open during the first passes, then drops to almost zero, and it closes later for longer chains: it falls below 0.1 at pass 3 for 4-hop chains, at pass 4 for 8-hop chains and at pass 6 for chains of 16 hops or more. Nobody asked the model to do this: it learned on its own to keep working while the answer is not found, and to stop writing once it is. That is a form of adaptive computation, precisely the open question Z.ai lists at the end of its GLM-5.4 announcement.
The second run shows the same tendency, but cruder: the gate closes too early, and that model never gets past 25 hops. And a word of caution from earlier attempts: the author first tried an Inkling-style gate that starts fully closed. In 2,000 training steps it only opened to about 0.06, and the looped model ended up no better than a non-looped one with the same parameters: it essentially ignored its extra passes. On a small budget, a closed gate can stay closed.
What the tiny models say about the big ones
- Extra passes help multi-step reasoning. In the experiment, how far a model can follow a chain depends on the layers it applies, not on the ones it stores. According to the model card of Inkling's variant, going from 1 to 3 passes takes GraphWalks (walking through a graph of up to a million tokens given in the context) from 5.7 to 52.1, BrowseComp from 29.4 to 65.7, and Humanity's Last Exam from 10.5 to 24.9.
- Extra passes do not add knowledge. In the experiment, the facts a model memorizes depend on its parameters, not on its passes. On the same Inkling model, SimpleQA Verified (short factual questions whose answers must be stored in the weights) only goes from 6.3 to 7.3 between 1 and 3 passes. Z.ai, for its part, reports its largest gains in math and scientific reasoning.
- The returns stop at some point. In the experiment, reach stops improving a few passes beyond the number used in training. Inkling's variant was trained with up to 5 passes but post-trained with 3, and its scores barely move after that (Humanity's Last Exam: 24.9, 25.4 and 25.9 at 3, 4 and 5 passes).
- Looping needs a mechanism to stay stable. Without a gate, the state grows with every pass. Z.ai built GLM-5.4's per-token gates for exactly this reason, and Inkling's gate controls how much of the previous pass gets through.
- At equal compute, there is no free lunch. In the experiment, a non-looped model applying the same number of layers follows chains just as well and stores more facts. That fits Z.ai's statement (trained from scratch, looped models lag behind at equal compute) and Thinking Machines' framing: their non-looped version was cheaper to train, and the looped model's advantage showed up at inference time. Looping pays off when the scarce resource is memory (the weights that must fit on a laptop or a GPU), rather than compute.
One thing the experiment can't reproduce: both labs report that looped models write shorter reasoning. On GPQA, Inkling's variant goes from 3,703 reasoning tokens at 1 pass to 1,731 at 3 passes, and GLM-5.4's outputs are 10 to 14% shorter. The author's models answer with a single token, with no written reasoning at all.
An important caveat: these models have about a million parameters and see a single synthetic task, and their attention is bidirectional over an unordered set, while language models read text from left to right. As the author himself puts it, they are illustrations of mechanisms, not measurements of what happens in a 26B model.
Open questions
- How many passes does each token need? Both releases use a fixed number of passes, and Z.ai lists adaptive computation as future work. The gate in the small models suggests a model can learn to stop on its own; whether that survives at scale is another matter.
- Can we still read what the model thinks? If part of the reasoning moves from written tokens into the loop, it becomes harder to monitor. Thinking Machines found no meaningful loss of monitorability at this scale, but warns that this may not last.
- Why do looped models trained from scratch lag behind? In the experiment, at equal compute, looping loses nothing on reasoning and only loses storage. Whether that is the whole explanation for large models, the author doesn't know.
- How do returns evolve with model size and number of passes? Z.ai lists this as open too.
Everything is in a single Python script (loopexp.py, about 300 lines) that runs on Hugging Face Jobs with no setup. The experiments in the article took about 3.5 GPU-hours on A10G GPUs, roughly $3.50.
In short
A looped transformer repeats the same layers to think more steps without storing more weights. Extra passes help reasoning, not knowledge; the gains stop a few passes beyond training, and you need a gate to keep the state from blowing up. At equal compute there is no free lunch: looping pays off when what you're short of is memory.
Sources
- David Louapre (Hugging Face), "Looped Transformers: Thinking twice with the same weights", November 25, 2026 (CC-BY 4.0).
- The video on my channel: Articulator EN · Articulator ES.