Looped Transformers increase computation per token by repeatedly applying a shared backbone, offering a way to improve language modeling and downstream task performance at a fixed backbone parameter count. However, each loop depends on the preceding loop, so increasing recurrent depth also increases decoding latency. Existing approaches include Parallel Loop Transformers, which reduce latency by overlapping loop computation across token positions, but yield rapidly diminishing marginal accuracy gains at larger depths. To address this challenge, we introduce LoopFold, which folds computation at multiple recurrent depths into parallel batches for the same token prefix. A lightweight predictor estimates inputs to later loops so they can start before earlier loops finish. A corrector then refines the outputs of these later loops using newly available results from earlier loops. All components are trained jointly using only the final next-token prediction loss. In experiments with 1.4B models, deeper LoopFold configurations achieve progressively higher average zero-shot accuracy across eight tasks, rising from 53.41% to 56.38%. Vanilla looped models and PLT show limited gains over the same depth range. Compared with a nine-loop vanilla model, LoopFold uses five sequential stages and additional parallel computation to reduce decoding latency by 46%.
Figures & tables
Figure 1: LoopFold with schedule 1+3+3 . Three stages and width 3 reach target depth index D=5 using seven backbone evaluations. (a) Predict deeper inputs from H1−H0 . (b) Evaluate three states together and correct using earlier-loop updates. (c) Repeat the stage and predict the next token.
Model
Target depth index D
Backbone evaluations
Sequential stages S
Width n
Vanilla looped model
D
D
D
1
LoopFold
n+S−1
1+n(S−1)
S
n
Table 1: Backbone computation per token (any model size). D : target depth index; S : sequential stages; n : parallel width after the first loop. Evaluations count all parallel lanes.
Figure 2: Parallel width and Pile perplexity in LoopFold (1.4B, 30B training tokens). Each curve fixes sequential stages S and varies width n . Schedule 1+n+⋯+n reaches target depth index D=n+S−1 .
Figure 3: Pile PPL versus training compute and decoding latency (1.4B, 30B tokens). (a) LoopFold: n=2 , S=3 – 6 , ending with 1+2+2+2+2+2 ; vanilla looped: 3–11 loops. (b) LoopFold uses 1+3+3 , 1+4+4+4 , and 1+5+5+5+5 at D=5,7,9 . Timing: batch 1, 1,024-token prompts/continuations, greedy decoding, same GPU, BF16, tensor parallelism disabled.
Model
Training (ZFLOPs)
LAMBADA OAI
ARC-E
ARC-C
Wino
PIQA
Hella
SciQ
RACE
Avg-8
Vanilla Looped
1.20
59.65
52.90
28.24
57.14
69.86
50.55
78.90
32.25
53.69
PLT
57.27
50.42
26.96
54.70
69.26
48.47
79.10
33.11
52.41
Hidden Decoding
54.41
48.23
26.62
52.09
68.99
43.66
75.70
30.33
50.00
LoopFold ( n=2,S=3 )
57.60
53.16
28.16
55.33
69.59
49.57
79.40
33.11
53.24
Vanilla Looped
1.68
60.14
53.32
28.75
57.77
70.35
51.44
77.20
34.64
54.20
PLT
55.89
51.85
27.56
54.70
68.99
47.70
77.80
33.01
52.19
Table 2: Zero-shot accuracy at matched training backbone compute (1.4B, 30B Pile tokens). Vanilla looped models and PLT use 5/7/9 loops; Hidden Decoding uses 5/7/9 streams per token. LoopFold schedules 1+2+2 , 1+2+2+2 , and 1+2+2+2+2 correspond to D=4,5,6 . Accuracy is in percent; Avg-8 is the unweighted mean across eight tasks.
Model
Latency (ms/token)
LAMBADA OAI
ARC-E
ARC-C
Wino
PIQA
Hella
SciQ
RACE
Avg-8
PLT-5
24.93
57.27
50.42
26.96
54.70
69.26
48.47
79.10
33.11
52.41
PLT-7
25.35
55.89
51.85
27.56
54.70
68.99
47.70
77.80
33.01
52.19
PLT-9
25.16
56.84
51.05
27.22
55.41
70.29
47.72
76.30
31.96
52.10
Hidden Decoding-5
23.63
54.41
48.23
26.62
52.09
68.99
43.66
75.70
30.33
50.00
Hidden Decoding-7
23.95
52.92
48.32
25.60
52.49
68.88
43.44
74.70
30.62
49.62
Hidden Decoding-9
23.27
53.19
49.20
26.54
51.78
68.23
43.65
73.40
30.62
49.57
Table 3: Zero-shot accuracy and decoding latency (1.4B, 30B Pile tokens). LoopFold uses 1+3+3 , 1+4+4+4 , and 1+5+5+5+5 at D=5,7,9 , paired with 3/4/5-loop vanilla looped models. PLT/Hidden Decoding suffixes count loops/streams per token. Timing: batch 1, 1,024-token prompts/continuations, greedy decoding, same GPU, BF16, tensor parallelism disabled. Accuracy is in percent; Avg-8 is the unweighted mean across eight tasks.
Figure 4: Mean zero-shot accuracy across target depth indices (1.4B, 30B Pile tokens). At D=5,7,9 , LoopFold uses 1+3+3 , 1+4+4+4 , and 1+5+5+5+5 in 3/4/5 stages; vanilla looped models and PLT use D loops. Accuracy is the unweighted mean (%) across eight tasks.
Model
B=1
B=2
B=4
B=8
B=16
Vanilla Looped D=5
8.14
16.15
31.67
65.31
130.18
LoopFold D=5
13.44
26.24
52.26
105.35
209.12
Speed ratio to vanilla looped model
1.65×
1.62×
1.65×
1.61×
1.61×
Table 4: Decoding throughput at D=5 (1.4B, tokens/s). LoopFold uses 1+3+3 , with seven backbone evaluations in three stages, versus five loops in the vanilla looped model. B is batch size. Timing: 1,024-token prompts/continuations, greedy decoding, same GPU, BF16, tensor parallelism disabled. Speed ratio: LoopFold/vanilla looped throughput at equal B ; blanks indicate unavailable measurements.
Variant
Later-stage KV policy
KV storage
Latency (ms/token)
Pile PPL ↓
No KV sharing
independent cache
7×
99.89
7.62
First-KV reuse
reuse all positions
5×
103.21
7.68
Hard overwrite-64
overwrite most recent 64
5×
104.94
7.63
Table 5: KV sharing (1.4B, 30B Pile tokens, 1+2+2+2 , D=5 ). First-KV reuse retains each depth’s first cache; Hard overwrite-64 also refreshes the latest 64 positions. Storage is relative to one full-backbone cache. Variants train with their inference cache policies. Timing: batch 1, 1,024-token prompts/continuations, greedy decoding, same GPU, BF16, tensor parallelism disabled.
Variant
Initial states
Output correction
Pile PPL ↓
Δ PPL
LoopFold
Jpred
Jcorr
9.13
–
No prediction
repeated H1
Jcorr
9.29
+0.16
No correction
Jpred
none
9.47
+0.34
Table 6: Component ablations (410M, 25B Pile tokens, 1+4+4+4 , D=7 ). Jpred and Jcorr denote prediction and correction. No prediction repeats H1 ; No correction uses raw backbone outputs. Variants train separately; Δ PPL is the increase over the complete model.
Variant
Jpred
Jcorr
Pile PPL ↓
LoopFold
Learned
Learned
9.13
Identity prediction
I
Learned
9.21
Identity correction
Learned
I
9.20
Table 7: Learned versus identity maps (410M, 25B Pile tokens, 1+4+4+4 , D=7 ). Each identity variant fixes prediction Jpred or correction Jcorr at I throughout training, while learning the backbone and the other map.
Variant
Metric
H2 (S1)
H3 (S1 → S2)
H4 (S1 → S2 → S3)
LoopFold
Cosine ↑
0.922
0.774 → 0.811
0.636 → 0.653 → 0.823
Relative L2↓
0.394
0.642 → 0.588
0.809 → 0.792 → 0.573
No prediction
Cosine ↑
0.971
0.874 → 0.924
0.643 → 0.701 → 0.805
Relative L2↓
0.239
0.494 → 0.389
0.777 → 0.726 → 0.594
No correction
Cosine ↑
0.506
0.517 → 0.870
0.234 → 0.224 → 0.414
Relative L2↓
0.866
0.857 → 0.516
0.977 → 1.027 → 0.920
Table 8: Provisional-state evolution (410M, 25B Pile tokens, 1+4+4+4 , D=7 ). Reference states come from each variant’s own sequential backbone on the same input. S1 denotes initialization; arrows mark subsequent stages. Cosine uses full state tensors; relative L2 divides the Frobenius error by the reference state’s norm.
Looped Transformers achieve parameter efficiency by repeatedly executing a shared block across recurrent loops. Each loop yields an intermediate representation decodable for the same next token, yet standard decoding discards earlier states. Because earlier loops embody less computation, recurrence inherently supplies aligned weak-and-strong prediction pairs without auxiliary models or external training. We introduce LoopCD, a training-free contrastive decoding framework that guides token selection by contrasting the final prediction with an earlier recurrent pass, operating either in logit space with one extra output pass (LoopCD-Logits) or in hidden-state space with zero output overhead (LoopCD-Hidden). Across four looped Transformer families, LoopCD delivers substantial, consistent gains at full recurrent depth: LoopCD-Logits raises Ouro-2.6B-Thinking's AIME 2024 pass@1 from 61.88% to 73.33%, while LoopCD-Hidden lifts Huginn's HumanEval pass@1 from 22.56% to 31.71%. Crucially, these performance gains enable halving the number of recurrent loops while still matching or exceeding full-depth unguided baselines, reducing forward FLOPs by 22.5% to 48.2%. By transforming intermediate recurrent states into effective guidance signals, LoopCD achieves superior decoding quality while substantially reducing inference compute.
Looped Transformers offer a parameter-efficient approach to language modeling by repeatedly applying a shared backbone. Vanilla looped Transformers use each backbone output directly as the input to the next iteration. These outputs may contain information useful several iterations later, but retaining it across the loop depends entirely on the single hidden state. We introduce StateLoop, which maintains one additional persistent state per token to retain information across iterations. At each iteration, a learned gate controls how much of the previous state is retained and how much information from the backbone output is incorporated. The updated state is projected back and added to the backbone output for subsequent iterations and final prediction. This design reduces Pile perplexity and improves average accuracy across eight zero-shot tasks over Vanilla Looped. Its perplexity advantage over Vanilla Looped grows with trained loop depth, consistent with persistent state becoming increasingly useful as recurrent computation deepens.
Feichen Song, Boyi Zeng, He Li +7
Shanghai Jiao Tong University · Sun Yat-sen University · Shanghai Innovation Institute
Looped Transformers have attracted substantial attention as a parameter-efficient approach to increasing computational depth through repeated application of shared Transformer blocks. However, their practical advantages over conventional Transformers remain under debate: each additional loop incurs another Transformer pass and requires caching another set of KV states, causing inference FLOPs and KV-cache memory to grow continuously with loop depth. This overhead becomes particularly severe at large loop counts and long context, preventing the parameter efficiency of Looped Transformers from translating into practical inference efficiency. In this paper, we find that much of the additional computation and storage introduced by looping is redundant. As recurrence proceeds, state changes become increasingly concentrated on a small subset of tokens; attention-output differences are dominated by a sparse and stable subset of key columns; and KV residuals between adjacent loops become progressively more amenable to low-bit quantization. Building on these observations, we introduce FlashLoop, a training-free inference framework that reduces cross-loop redundancy through token-sparse updates, sparse attention, and KV-residual quantization. Across several Looped Transformers models, FlashLoop delivers lossless accuracy while achieving up to 1.64× end-to-end speedup and up to 6× KV-cache memory reduction, substantially improving the practicality of scaling Looped Transformers to greater computational depths and longer context.
Wanqi Yang, Shiwei Liu
ELLIS Institute Tübingen Max Planck Institute for Intelligent Systems Tübingen AI Center