A Detailed Look at ARLoop in Transformer Architecture
- ARLoop (Attention-Residual Looped Transformer) is a recurrent-depth transformer architecture designed to enhance model performance by allowing each effective sublayer to selectively aggregate representations from earlier depths using learned attention residuals.
- ARLoop demonstrates significant improvements in validation perplexity, mathematical reasoning, and code-generation tasks, as shown in controlled and large-scale pretraining experiments, particularly in tasks like GSM8K and HumanEval.
- The architecture uses depth-history windows and attention residues to balance computational efficiency and depth utilization
ARLoop, or Attention-Residual Looped Transformer, is a recurrent-depth transformer architecture in which a shared transformer stack is applied multiple times while each effective sublayer selectively aggregates representations from earlier recurrent depths through learned attention residuals. It addresses the limitation of conventional residual connections, which combine preceding updates into a single stream with fixed unit coefficients. ARLoop introduces explicit control over which residual representations are reused, and reports improvements in validation perplexity, mathematical reasoning, and code-generation performance across controlled and large-scale pretraining experiments (Yao et al., 3 Nov 2026).
1. Recurrent-depth transformer architecture
A looped transformer repeatedly applies a parameterized stack :
where , is the token-embedding matrix, is sequence length, is hidden size, and is the number of recurrences. If the shared stack has physical transformer layers, the resulting network has effective depth transformer layers, or $2LR$ attention and feed-forward sublayers, while retaining only distinct parameterized layers.
This parameter sharing increases computation and effective depth without a proportional increase in parameter count. It also provides an explicit recurrent computation axis. However, repeatedly applying the same stack introduces a distinction between parameter depth, determined by , and effective recurrent depth, determined by .
In a conventional PreNorm transformer, an effective sublayer updates the hidden state as
Writing the sublayer update as
gives
Every previous update therefore enters every later state with the same coefficient, namely $1$. At high recurrent depths, the residual stream repeatedly accumulates updates, without allowing later layers to explicitly select, suppress, or reweight individual earlier representations.
Prior looped-transformer designs, including Sandwich-Norm, DeepLoop, and Parcae, primarily address recurrent stability through normalization, residual scaling, or explicit state-transition mechanisms. ARLoop instead focuses on selective access to the residual history.
2. Attention residuals
ARLoop replaces fixed residual addition with attention over representations produced at earlier effective depths. The input embedding is treated as a permanent residual source:
For effective sublayer , the newly computed update is
A learned query vector determines the importance of each available residual source. The attention weight for source is
with
The residual state becomes
In implementations, learned query and key projections are used for the depth-attention computation. Conceptually, the score can be written as
followed by a softmax over the accessible depth sources.
The distinction is therefore:
whereas
The embedding is always included as a special source. Each effective sublayer has its own depth-attention query and normalization parameters.
Depth attention is causal in the recurrent-depth direction. At depth , the model can access the embedding and representations produced at depths , but not future residual sources. Token-level self-attention remains causal over sequence positions. A model trained only up to a specified recurrence range has depth-query parameters learned only through that effective depth; recurrence extrapolation therefore requires additional query parameters or an extrapolation rule.
3. Block residuals and depth-history windows
Maintaining a distinct residual source after every effective sublayer would make the number of depth-attention sources grow linearly with effective depth. ARLoop reduces this cost by grouping consecutive sublayers into residual blocks.
For a block containing consecutive sublayers,
Within a block, residual updates are accumulated additively. Attention is applied across completed blocks and the current partial block. The embedding is represented as .
The controlled configurations use two residual blocks per recurrence:
- At 140M parameters, , each recurrence has $12$ sublayers, and .
- At 370M parameters, , each recurrence has $24$ sublayers, and .
- ARLoop-0.6B uses and .
- ARLoop-1.2B uses and .
Two depth-history mechanisms are evaluated. Full-history attention exposes all available residual blocks,
Sliding-window attention retains the embedding and only the most recent residual blocks:
The default configuration uses , so the embedding and three recent blocks remain directly accessible.
The paper reports that, in a 140M model at , the embedding and three most recent blocks receive approximately of the depth-attention mass at a representative late sublayer. Repeated applications of the same shared stack also produce residual blocks with high pairwise cosine similarity. This suggests that later recurrent representations are often refinements of earlier ones, making unrestricted access to distant blocks less useful and potentially introducing interference.
The matched-depth comparison illustrates the difference between recurrent and non-recurrent models:
| Architecture | Full-history PPL | Sliding-window PPL | Change |
|---|---|---|---|
| , looped | 16.07 | 16.03 | -0.04 |
| , non-recurrent | 13.65 | 16.78 | +3.13 |
The sliding window slightly improves the looped model but substantially harms the ordinary deep transformer. The reported block-window ablation at 140M and gives perplexities of 16.17, 16.03, 16.07, and 16.14 for , respectively. The authors use full history for and sliding-window attention for .
The result is empirical rather than universal: full history is better than the windowed variant in some shallow settings, including the 140M model at .
4. Controlled experiments and baseline comparisons
Controlled experiments use decoder-only models with 140M and 370M parameters. The models use causal multi-head attention, ReLU MLPs, RoPE with , RMSNorm with , tied input and output embeddings, BF16 mixed precision, AdamW, gradient clipping, cosine learning-rate decay, packed FineWeb-Edu sequences, and a context length of 2,048.
The principal baselines are:
- PreNormLoop, using ordinary residual addition.
- Sandwich-Norm, which normalizes the residual sum.
- DeepLoop, which uses recurrent-depth residual scaling and normalization.
- Parcae, which models recurrence as a stable state transition, evaluated with and without input injection.
All methods also use gated value residuals, in which token embeddings are injected into attention value vectors at alternating effective layers. An ablation indicates that ARLoop’s gains are not attributable solely to value residuals: ARLoop continues to outperform the other methods without them, although removing value residuals substantially damages the sliding-window variant and can destabilize Sandwich-Norm.
The main validation perplexities are:
| Model | 140M | 140M | 140M | 370M | 370M |
|---|---|---|---|---|---|
| Sandwich-Norm | 18.98 | 17.19 | 16.59 | 13.92 | 12.97 |
| DeepLoop | 18.72 | 17.05 | 16.52 | 13.69 | 12.78 |
| Parcae, no injection | 18.37 | 16.60 | 16.01 | 13.55 | 12.31 |
| Parcae, injection | 18.37 | 16.55 | 15.96 | 13.55 | 12.30 |
| PreNormLoop | 18.37 | 16.91 | 16.34 | 13.55 | 12.48 |
| ARLoop | 18.26 | 16.38 | 15.84 | 13.32 | 12.17 |
Relative to PreNormLoop, ARLoop improves perplexity by 0.11 at 140M with , 0.53 at , 0.50 at , 0.23 at 370M with , and 0.31 at . The larger improvements at higher recurrence support the interpretation that attention residuals enable more effective use of additional recurrent computation.
The full-history and sliding-window comparison shows that windowed attention generally becomes more competitive as recurrence increases. At 140M and , full-history and windowed ARLoop obtain perplexities of 16.46 and 16.38, respectively, compared with 16.91 for PreNormLoop. At 140M and , the corresponding values are 16.07, 16.03, and 16.59. At 370M and , they are 12.27, 12.17, and 12.48.
The paper also compares fixed recurrence with Poisson-sampled recurrence,
For both model sizes, fixed training performs better when evaluated at $R=4`. At 140M, fixed recurrence achieves perplexity 16.07 and downstream average 44.09, compared with 16.69 and 43.24 for Poisson per-sequence sampling. At 370M, fixed recurrence achieves 12.01 and 50.93, compared with 12.33 and 49.62.
These results do not establish that dynamic recurrence is generally inferior; dynamic recurrence enables flexible compute allocation, whereas the reported main experiments use fixed recurrence.
5. Large-scale pretraining and downstream performance
The large-scale models use grouped-query attention, SwiGLU MLPs, RMSNorm, RoPE with , a context length of 4,096, the SmolLM2 tokenizer with vocabulary size 49,152, tied input and output embeddings, BF16 training, fixed , and sliding-window depth attention with the embedding plus three recent residual blocks.
The configurations are:
| Model | Parameters | Physical layers | Recurrences | Effective sublayers | Training tokens |
|---|---|---|---|---|---|
| PreNormLoop-0.6B | 0.6B | 18 | 3 | 108 | 180B |
| ARLoop-0.6B | 0.6B | 18 | 3 | 108 | 180B |
| ARLoop-1.2B | 1.2B | 24 | 3 | 144 | 500B |
Training uses FineWeb-Edu, FineMath, Stack-Edu, coding data, and later-stage mathematical and reasoning data. The training recipe is divided into three stages: 60% of tokens in Stage 1, 20% in Stage 2, and 20% in Stage 3. Later stages increase the proportions of math, code, and reasoning-oriented data.
The matched 0.6B comparison is:
| Model | ARC-Challenge | HellaSwag | WinoGrande | OpenBookQA | GSM8K | MATH | MBPP | HumanEval |
|---|---|---|---|---|---|---|---|---|
| PreNormLoop-0.6B | 46.3 | 60.6 | 61.2 | 39.8 | 35.7 | 20.9 | 33.1 | 17.6 |
| ARLoop-0.6B | 45.5 | 62.5 | 61.8 | 40.8 | 40.9 | 26.3 | 36.2 | 20.1 |
ARLoop improves on seven of eight tasks. The largest improvements are on GSM8K, from 35.7 to 40.9; MATH, from 20.9 to 26.3; MBPP, from 33.1 to 36.2; and HumanEval, from 17.6 to 20.1. ARC-Challenge decreases from 46.3 to 45.5.
ARLoop-1.2B obtains:
| Task | Score |
|---|---|
| ARC-Challenge | 56.3 |
| HellaSwag | 71.5 |
| WinoGrande | 66.8 |
| OpenBookQA | 45.5 |
| GSM8K | 63.1 |
| MATH | 37.8 |
| MBPP | 52.1 |
| HumanEval | 33.1 |
The reported ARLoop-1.2B model outperforms the listed Huginn-3.5B checkpoints on all eight evaluated tasks. It also matches or exceeds the listed Qwen3.5-2B scores on all eight tasks under the reported comparison. These comparisons are practical reference points rather than fully controlled architectural comparisons because the models differ in parameter count, tokenizer, training data, recurrence configuration, and training budget.
The 1.2B model is reported as being pretrained on 0.5T tokens with three recurrences. The supplied experimental configuration also lists 500B training tokens for ARLoop-1.2B. Training required approximately two weeks on 16 B200 GPUs, whereas the 0.6B runs required roughly one week on eight H100 GPUs.
6. Mechanistic interpretation, efficiency, and limitations
Causal interventions are used to examine the contribution of individual effective layers. If and denote attention and MLP outputs at effective layer and token position , the local contribution is
After ablating layer , the layer-to-layer influence on a later layer is
The output effect is
On MATH and MBPP, later recurrences of ARLoop have larger effects on subsequent computation than corresponding later recurrences of PreNormLoop. This is consistent with ARLoop using additional effective depth more substantially, although the intervention results do not establish that attention residuals are the sole cause of downstream gains.
ARLoop has essentially the same training memory as PreNormLoop in the reported configurations because residual sources are already retained for backpropagation when activation checkpointing is not enabled. Its primary cost is additional memory traffic and depth-attention computation. At , the paper reports approximately 15% lower throughput than PreNorm for full-history attention and roughly 10% lower throughput for sliding-window attention, with negligible additional memory in the tested setups.
Several conclusions remain conditional. The explanation that sliding windows work because recurrent representations are redundant is supported by attention-weight and cosine-similarity analyses, but redundancy is not established as the sole causal mechanism. Three residual blocks are an effective reported default, not a universal optimum. The large-model comparisons do not isolate architecture from data quantity or data quality. The experiments also do not establish useful recurrence extrapolation beyond the training range.
ARLoop’s central architectural claim is that parameter-efficient recurrent depth benefits from selective control over information flow across repetitions. Repeated shared layers alone provide additional computation, but attention residuals allow each effective sublayer to determine which earlier recurrent representations should be preserved, suppressed, or emphasized. The reported results indicate that this mechanism improves looped-transformer performance, particularly at larger recurrent depths, while a small recent-history window can preserve most of the benefit and reduce the cost of unrestricted residual-history attention.