Looped Transformers iterate a shared block of layers to increase computation without adding parameters, offering stronger performance and test-time scaling. However, this power has so far required training from scratch and yielded only modest gains for LLMs. Finetuning existing models into loops is far cheaper, yet also brings only marginal gains over SFT. We propose LoopRes, an effective, scalable, and simple approach that turns loops into significant and consistent gains for pretrained LLMs. Building on Attention Residuals, LoopRes lets each looped layer attend directly to the outputs of earlier loops. Since these outputs are iterates of the same layers and become harder to tell apart, we give each a trainable loop-aware key that encodes its structural identity. Attending to all earlier loops also lets layers skip intermediate ones, so we restrict each layer to a residual window of the latest W loops, forcing every loop to build incrementally on recent ones. Across 6 pretrained LLMs from 3 model families and 9 benchmarks, LoopRes delivers significant and consistent gains: at 2x compute, it improves Qwen3-1.7B-Base by 29.1% over SFT, more than doubling the gain of the state-of-the-art baseline. The gains hold on larger models up to 30B and across all three families. More importantly, from 1.7B to 8B, LoopRes scales more steeply than SFT as compute grows, reaching a higher ceiling while needing less compute on long outputs. These results establish LoopRes as an effective looping approach, delivering both better performance and better test-time scaling.
Figures & tables
Figure 1: How a looped layer takes the outputs of earlier layers as input. Each panel diagrams three layers running for up to three loops, highlighting one layer’s input, where ℓi(t) denotes layer i of loop t and dashed layers have not yet run. Loops before t−2 are omitted in (c) and (d). (a) A layer loop iterates each layer through every loop, passing only the previous iteration forward. (b) A stack loop feeds only the last layer of each loop into the first of the next. (c) AttnRes attends to every earlier loop output with content-based weights. (d) LoopRes attends only to a window of the latest W loops (shaded, W=1 here) and adds a loop-aware key alongside the content key. Each bar marks the magnitude of a score term.
Figure 2: Visualization of AttnRes in a looped model. Huginn + AttnRes on Qwen3-1.7B-Base at 2 × compute ( L=3 ) and 4 × compute ( L=7 ). L t B j denotes the output of block j in loop t . (a) Cosine similarity between block outputs across all loops. (b,d) Attention scores from the output query to each source at L=3 and L=7 . Arrow height marks the score. (c) Output query norm over finetuning steps, normalized by its converged value. (e) Weight share on each path from the output back to the first loop, obtained by multiplying the attention weights along the path.
Figure 3: The looped architecture of Huginn. The layers of an LLM are split into a prelude, a core, and a coda. The prelude and the coda run once, and the core runs L times.
method
math
code
avg.
Δ
loss
Δ
AIME25
AIME26
AMC23
Olympiad
MATH500
HE+
MBPP+
SFT
14.6
11.7
48.6
40.7
73.4
57.3
56.2
43.2
–
0.312
–
2 × compute
Huginn
19.6
14.4
54.1
46.5
80.4
64.2
64.0
49.0
13.5% ↑
0.303
2.8% ↓
Ouro
12.5
9.2
47.8
40.4
74.6
59.1
56.6
42.9
0.8% ↓
0.315
1.1% ↑
Hyperloop
18.3
16.7
54.4
47.1
77.6
66.9
60.4
48.8
12.9% ↑
0.303
2.9% ↓
Table 1: Comparison with baselines at 2 × and 4 × compute on Qwen3-1.7B-Base. Compute is measured relative to SFT. HE+ denotes HumanEval+, and both code benchmarks report the plus tests. avg. averages the seven math and code scores. Each Δ column gives a method’s change relative to SFT. Within each compute budget, bold marks the best and underline the second best.
variant
step time (ms)
peak mem. (GiB)
plain residual
1886.3 –
8.56 –
LoopRes
1976.6 0 +4.8%
8.62 0 +0.7%
w/o loop-aware key
1968.9 0 +4.4%
8.62 0 +0.7%
w/o fused kernel
2922.3 +54.9%
12.63 +47.5%
Table 2: Training overhead of LoopRes on Qwen3-1.7B-Base. We report the training step time and the peak activation memory, measured at 16k sequence length.
Figure 4: Average score relative to SFT at 2 × and 4 × compute. Each line connects a design’s change in the average of the seven math and code scores in Table 1 , on Qwen3-1.7B-Base.
Figure 5: Test-time scaling across loop depths. Average score on seven benchmarks against decode compute as the thinking budget grows from 1K to 30K tokens, on Qwen3-1.7B-Base.
method
A25
A26
Oly
IMO
LCB
avg.
Δ
Qwen3-4B-Base
SFT
35.4
38.3
61.6
20.5
27.4
36.6
–
LoopRes
47.1
51.0
68.3
29.6
32.9
45.8
+9.2
Qwen3-8B-Base
SFT
39.6
46.0
65.5
30.9
32.6
42.9
–
Table 3: Results on larger backbones at 2 × compute. On AIME25 and AIME26, OlympiadBench, IMO-AnswerBench, and LiveCodeBenchv6.
backbone
avg.
Δ
SFT
LoopRes
Llama-3.2-1B
14.3
19.6
+5.4
Qwen3.5-2B-Base
52.1
64.1
+12.0
Table 4: Results on Llama-3.2-1B and Qwen3.5-2B-Base at 2 × compute. avg. averages the seven math and code scores, and Δ gives the change of LoopRes relative to SFT in points. Table 11 reports the per-benchmark scores.
variant
2 × compute
4 × compute
avg.
Δ
avg.
Δ
LoopRes
55.8
–
57.8
–
Huginn + AttnRes
53.9
− 1.9
55.0
− 2.8
Residual window (LoopRes: W=1 )
Table 5: Ablation study of LoopRes on Qwen3-1.7B-Base. Each group varies one component from LoopRes (default in gray).
Figure 6: What LoopRes learns. LoopRes on Qwen3-1.7B-Base, averaged over 128 samples. L t B j denotes the output of block j in loop t . (a) Source weights for each block at L=3 . (b) Source weights of B1 and B2 at L=7 , averaged over loops with min–max bars. (c) Contribution of the loop-aware key and the content key to source selection, measured by Shapley values. (d) Tokens ranked by whether their content key steers B2 toward its shallower or deeper output at L=7 .
Figure 7: How LoopRes differs from AttnRes. AttnRes, and AttnRes with W=1 and LoopRes on Qwen3-1.7B-Base over 128 samples at L=3 . (a) Output difference between adjacent loops for each block, measured in standard deviations across tokens. (b) Source weights of L3B2 over earlier blocks, renormalized to exclude the prelude and partial sum. (c) Content-score variance across sources, decomposed into a fixed-preference component and a token-varying component. (d) Token-varying fraction of the content-score variance at loop outputs, for L=3 and L=7 .
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
Backbone
Layers
Prelude / Core / Coda
B
L
W
Qwen3-1.7B-Base
28
7 / 14 / 7
2
3 / 7
1 / 1
Qwen3-4B-Base
36
9 / 18 / 9
2
3 / –
1 / –
Qwen3-8B-Base
36
9 / 18 / 9
2
3 / –
1 / –
Qwen3-30B-A3B-Base
48
12 / 24 / 12
2
3 / –
1 / –
Qwen3.5-2B-Base
24
6 / 12 / 6
2
3 / –
1 / –
Llama-3.2-1B
16
4 / 8 / 4
2
3 / –
1 / –
Appendix
Table 6: Configuration of LoopRes on each backbone. L and W are given at 2× / 4× compute, and – marks a budget not run.
3×10−5 , linear warmup over 3% of steps, cosine decay to 3×10−6
Gradient clipping
1.0
Training steps
12,000
Batch size
16 sequences
Appendix
Table 7: Training hyperparameters , shared by all models.
benchmark
math
code
AIME25
AIME26
AMC23
Olympiad
MATH500
IMO-AB
HE+
MBPP+
LCB
problems
30
30
40
675
500
400
164
378
175
samples per problem
16
16
16
1
1
2
4
2
2
backbones
all
all
< 4B
all
< 4B
≥ 4B
< 4B
< 4B
≥ 4B
Appendix
Table 8: Problems, samples per problem, and evaluated backbones on each benchmark. We average pass@1 over the samples of each problem. HE+ denotes HumanEval+, IMO-AB IMO-AnswerBench, and LCB LiveCodeBench v6.
variant
math
code
avg.
AIME25
AIME26
AMC23
Olympiad
MATH500
HE+
MBPP+
2 × compute
LoopRes
27.9
19.4
64.7
53.8
84.0
71.8
68.9
55.8
Huginn + AttnRes
25.4
19.0
62.3
52.0
82.6
71.2
65.1
53.9
Appendix
Table 9: Per-benchmark scores of the ablation study on Qwen3-1.7B-Base. The variants are those of Table 5 , and LoopRes uses W=1 at both compute budgets. HE+ denotes HumanEval+, and both code benchmarks report the plus tests. avg. averages the seven math and code scores.
depth
math
code
avg.
AIME25
AIME26
AMC23
Olympiad
MATH500
HE+
MBPP+
SFT
14.6
11.7
48.6
40.7
73.4
57.3
56.2
43.2
L=2 (1.5 × )
22.9
15.6
60.6
49.6
83.0
70.1
63.0
52.1
L=3 (2 × )
27.9
19.4
64.7
53.8
84.0
71.8
68.9
55.8
L=5 (3 × )
26.9
22.7
64.8
55.7
85.4
73.0
68.8
56.8
L=7 (4 × )
30.2
24.6
67.5
52.9
84.2
75.3
69.8
57.8
Appendix
Table 10: Per-benchmark scores across loop depths on Qwen3-1.7B-Base. Each row runs the core L times, at the per-token compute in parentheses relative to SFT. HE+ denotes HumanEval+, and both code benchmarks report the plus tests. avg. averages the seven math and code scores. Bold marks the best score of each column.
benchmark
Llama-3.2-1B
Qwen3.5-2B-Base
SFT
LoopRes
SFT
LoopRes
AIME25
0.4
1.0 +0.6
24.6
37.7 +13.1
AIME26
0.2
0.4 +0.2
24.0
41.2 +17.2
AMC23
13.3
22.7 +9.4
64.7
80.9 +16.2
OlympiadBench
9.5
16.6 +7.1
52.0
63.6 +11.6
MATH500
28.4
43.8 +15.4
85.6
89.6 +4.0
Appendix
Table 11: Per-benchmark scores on Llama-3.2-1B and Qwen3.5-2B-Base at 2 × compute. Both code benchmarks report the plus tests. Subscripts give the change of LoopRes relative to SFT in points. avg. averages the seven math and code scores.
Figure 9: Validation loss relative to SFT. We finetune Qwen3-1.7B-Base on code and math with each looped design and subtract the loss of the same model finetuned without looping (SFT), each point averaging 1,000 steps. Panels (a) and (b) give every design the compute of two and four full passes through the model, respectively. Triangles on the top edge mark values above the plotted range.
Figure 20
variant
looped layers
L
avg.
Huginn
core
3
49.0
Huginn + AttnRes
all
2
50.9
Huginn + AttnRes
core
3
53.9
Appendix
Table 12: Huginn variants at 2 × compute on Qwen3-1.7B-Base. core loops the core of a prelude, core, and coda, as in Tables 1 and 5 , and all loops the whole model. avg. averages the seven math and code scores.
setting
math
code
avg.
Δ
AIME25
AIME26
AMC23
Olympiad
MATH500
HE+
MBPP+
SFT, 1 × data
14.6
11.7
48.6
40.7
73.4
57.3
56.2
43.2
–
SFT, 2 × data
20.8
15.2
56.9
45.9
80.2
66.6
60.7
49.5
+6.3
LoopRes, 2 × compute
27.9
19.4
64.7
53.8
84.0
71.8
68.9
55.8
+12.6
LoopRes, 4 × compute
30.2
24.6
67.5
52.9
84.2
75.3
69.8
57.8
+14.6
Appendix
Table 13: Doubling the SFT data against looping on Qwen3-1.7B-Base. Every row is scored under the decoding of Section A.5 with no thinking budget. SFT at 1 × data is read from the final checkpoint at step 12,000 and at 2 × data from the final checkpoint at step 24,000, both at 1 × compute, and the LoopRes rows are those of Table 1 , trained on 1 × data. HE+ denotes HumanEval+, and both code benchmarks report the plus tests. avg. averages the seven math and code scores, and Δ gives the change relative to SFT at 1 × data.
Figure 13: Test-time scaling after doubling the SFT data. Average score on seven math and code benchmarks against decode compute as the thinking budget grows from 1K to 30K tokens, on Qwen3-1.7B-Base. Both curves are SFT, trained on 1 × and 2 × the finetuning data.
Department of Data Science Pusan National University Busan, Republic of Korea · Department of Industrial Engineering Pusan National University Busan, Republic of Korea · Department of Artificial Intelligence Engineering Changwon National University Changwon, Republic of Korea