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.
Figures & tables
Figure 1: StateLoop architecture. (a) The looped model with a persistent state per token. (b) State update, optional token mixing, and readout. Ws→z feeds the next iteration, whereas Ws→out supplies the final prediction.
Parameters
Perplexity ↓
Model
Params (M)
vs. Vanilla Looped
Pile
LAMBADA OAI
WikiText-2
Vanilla Looped
1420.92
0.00%
7.79
6.94
16.50
Vanilla Looped + FFN
1467.22
+3.26%
7.75
7.00
16.34
Hyperloop
1421.32
+0.03%
7.77
6.84
16.66
MeSH
1421.51
+0.04%
7.74
6.77
16.43
PonderLM
1420.92
0.00%
7.85
7.31
16.72
Table 1: Language-modeling PPL at 1.4B (30B training tokens). Full-backbone models use K=4 , with MeSH and Parcae matched at 96 layer applications. LAMBADA-OpenAI uses zero-shot token PPL and WikiText-2 uses word PPL.
Model
LAMBADA OAI
ARC-E
ARC-C
WinoG.
PIQA
Hella.
SciQ
RACE
Avg-8
Zero-shot
Vanilla Looped
58.24
52.57
28.16
54.85
70.02
50.39
77.90
34.35
53.31
Vanilla Looped + FFN
59.05
50.93
26.71
56.91
69.42
50.50
75.60
33.68
52.85
Hyperloop
61.28
51.05
27.56
55.72
70.46
49.69
80.70
34.16
53.83
MeSH
60.94
50.88
26.62
59.67
69.70
50.52
78.10
34.55
53.87
PonderLM
58.26
50.59
28.58
55.41
68.93
48.96
78.00
33.68
52.80
Table 2: Zero-shot and five-shot accuracy (%) at 1.4B after 30B training tokens. Full-backbone models use K=4 ; MeSH and Parcae match their 96 layer applications. Avg-8 is the unweighted eight-task mean. LAMBADA-OAI denotes LAMBADA-OpenAI.
Figure 2: Loop depth and Pile PPL at 410M. Models are trained for 25B tokens at each plotted K . StateLoop uses identity mixing and d=ds=1024 . The PPL advantage over Vanilla Looped grows with trained loop depth.
Model
Params (M)
K
Latency (ms/token) ↓
Throughput (tok/s) ↑
Latency change
Vanilla Looped
1420.92
4
121.224 ± 1.099
8.249
baseline
Vanilla Looped
1420.92
5
151.527 ± 1.064
6.599
+24.997%
Vanilla Looped + FFN
1467.22
4
121.167 ± 1.293
8.253
−0.047%
StateLoop
1437.71
4
122.943 ± 1.483
8.134
+1.418%
StateLoop + Attn
1454.49
4
123.778 ± 1.348
8.079
+2.106%
StateLoop + Mamba-2
1467.23
4
123.397 ± 0.923
8.104
+1.792%
Table 3: Decoding efficiency at 1.4B. Measurements use BF16, batch size 1, and a 1,024-token prefill followed by a 1,024-token continuation on one GPU. Latency is mean ± standard deviation over five runs; changes are relative to Vanilla Looped at K=4 .
Figure 3: State width at 410M ( K=7 , 25B tokens). Pile PPL versus parameter overhead for identity mixing and backbone width d=1024 . Points are labeled with state width ds and PPL; overhead is relative to the 406.90M-parameter Vanilla Looped baseline.
Ablation
Variant
Params (M)
PPL ↓
Feedback
State only
409.00
9.44
StateLoop
411.10
9.04
Persistence
Reset state
411.10
9.25
Persistent state
411.10
9.04
Update rule
Vanilla Looped
406.90
9.34
StateLoop (GRU)
416.34
9.09
Table 4: Persistent-state ablations on Pile at 410M. All models use K=7 and 25B training tokens. State variants use ds=1024 and identity mixing. State-only feedback uses the recurrent state as the next backbone input, whereas reset state sets the previous state to zero before each update. The GRU variant replaces the selective-SSM update while keeping feedback and final readout unchanged. Parameter counts are in millions.
Figure 4: State analysis at 410M ( K=7 , identity mixing). Evaluated on the full Pile validation set. (a) Shapley shares of the NLL increase from masking reads. (b) Calibrated single replacement versus frozen-state reuse; the dashed line marks the unmodified model.