Recursive Depth

repeat

Depth Without Parameters

A standard transformer passes a hidden state through each layer once, so depth and parameter count rise together. A looped transformer applies the same block repeatedly instead, giving an effective depth of layers multiplied by passes while the weights are stored once. The idea is older than the current interest in it, going back to Universal Transformers in 2018, and it has returned because test-time compute became something worth spending deliberately.

layers

The Mechanism

Weight tying along the depth axis. What changes is not the arithmetic of a single block but how many times that arithmetic runs and what is paid for it.

PropertyStacked layersLooped block
Effective depthEqual to the number of distinct layers.Layers multiplied by passes, so 22 layers at two passes behaves like 44.
Stored weightsOne set per layer.One set for the whole loop, regardless of pass count.
Compute per tokenFixed by the architecture.Scales with passes, and can differ per token.
Adding capabilityTrain a larger model.Run more passes, including after training in some designs.
Memory during inferenceOne activation set and one KV cache.Activation and cache pressure rise with each pass.
account_tree

Loop Control Strategies

Three ways to decide how many passes a token receives, in increasing order of how much machinery they require.

repeat_one
Fixed loopsDecided at design time

Every token goes through the same number of passes, chosen as a hyperparameter and unchanged at run time. Simple, predictable to serve, and wasteful on tokens that did not need the extra depth.

Cost: Nothing beyond the extra passes themselves.

exit_to_app
Learned exit gatesDecided per token, at run time

The model learns when a token has been processed enough and can stop early, a form of adaptive halting. Compute concentrates on the tokens that are actually difficult.

Cost: A halting mechanism to train, and variable latency per sequence.

alt_route
Depth routingDecided per token, by a router

Lightweight routers assign each token its own recursion depth, and attention at each depth is computed over only the tokens still active there. Key and value pairs can be cached selectively or shared from the first pass.

Cost: Router training, plus the load-balancing problems that routing always brings.

memory

Models Using It

ModelLoop configurationEffective depthControl
Nanbeige4.2
3B parameters
Two fixed passes over a 22 layer stack44 block applicationsFixed
Ouro-Thinking
2.6B parameters
Up to four passes over 48 layersUp to 192 applicationsLearned exits
Mixture-of-Recursions
135M to 1.7B, research
Per-token recursion depth assigned by routersVaries by tokenRouted

The pattern in the reported results is that a small model with loops competes with a substantially larger one without them, which is why the current interest is concentrated at the compact end rather than the frontier.

error_outline

What It Costs

Parameter efficiency is not free efficiency. The savings are in storage and the costs are in memory traffic, training and serving predictability.

memoryMemory Per Pass

Activations and key-value cache grow with each pass, so the parameter saving is partly returned as memory pressure at inference. The model is smaller to store and not proportionally cheaper to serve.

scheduleTraining Cost

Gradients flow through the same weights many times, which raises both compute and the difficulty of keeping training stable. Reported work tends to settle on few passes rather than many.

timerVariable Latency

Adaptive halting and depth routing mean two requests of the same length can take different amounts of time, which complicates capacity planning and any hard latency budget.

trending_downDiminishing Returns

More passes do not keep paying. Published configurations cluster at two to four, with the trade-off between quality and token efficiency turning over quickly beyond that.

compare_arrows

Depth and Width

This is the depth-axis counterpart to mixture of experts. Both refuse to spend every parameter on every token; they disagree about which dimension to make conditional.

DimensionMixture of expertsRecursive depth
What is conditionalWhich parameters a token uses.How many times a token is processed.
Parameters storedVery large, most inactive per token.Small, all active on every pass.
Scaling leverAdd experts.Add passes.
Main serving costMemory to hold every expert.Repeated compute and growing cache.
Routing decidesWhich expert, at each layer.Whether to continue, at each pass.

They compose. A looped stack can contain expert layers, so a token can be routed to a subset of parameters and then sent through them more than once.

Related: Transformer Architecture for the block being reused, Mixture of Experts for the width-axis equivalent, LLM Performance for the inference costs loops add, and Fast and Slow Brain for spending variable compute per input at the system level rather than inside the model.