Interview Lab
How can a 24-layer Transformer run 48 layer applications per token?
Inkling 2 Mini stores a 6-layer prelude, 12 middle layers, and a 6-layer final block. For one next-token prediction, it runs the middle layers 3 times and the outer blocks once each. Thinking Machines Lab architecture notes
Follow what stays fixed and what changes across the three passes.
Animated solution
Follow one next-token prediction
Inkling 2 Mini
Token embeddings
Input token IDs → hidden states
Block 1 · Prelude
Layers 1–6 · runs once
Blocks 2–3 · Shared middle
Layers 7–18 · three passes
Block 4 · Final block
Layers 19–24 · runs once
Output head
Hidden states → next-token logits
- Layers with stored weights
- 24
- Layer applications so far
- 0 / 48
The prelude runs once.
Its output is available to all three middle passes.
Worked solution
24 layers with distinct weights, 48 layer applications per token.
- Count each layer’s weights once. The stored depth is 6 + 12 + 6 = 24.
- Count every execution. The middle layers run 3 times, so the forward pass performs 6 + 3 × 12 + 6 = 48 layer applications.
- Inside the loop, each pass updates the hidden representations. Inkling 2 Mini feeds the prelude output to every pass and carries a learned message from the previous pass. These internal passes happen before the model produces next-token logits.
More passes add sequential computation while reusing stored weights. The layer count alone does not predict wall-clock latency or cache memory. Those also depend on the kernels, hardware, and what the model caches across passes.
Models that loop through depth
The example above uses Inkling 2 Mini. The original Inkling checkpoint in Architecture Explorer is a different model. Thinking Machines also published a variable-loop research checkpoint. TML-d24-varloop-research
Inkling 2 Mini
Repeats its middle 12 layers three times. The first and last six layers run once each.
GLM-5.4
Runs a shared 28-layer block twice. Z.ai describes reusing sparse-attention indices and selected KV entries across passes, with a separate sliding-window cache for the second pass.
Huginn
A recurrent core can run for different numbers of steps at inference time.
Ouro
A family of looped language models pretrained with repeated latent computation and a learned depth-allocation objective. The paper reports results with four recurrent steps.
Research papers
- Dehghani et al. (2018) introduced depth recurrence with an adaptive per-position halting mechanism. Universal Transformers
- Geiping et al. (2025) trained Huginn to vary how much computation it spends within a token at inference time. A Recurrent Depth Approach
- Zhu et al. (2025) studied pretraining looped language models and allocating compute across tokens. Scaling Latent Reasoning via Looped Language Models