Model Foundations

What Is a Loop Transformer?

A loop transformer, also called a looped transformer or looped language model, runs a shared block of its layers several times for each token instead of passing through every layer once. The network computes as if it were deeper without storing extra weights. The idea dates back to the 2018 Universal Transformer, and in November 2026 three new models adopted it: Z.ai’s GLM-5.4, Thinking Machines’ Inkling 2 Mini and SenseNova-Loop-9B.

  • Model Foundations
  • 10 min read
  • Updated November 23, 2026
  • VDF AI Team
01
In short

A loop transformer, also called a looped transformer or looped language model, runs a shared block of its layers several times for each token instead of passing through every layer once. The network computes as if it were deeper without storing extra weights. The idea dates back to the 2018 Universal Transformer, and in November 2026 three new models adopted it: Z.ai’s GLM-5.4, Thinking Machines’ Inkling 2 Mini and SenseNova-Loop-9B.

Key takeaways

  • 01 A loop transformer re-applies the same block of layers several times per token, adding depth and compute without adding stored parameters.
  • 02 Looped models therefore quote two sizes: stored parameters set weight memory, while effective parameters set the work per token. Inkling 2 Mini has 3.4B active and 5.4B effective.
  • 03 Each extra pass can keep its own KV cache. llama.cpp’s Inkling 2 Mini code does exactly that, while GLM-5.4 reuses most of the first pass’s cache to contain the cost.
  • 04 It is the opposite trade to mixture of experts: MoE stores more weights and runs a slice of them, looping stores fewer and runs them more than once. Inkling 2 Mini and GLM-5.4 do both.
  • 05 It has nothing to do with agent loops: the repetition happens inside one forward pass, not across model and tool calls.
02

Loop transformer, defined

In a standard decoder-only transformer, each token’s hidden state flows through a stack of distinct layers exactly once: 24 layers of weights means 24 layer applications. A loop transformer marks out a contiguous block of layers, usually in the middle of the stack, and runs that block several times with the same weights. The output of one pass becomes the input of the next, so each pass refines the representation the previous one produced. Layers before the block (often called the prelude) and after it (the coda) still run once.

Researchers call this depth recurrence. The repetition happens over depth, on the state of a single position, not over time as in a recurrent neural network that carries a state from one token to the next. Prompt processing stays parallel across tokens, as in any transformer. Because the extra passes refine hidden states rather than emit words, looping is often described as reasoning in latent space, a counterpart to writing out a chain of thought.

Inkling 2 Mini shows the shape in numbers. Its model card describes 24 layers of weights in which the middle 12 run three times with shared weights, giving 48 layer applications per token. Its configuration file places the looped block at layers 6 to 17, so layers 0 to 5 form the prelude and layers 18 to 23 the coda.

03

Loop, looped, recursive or recurrent-depth: one idea, several names

The design is older than the current wave of models. The Universal Transformer (Dehghani et al., 2018, arXiv:1807.03819) applied one shared block repeatedly and added a per-position halting mechanism, an idea related to Adaptive Computation Time for recurrent networks (Graves, 2016, arXiv:1603.08983). ALBERT (arXiv:1909.11942) later shared parameters across layers to shrink BERT, which is the same weight sharing used for a different goal: a smaller model rather than a deeper one.

The term looped transformer took hold in 2023. Giannou et al. showed that a looped transformer can be programmed to behave like a general-purpose computer (arXiv:2301.13196), and Yang et al. studied how looped transformers learn in-context learning algorithms (arXiv:2311.12424). In 2025 Saunshi et al. reported that a k-layer transformer looped L times nearly matches a kL-layer model on many reasoning tasks, and proved that T loops can simulate T steps of chain-of-thought (arXiv:2502.17416).

Other groups use other names for close relatives. Bae et al. converted pretrained models into Recursive Transformers that repeat one block of unique layers (arXiv:2410.20672), then added routers that give each token its own recursion depth in Mixture-of-Recursions (arXiv:2507.10524). Geiping et al. trained a 3.5-billion-parameter recurrent-depth model on 800 billion tokens whose block can be unrolled to any depth at test time (arXiv:2502.05171). The Ouro paper named the category Looped Language Models (LoopLM) and released 1.4B and 2.6B models trained on 7.7 trillion tokens (arXiv:2510.25741).

“Loop Transformer” is Z.ai’s term for GLM-5.4, and its launch post cites the Universal Transformer and recent recurrent-depth and looped-model research as prior work. Thinking Machines’ model card calls Inkling 2 Mini a looped transformer, and SenseNova-Loop-9B is tagged looped-transformer on Hugging Face. The names describe the same architecture.

04

Stored versus effective parameters

Looping splits a model’s size into two numbers. Stored parameters are what sits on disk and in GPU memory. Effective parameters count every layer application, so a looped block is counted once per pass. Inkling 2 Mini stores 26.4 billion parameters and activates 3.4 billion per token; its model card adds that, with three passes, it has 5.4 billion effective active parameters per token. The SenseNova-Loop-9B card gives about 9 billion stored parameters and about 14.6 billion inference-equivalent parameters, from 32 physical layers whose layers 4 to 27 run twice for 56 layer executions.

For sizing, weight memory follows the stored figure and its quantization, while compute per token follows the effective one. Token generation is usually limited by memory bandwidth, and each pass reads the looped weights again, so decode speed tends to track the effective active size rather than the file size. When you estimate a looped model with the tokens-per-second calculator, enter the effective active figure; for the VRAM calculator, use the stored figure and add the extra per-pass cache described below, since neither tool models looping.

GLM-5.4 needs more care. As of 23 November 2026 Z.ai has not published a stored or effective parameter count. Its launch post describes changes made “at the 750B scale” and claims intelligence comparable to 2T–3T parameter models; that is a capability claim, not a parameter count, and the post contains no GLM-5.4 benchmark table. Z.ai’s model documentation adds only head-to-head win rates, such as 51.1% wins, 25.7% ties and 23.1% losses against GLM-5.3, without naming the evaluation set. For reference, the GLM-5 model card lists 744 billion parameters with 40 billion active.

05

Loop transformer KV cache and memory

Looping shrinks the weights but not necessarily the cache. During generation every attention layer stores keys and values for all earlier tokens. If the attention layers inside a looped block keep a separate cache on every pass, KV memory for those layers grows with the loop count. Z.ai’s post calls a full cache per iteration the naive implementation, because it multiplies memory use by the number of loops.

llama.cpp’s Inkling 2 Mini support takes the straightforward route. Its loop implementation shares the physical weights while each cache slot keeps its own KV and convolution state, and allocates 24 + 2 × 12 = 48 cache slots. Inkling’s config.json makes 20 layers sliding-window (1,024 tokens) and 4 layers global (5, 11, 17 and 23); layers 11 and 17 sit inside the loop, so the full-length cache comes from 8 global slots instead of 4. With 8 KV heads of 128 dimensions, a 16-bit cache needs 8 × 128 × 2 (keys and values) × 2 bytes = 4 KiB per token per global slot. Eight slots make 32 KiB per token, about 4 GiB at 131,072 tokens, against about 2 GiB if those layers ran once. The 40 sliding-window slots add a fixed amount whatever the context length: about 160 MiB for 1,024-token windows, nearer a quarter of a gigabyte in llama.cpp, which sizes each window cache at the window plus one micro-batch. This is our arithmetic from the published configuration, not a vendor figure, and a quantized KV cache reduces it.

GLM-5.4 is built to avoid most of that cost. Z.ai describes a hybrid KV cache in which the second loop reuses the sparse KV selected during the first pass and keeps its own new KV only within a local sliding window, so an extra loop costs one sliding window of cache rather than a full-context cache. The second pass also reuses the first pass’s sparse-attention indices. Mixture-of-Recursions proposed a similar variant that reuses KV pairs from the first recursion. Before choosing a context length for any looped model, check how the model and your runtime handle per-pass cache. SenseNova’s card publishes minimum-memory estimates, for example about 12 GiB at 128K tokens with 4-bit weights and an 8-bit KV cache, but does not say whether each pass keeps its own cache.

06

Are looped models slower?

Per token, a looped model does the work of its effective depth. A model with 48 layer applications costs roughly what a 48-layer model costs, even though it stores 24 layers, and both prompt processing and generation pay for every pass. Against an unshared model of the same effective depth, the compute is about the same; the saving is in stored weights, not in time. Against a model of the same stored size, looping is slower per token.

Two things can offset that. The first is shorter output. Z.ai ran an iso-parameter test on a 30B model with the same architecture as its 750B base: with about 10% more training compute, the looped version gained most in math, scientific reasoning and long-context tasks, and average output length fell by 10–14% on most benchmarks, mostly through shorter chains of thought. Fewer tokens can make up for slower tokens. The second is engineering. Z.ai says GLM-5.4 reaches up to 200 tokens per second off-peak and 70–80 at peak load, and that getting there took kernel fusion and close co-design with its serving stack.

Fixed loop counts are the norm in released models: two passes for GLM-5.4 and SenseNova-Loop-9B, three for Inkling 2 Mini. Adaptive depth, where harder tokens get more passes, runs through the research from the Universal Transformer’s halting mechanism to the routers of Mixture-of-Recursions, and Z.ai lists it as an open question. Runtime support is also young: mainline llama.cpp gained Inkling 2 Mini’s looped architecture in build b12600 on 20 November 2026, and SenseNova-Loop-9B ships its own modeling code on Hugging Face (trust_remote_code), with GGUF, SGLang and vLLM instructions that point to a llama.cpp fork and still-open pull requests rather than mainline releases. Confirm that your serving engine supports a specific looped model before planning around it.

07

Loop transformer vs mixture of experts

A mixture of experts makes a model wider: it stores many expert feed-forward networks and a router activates only a few per token, so stored parameters far exceed active ones. Looping makes a model deeper: it reuses one block, so effective parameters exceed stored ones. MoE spends memory to save compute; looping spends compute to save memory.

The two combine. Inkling 2 Mini is a 24-layer MoE that activates 8 of 128 experts per token and also loops its middle layers. GLM-5.4 loops 28 layers of the GLM-5 base, an MoE whose published configuration routes each token to 8 of 256 experts. For models like these, three numbers matter: total stored parameters for memory, active parameters per pass, and effective active parameters for speed.

08

Not the same as an agent loop or a thinking loop

Loop engineering is a different subject. It designs the act–observe–refine cycle an AI agent runs across many model calls and tool calls, with stopping conditions and budgets set by the application. A loop transformer’s loop runs inside a single forward pass, for every token, and the model itself fixes how many passes happen. You can run an agent loop on a looped model, but the two are independent choices.

The word also turns up in a third sense. Z.ai’s post warns that GLM-5.4 tends to get caught in overly long “marathon thinking” loops, meaning long visible reasoning in its output. That is behaviour, not architecture, and it is the kind of runaway an agent’s step and token budgets exist to contain.

09

How it works

  1. 01

    Prelude layers run once

    The token’s embedding passes through the first layers as normal. In Inkling 2 Mini these are layers 0 to 5; in SenseNova-Loop-9B, layers 0 to 3.

  2. 02

    The shared block runs several times

    The looped block processes the hidden state, then runs again with the same weights, building on what the previous pass produced: twice in GLM-5.4 and SenseNova-Loop-9B, three times in Inkling 2 Mini. SenseNova feeds each pass’s output straight into the next; llama.cpp’s Inkling 2 Mini code restarts each pass from the prelude output and mixes in the previous pass’s results.

  3. 03

    Updates are merged with care

    Repeated passes can inflate activations. GLM-5.4 adds per-token gates for each iteration that control how much of each pass is written back to the residual stream.

  4. 04

    Coda layers produce the output

    The refined state passes through the remaining layers once, and the model predicts the next token exactly as a standard transformer would.

10

Loop Transformer Models Compared

Released and research looped models as of 23 November 2026, from model cards, the Z.ai launch post and the papers cited above. Effective figures and capability claims are the publishers’ own.

ModelReleasedStored sizeWhat loopsPer-token depth or sizeWeights
GLM-5.4 (Z.ai)23 Nov 2026Not stated; Z.ai describes it at the “750B scale”28 layers of the GLM-5 base, two iterationsZ.ai claims 2T–3T-class intelligence; only head-to-head win rates published, no benchmark scoresNot released; planned after safety hardening. GLM Coding Plan, ZCode and Z.ai Chat now; API coming soon
Inkling 2 Mini (Thinking Machines)20 Nov 202626.4B total, 3.4B active (MoE)Layers 6–17 of 24, three passes48 layer applications; 5.4B effective activeOpen, Apache 2.0
SenseNova-Loop-9B17 Nov 2026About 9BLayers 4–27 of 32, two passes56 layer executions; about 14.6B inference-equivalentOpen, Apache 2.0
Ouro 1.4B and 2.6B (ByteDance)Oct 20251.4B and 2.6BShared layer stack with learned depth allocationAuthors report matching models of up to 12BOpen, Apache 2.0
Huginn-0125 (recurrent depth)Feb 2025 paper3.5BOne recurrent block, unrolled to any depth at test timeUp to the compute of a 50B-parameter model, per the paperOpen, Apache 2.0
11
How VDF AI fits

From concept to a governed, on-premise reality

VDF AI does not build or ship a looped model; it gives you a governed place to run one you have chosen. VDF AI Chat and VDF AI Agents accept any OpenAI-compatible endpoint, so an open-weight looped model served by an engine such as llama.cpp can be attached per agent, and the VDF AI Router registers Ollama and custom on-prem deployments alongside cloud models, with allow and deny lists and an air-gap mode that restricts routing to local models. Because a looped model’s speed and cache use follow its effective depth rather than its file size, benchmark it on your own hardware before routing production work to it.

12

Frequently asked questions

What is a loop transformer?

It is a transformer that runs a block of its layers more than once for each token, reusing the same weights on every pass. Each pass refines the hidden state from the one before, so the model computes as if it were deeper while storing no extra parameters. Looped transformer, looped language model and recurrent-depth model are other names for the same design.

Is a looped transformer the same as a recurrent neural network?

No. An RNN repeats its computation across time, carrying a state from one token to the next. A looped transformer repeats across depth: the same layers are applied several times to one position’s state, while attention still connects all tokens and prompts are processed in parallel. Both reuse weights, but the recurrence runs along a different axis.

What does “effective parameters” mean for a looped model?

It counts each layer application rather than each stored weight, so a block that runs three times counts three times. Inkling 2 Mini activates 3.4B stored parameters per token but 5.4B effective ones. Use the stored figure to size weight memory and the effective figure to estimate compute and generation speed.

Does looping increase KV cache memory?

It can. If every pass keeps its own keys and values, cache for the looped attention layers grows with the loop count; llama.cpp’s Inkling 2 Mini code works this way. Designs such as GLM-5.4’s hybrid cache reuse the first pass’s cache and add only a sliding window for later passes, which keeps the increase small.

How is a loop transformer different from mixture of experts?

They pull in opposite directions. Mixture of experts stores many expert networks and activates a few per token, so it has more stored than active parameters. A loop transformer reuses one block several times, so it has more effective than stored parameters. Some models, including Inkling 2 Mini and GLM-5.4, combine both.

Is a loop transformer related to agent loops?

No. Loop engineering designs the cycle an AI agent runs across many model and tool calls, with stopping conditions and budgets. A loop transformer’s repetition happens inside one forward pass for each token and is fixed by the model’s architecture. An agent can run on a looped model, but the two are separate choices.

Are GLM-5.4’s weights open?

Not as of 23 November 2026. Z.ai made GLM-5.4 available to GLM Coding Plan users, in ZCode and in Z.ai Chat, listed its API as coming soon (its documentation says after a security assessment), and said it plans to release the weights after safety hardening, without a date. Inkling 2 Mini and SenseNova-Loop-9B, by contrast, are open-weight looped models under Apache 2.0.

See it in your environment

Put these concepts to work on infrastructure you control.

VDF AI runs governed agents, private retrieval, and model routing inside your own cloud, data center, or air-gapped network — or start free in our managed cloud today. Book a walkthrough mapped to your stack.