Run the same layers again and you get more depth with no new weights. Inkling 2 Mini stores 24 layers and applies 48 for every token.
Set the number of passes, then watch a chain of lookups resolve one hop per pass. Too few passes and the answer is wrong. Then we build, piece by piece, shared weights, halting, the prelude and coda, the gated message, and what all of it costs.
You need a rough idea of a transformer layer (attention, then a feed-forward net) and a little Python. We build the rest from zero.
Sources: Dehghani et al., Universal Transformers (2018), and Thinking Machines, Inkling 2 Mini and its model card (November 2026).
An illustrative toy: here each pass of the looped block follows exactly one link. A real model does not split work this cleanly. The real result: Thinking Machines' variable-loop research model trained with 1 to 5 passes. It kept improving on longer lookup chains out to 10 passes (N-Hop Lookup figure, Inkling 2 Mini post).
Chapter 0
See why a deeper model usually means a bigger model, and how a loop breaks that link
Ask a model: "Ada's mentor sits next to someone. Who manages that person?" The model must find the mentor, then the neighbour, then the manager. Each hop needs the result of the one before. If the model may not write notes, all three hops happen inside one forward pass.
Each layer of a transformer runs once per token, in order. So the number of layers caps how many steps in a row the model can take for one token. This count is the model's serial depth: the longest chain of computations that must happen one after another.
The usual way to add depth is to add layers. Each new layer brings its own weights. More layers means more memory to store, more to load, and more to train. A looped transformer takes the other road: it runs some of its layers again. The weights stay the same. The depth grows.
Both columns do the same number of layer applications per token. Solid cells hold their own weights. Faded cells reuse stored weights. Drag the depth.
The looped column follows Inkling 2 Mini: 6 layers, then 12 layers repeated, then 6 layers. 48 applications from 24 stored layers is its real setting; the other stops apply the same layout to 1, 2, 4 and 5 passes.
A worked number. Inkling 2 Mini wants 48 layer applications per token. A plain model would store 48 layers. Inkling 2 Mini stores 24, so it keeps half the weights for the same depth. The price is compute: every applied layer still costs its full arithmetic.
Failure: depth too shallow for the question
Symptom. The model answers one-hop questions well and fails three-hop questions when it may not write notes.
Measure. Build lookup chains of 1 to 10 hops and plot accuracy against hop count. The curve falls off a cliff where the depth runs out.
Fix. Let the model write a chain of thought, or give it more serial depth. A loop gives depth without new weights.
Chapter 1
Tie the weights of every layer together and turn the stack into a loop
A plain transformer has a stack of layers. Layer 3 has its own weights, layer 4 has others. In 2018, Dehghani and colleagues asked: what if every layer used the same weights? The result is the Universal Transformer: one block, applied T times to its own output.
Picture a sentence of 5 tokens. Each token is a vector of d numbers, so the state is a matrix of shape 5 × d. One block takes that matrix and returns a matrix of the same shape. So you can feed the output back in. Each application is one step (we also say one pass).
The block needs to know which step it is on, because the same weights now do every step. The paper adds a fixed coordinate embedding at each step: one sine pattern for the position and one for the step number.
H-t equals Block-theta of H-t-minus-one plus P-t.
Take the last state H-t-minus-one. Add the stamp P-t that says "this is step t". Run Block-theta on it. The result H-t is the next state. Repeat T times.
With made-up sizes: 5 tokens and d = 512, so every H-t is 5 × 512. Six steps use Block-theta six times. The model stores the weights of one block, not six.
Each row is one step over 5 tokens. Switch between separate and shared weights, then drag the number of steps.
The equation and the coordinate embedding follow the paper (Eqs. 4 to 6). The token count and sizes are illustrative.
Does sharing hurt? On WMT14 English to German translation, the Universal Transformer base scored 28.9 BLEU. The Transformer base scored 28.0 with the same number of parameters (Table 7). It also solved algorithmic tasks, such as copying, where the plain Transformer failed on longer inputs.
Failure: the block cannot tell its steps apart
Symptom. Extra steps change nothing, or the state blurs into the same vector for every token.
Measure. Compare H-t across steps. If step 5 equals step 4 for every input, the extra steps do no work.
Fix. Give each step a signal it can read: a step embedding, as here, or a fresh copy of the input (Chapter 4).
Chapter 2
Add a halting signal so hard tokens get more passes and easy tokens stop early
A story has ten sentences. The question needs two of them. Why should the other eight get as many passes as the two that matter? The Universal Transformer paper adds dynamic halting, based on Graves' adaptive computation time (ACT). At each step, every position outputs a halting probability, a number from 0 to 1.
The position adds up its halting probabilities step by step. When the sum crosses a threshold (a setting between 0 and 1), that position stops. The position then copies its state forward unchanged while the others keep going. The run ends when all positions stop or the step count hits a maximum.
N-i is the first N where the sum over t from one to N of p-i-t is at least tau.
Keep a running total of p-i-t for position i. The step where the total first reaches tau is N-i. After that, position i stops changing.
With made-up numbers: an off-topic sentence outputs 0.7, then 0.5. With tau = 0.95, the total is 0.7 after step 1 and 1.2 after step 2. So N-i = 2.
Each row is one position. Filled cells are steps it runs; hollow cells copy its state. Drag the threshold.
The halting probabilities are illustrative, with a maximum of 8 steps. The rule (sum to a threshold, copy halted states) follows the paper's Section 2.2 and Appendix C.
The paper saw this behaviour on bAbI question answering. Average ponder time was 2.3 steps for tasks needing one supporting fact, 3.1 for two, and 3.8 for three. On LAMBADA, the halting model averaged 8.2 steps, and it beat fixed models run for 8 and 9 steps.
Failure: every token halts at step 1
Symptom. Ponder time collapses to the minimum and accuracy drops on hard inputs.
Measure. Log the mean and spread of N-i per task. A spread near zero means halting learned nothing.
Fix. Lower the penalty on ponder time, or raise the threshold so stopping takes more evidence.
Chapter 3
Loop only the middle of the stack, and keep a fixed entry and exit
The Universal Transformer loops everything. Modern looped models loop only part of the stack. They split it into three parts:
Inkling 2 Mini has 24 layers in four blocks of six. Thinking Machines calls the first block the prelude. Blocks 2 and 3 (layers 7 to 18) are the recurrent block and run three times. Block 4 runs once; we call it the coda, the usual name for this part. Every layer is attention plus a mixture-of-experts feed-forward layer that sends each token to 8 of 128 experts.
A equals L-pre plus T times L-rec plus L-coda.
Count the prelude once. Count the recurrent block once per pass, so T times L-rec. Count the coda once. The total is A.
For Inkling 2 Mini, A = 6 + 3 × 12 + 6 = 48. The stored count is 6 + 12 + 6 = 24. Each token passes through every stored middle layer three times.
Each column is a block of 6 layers. Press Play, or Step one block at a time. Change the passes and watch the count.
The 4 blocks of 6 layers and the three passes of blocks 2 and 3 are Inkling 2 Mini's (post and model card). The 1 and 5 pass stops apply the same layout.
The shapes never change inside the stack. Every layer takes tokens × d and returns tokens × d, so the output of block 3 fits the input of block 2. The model card does not disclose d.
Failure: looping the layers that read out the answer
Symptom. Extra passes add little, because the looped layers already speak in next-token terms.
Measure. Train two runs with equal compute, one looping the middle and one looping the end, and compare losses.
Fix. Keep a coda after the loop. Chapter 6 shows the real ablation.
Chapter 4
Start every pass from the prelude output, and let a gate decide how much of the last pass comes along
Feed a block its own output again and again, and the state can drift. After many passes it may settle on the block's favourite vector, whatever the question was. Inkling 2 Mini guards against this in two ways.
First, input re-injection: every pass starts from the prelude's output, not from the last pass alone. The question is read fresh on every pass. Second, passes 2 and 3 also read the recurrent block's output from the pass before. Thinking Machines calls this the message. A learned gate scales the message.
The gate starts closed. At the start of training it blocks the whole message, so each pass sees only the prelude output and acts like a plain, non-looped model. The gate opens as training goes on. Thinking Machines says this lets them add looping "in a stable manner."
The post does not give the formula. Below is the simplest form that matches its words; the real model mixes these inputs with learned per-layer weights, an attention residuals design.
x-t equals e plus g times m-t-minus-one.
Start pass t from e. Add the message m-t-minus-one, scaled by the gate g. Run the recurrent block on the sum x-t.
With made-up numbers for one channel: e = 0.8 and m-t-minus-one = 0.5. If g = 0, then x-t = 0.8 on every pass. If g = 0.6, then x-t = 0.8 + 0.3 = 1.1.
Two questions, A and B, each run 8 passes. Blue dots are their prelude outputs; trails show each pass. Drag the gate, then turn re-injection off.
An illustrative 2D toy: the block is a fixed map that shrinks and turns its input, then shifts it. Without re-injection, the input of pass t is the message alone, as in a Universal Transformer.
At g = 0, passes 2 to 8 repeat pass 1. That is the closed gate: the loop is safe because it does nothing new. Open the gate and the passes refine the answer, yet A and B stay apart. Turn re-injection off and both trails end at the same point: the loop forgot the question.
Failure: loss spikes when you switch looping on
Symptom. You add a loop with a full message from step 1, and the loss jumps.
Measure. Log the gate value and the loss together. A spike at the moment the message arrives points here.
Fix. Start the gate closed so the loop begins as a plain model, and let training open it.
Chapter 5
Separate what the model stores from what it does for each token
Two numbers describe a model's size, and a loop pulls them apart. Stored parameters are the weights on disk and in memory. Compute per token is the arithmetic done to produce one token. In a plain dense model they grow together. A loop raises compute and leaves storage alone.
Inkling 2 Mini is a mixture-of-experts model, so a third number joins in. Of its 26.4 billion total parameters, 3.4 billion are active: the ones a token touches in one pass. The model card adds that each extra pass through the loop adds about 1.0 billion effective active parameters, the weights the token touches counting repeats.
N-eff equals N-act plus T minus one, times delta-N.
Start from N-act for one pass. Every pass after the first adds delta-N. The total is N-eff, a measure of compute per token.
At T = 3: N-eff = 3.4 + 2 × 1.0 = 5.4 billion, the model card's figure. Stored weights stay at 26.4 billion.
Pink is what the model stores. Yellow is what one token costs. Drag the passes.
26.4B total, 3.4B active, about 1.0B per extra pass and 5.4B at three passes are from the Inkling 2 Mini model card. The 1, 2, 4 and 5 pass values extend that rule and are our arithmetic.
What does the trade buy? Thinking Machines compared a looped model with a non-looped one on its scaling ladder. The non-looped model cost 7.5% less compute to train. But it needed 140% more inference compute to match the looped model's loss on 512k-token agentic traces.
Failure: sizing serving hardware from the parameter count
Symptom. A model with "3.4B active" runs slower than other 3.4B-active models.
Measure. Count layer applications per token, not stored layers: 48 here, not 24.
Fix. Budget compute from N-eff, 5.4 billion at three passes.
Chapter 6
Read the ablation that chose which 12 layers to repeat
You have 24 layers and may loop 12. Which 12? Thinking Machines trained three versions with equal training compute. One had no loop. One looped the last 12 layers (13 to 24). One looped the middle 12 (7 to 18). Both looped runs used three passes.
To compare them they used a compute-equivalent gain: how much more compute the no-loop model would need to reach the looped model's loss. A gain of 1.5 means the plain model needs 1.5 times the compute for the same loss.
G equals C-base over C-loop, at the same loss.
Find the loss the looped run reached. Ask how much compute C-base the plain model needs for that loss. Divide by C-loop. That ratio is G.
With a made-up budget of 100 units for the middle loop, the plain model needs 151 to 191 units, so G is 1.51 to 1.91. For the last-layer loop it needs 124 to 136 units.
The strip shows the 24 layers and the looped range. Below, each segment spans the lowest and highest gain across three evaluations. Pick a loop.
From the Inkling 2 Mini post (Compute-equivalent gain by loop position): gains of 1.51 to 1.91 (middle) and 1.24 to 1.36 (last), estimated at training step 2,000. The 27 of 28 count is from the same post.
The middle loop won on 27 of 28 evaluations. The post reports the result and gives no reason. A plausible one: the last layers turn the state into next-token scores, so repeating them repeats the read-out. The middle layers hold the working state, so repeating them adds thinking steps. The middle loop also keeps a coda after the loop.
Failure: judging a loop at unequal compute
Symptom. A looped run beats the baseline, but it also used more training compute.
Measure. Fix the training compute, then compare losses, or report the gain G.
Fix. Compare every loop choice at equal compute, as this ablation did.
Chapter 7
Change the number of passes at inference and trade written reasoning for silent depth
A loop has a knob that a plain stack lacks: you can change T after training. Thinking Machines trained a research model, TML-d24-varloop-research, with 1 to 5 passes. Its midtraining used mostly 3 passes, and its RL used 3.
Three results show what more passes buy:
The chain of thought stayed legible: about 8.7 to 8.9 words per sentence at every pass count. The post says the model backtracked less and was more direct. Fewer tokens is not the same as less compute, so count both.
C equals n times A.
Each written token costs A layer applications. Multiply by the n tokens written. The product C is the cost of the answer, ignoring that attention grows with length.
At 1 pass: 3,703 × 24 = 88,872. At 3 passes: 1,731 × 48 = 83,088, about 7% less. At 5 passes: 1,661 × 72 = 119,592, about 35% more.
Top: reasoning tokens per answer. Bottom: layer applications per answer. Pick a pass count.
Token counts are from the Inkling 2 Mini post (reasoning-trace table, GPQA Diamond, questions correct at all five pass counts). The applications per answer assume the 6, 12, 6 layout of Inkling 2 Mini; the post does not give the research model's layout.
So 3 passes wrote half the tokens for slightly less layer compute. Five passes cut few more tokens and cost more. The silent work also hides reasoning that a written chain would show, which matters for monitoring.
Failure: running far more passes than the model trained with
Symptom. Accuracy stalls or falls past some pass count on your task.
Measure. Sweep T from 1 to 10 on held-out data and plot accuracy and compute per answer.
Fix. Pick the T where the curve flattens. The time horizon here was flat past 3.
Chapter 8
Count the cache, the latency and the training risk that each pass brings
A loop saves storage. It does not save the other bills. Three costs grow with the number of passes.
The KV cache. When a model writes text, each attention layer keeps a key and a value vector for every past token, so it does not recompute them. In a loop, pass 2 of layer 9 sees a different state from pass 1 of layer 9. So each pass needs its own keys and values, unless the runtime shares or recomputes them. The post does not say how Inkling 2 Mini handles this. Its hybrid of local and global attention keeps local layers to a window, which limits the growth.
K equals two times A.
Each layer application stores one key and one value for the token. So the cache per token is twice A.
A plain 24-layer model keeps 2 × 24 = 48 vectors per token. At A = 48, K = 96, so the cache doubles. Over 100,000 tokens that is 9.6 million vectors instead of 4.8 million.
Latency. The passes for one token run one after another, so each pass adds time before the next token appears. The model card says compute per token is higher than the active count suggests, and that speed varies by runtime and hardware.
Each bar is relative to a plain 24-layer model, which sits at 1.0. Drag the passes.
An estimate from layer counts in the 6, 12, 6 layout. It assumes each pass caches its own keys and values and each layer step takes the same time. Thinking Machines gives no cache or latency figures.
Training stability. A loop is a deep network with tied weights. Gradients flow back through every pass into the same weights, so a bad update hits all passes at once. The closed gate from Chapter 4 is the stated fix.
Failure: out of memory at long context
Symptom. The looped model fits on the GPU at short context and fails at long context, where the plain model of the same size fits.
Measure. Log the cache size per token. If it scales with passes, each pass caches its own keys and values.
Fix. Use local attention in more looped layers, share keys and values across passes, or run fewer passes.
Chapter 9
Keep the numbers, the terms, the checklist and the core code on one page
A looped transformer runs a prelude once, a recurrent block T times with shared weights, and a coda once. Every pass starts from the prelude output and reads a gated message from the pass before. The loop buys serial depth without parameters, and pays in compute, cache and latency.
| What | Number | Source |
|---|---|---|
| Inkling 2 Mini layers | 24 stored, 48 applied; 4 blocks of 6, blocks 2 and 3 run 3 times | Post, model card |
| Parameters | 26.4B total, 3.4B active, 5.4B effective active at 3 passes | Model card |
| Per extra pass | About 1.0B effective active parameters | Model card |
| Experts per layer | 8 of 128 | Model card |
| Loop position gain | Middle 1.51 to 1.91; last 1.24 to 1.36; middle won 27 of 28 | Post |
| No loop versus loop | 7.5% less training compute, 140% more inference compute for the same loss | Post |
| Test-time passes | Trained 1 to 5; N-hop improves out to 10 | Post |
| No-CoT time horizon | 16 s at 1 pass, 37 s at 3, flat beyond | Post |
| Reasoning tokens | 3,703 / 1,731 / 1,661 at 1 / 3 / 5 passes | Post |
| Universal Transformer | 28.9 vs 28.0 BLEU, same parameters; ponder 2.3 / 3.1 / 3.8 steps for 1 / 2 / 3 facts | Dehghani et al., Tables 7 and text |
| Context window | Up to 1M tokens | Model card |
| Gate formula, d, cache handling | Not disclosed | None |
| Term | Meaning |
|---|---|
| Looped transformer | A transformer that runs some of its layers more than once per token, with the same weights. |
| Pass | One run through the recurrent block. |
| Serial depth | The number of layer applications that run one after another for a token. |
| Prelude, recurrent block, coda | Layers run once at the start, T times in the middle, once at the end. |
| Input re-injection | Every pass starts from the prelude output. |
| Message and gate | The last pass's output, scaled by a learned gate that starts closed. |
| Dynamic halting | Each position stops when its summed halting probability crosses a threshold. |
| Effective active parameters | Weights a token touches, counting each pass. |
| Compute-equivalent gain | Baseline compute needed for the same loss, divided by the run's compute. |
pythonimport torch, torch.nn as nn class LoopedLM(nn.Module): # 6 prelude, 12 recurrent, 6 coda layers, as in Inkling 2 Mini. # The gate form is illustrative: the real formula is not disclosed. def __init__(self, make_layer, d, n_pre=6, n_rec=12, n_coda=6): super().__init__() self.pre = nn.ModuleList(make_layer() for _ in range(n_pre)) self.rec = nn.ModuleList(make_layer() for _ in range(n_rec)) self.coda = nn.ModuleList(make_layer() for _ in range(n_coda)) self.gate = nn.Parameter(torch.zeros(d)) # starts closed def forward(self, h, passes=3): # h: [tokens, d] for layer in self.pre: h = layer(h) e, m = h, torch.zeros_like(h) # prelude output, message for t in range(passes): x = e + self.gate * m # re-inject e, gate the message for layer in self.rec: x = layer(x) # same weights every pass m = x h = m for layer in self.coda: h = layer(h) return h # [tokens, d], to the output head
Now press Teach and explain from memory. Cover the three parts of the stack, why the gate starts closed, and why 48 applications from 24 layers cost compute. Then go back to the hero and find the fewest passes that solve 8 hops.
The Universal Transformer and dynamic halting come from Dehghani, Gouws, Vinyals, Uszkoreit and Kaiser, Universal Transformers (ICLR 2019). Every Inkling 2 Mini number comes from Thinking Machines' Inkling 2 Mini post and model card (November 2026). The toys and explanations are our own.