arXiv:2610.35544cs.CLOct 2026

Manuscript Offprint

arXiv:2610.35544

StateLoop: Persistent State for Looped Transformers

Feichen Song, Boyi Zeng, He Li, Shixiang Song, Yiqin Hao, Zitong Wang, Yizhou Yang, Yifan Liu, Ziwei He, Zhouhan Lin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

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.

1. Introduction

Looped Transformers increase computation by repeatedly applying a shared backbone (Dehghani et al., 2019). Saunshi et al. (2025) show that looped models improve language modeling over non-looped models with the same number of parameters. Ouro demonstrates this approach at larger scale, with 1.4B and 2.6B looped models achieving performance comparable to larger standard Transformers across downstream benchmarks (Zhu et al., 2025).

The design of connections between iterations is a central architectural consideration in looped Transformers. Vanilla looped Transformers use each backbone output directly as the input to the next iteration. As Pagliardini et al. (2024) show, DenseFormer achieves lower perplexity when later layers can access much earlier outputs than when access is restricted to recent outputs. This finding motivates the hypothesis that information produced in one iteration may likewise remain useful several iterations later. In vanilla looped Transformers, retaining such information across iterations relies entirely on the same hidden state that also supplies the input for subsequent backbone computation.

We therefore propose StateLoop, which maintains an additional persistent state for each token. The state is carried across iterations and updated by combining its previous value with a projection of the backbone output. A gate determined by the same output controls how much of the previous state is retained and how much new information is written. An optional state mixer uses causal attention or Mamba-2 to exchange information across token positions before readout. The updated state is projected back and added to the backbone output, making the retained information available to later iterations and final prediction.

We evaluate StateLoop at 410M and 1.4B scales to assess both its performance and the contribution of the persistent state. Compared with Vanilla Looped, StateLoop reduces Pile perplexity by 0.18 and improves average accuracy across eight zero-shot tasks by 0.97 percentage points at 1.4B. Adding causal attention and Mamba-2 state mixers further increases the accuracy gains over Vanilla Looped to 1.43 and 1.44 percentage points, respectively. We further analyze the role of the persistent state. Resetting the state at every iteration increases perplexity, supporting the value of carrying information across iterations. Moreover, StateLoop’s advantage over Vanilla Looped grows with trained loop depth, suggesting that persistent state becomes increasingly useful as recurrent computation deepens.

References (30)