Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

LoopRes: Convert Pretrained LLMs to Recurrent Transformers with 29% Performance Boost

NUS-HPC-AI-Lab's LoopRes method enables converting any pretrained LLM into a recurrent Transformer via fine-tuning, using Kimi's attention residuals with loop-aware keys and residual windows, achieving 29% improvement on Qwen3-1.7B and allowing 4B models to outperform 8B baselines.

Background: Recurrent Transformers and the LoopRes Method

Recurrent Transformer architectures have gained attention recently, with releases like Thinking Machines Lab's Inkling 2 Mini and Zhipu's GLM-5.4. However, obtaining a recurrent LLM typically requires training from scratch. The LoopRes method, developed by You Yang's team at NUS-HPC-AI-Lab, converts any pretrained LLM into a recurrent model via fine-tuning alone, delivering significant and stable performance gains.

Huginn Recurrent Architecture

The team adopts Huginn's recurrent architecture, dividing a pretrained model's layers into three parts: Prelude (executed once), Core (repeated L times), and Coda (executed once). Reusing Core layer weights increases computational depth without adding parameters. Traditional recurrent architectures pass only the final output of one loop to the next, limiting inter-loop information exchange.

Figure 1: Huginn's closed-loop architecture showing Prelude, Core, and Coda layers.
Figure 1: Huginn's closed-loop architecture showing Prelude, Core, and Coda layers.

Problems with Directly Applying Kimi's AttnRes

To improve inter-loop communication, the researchers applied Kimi's Attention Residual (AttnRes) mechanism to the Core layers, allowing each sub-layer to attend to outputs from all previous loops via weighted aggregation. However, they identified three issues:

Indistinguishable loop outputs: Because the same layers are reused, outputs across loops become highly similar, making it harder for the model to differentiate information as loop count increases (Figure 2a, b, d).

Premature attention convergence: The query norm reaches its final value within the first third of fine-tuning, causing the model to fix its information-flow pattern too early (Figure 2c).

Skipping intermediate loops: As accessible history grows, the model tends to read early-loop outputs directly. When loops increase from 3 to 7, the weight of the full propagation path drops from 33.7% to 0.05% (Figure 2e).

Figure 2: Visualization of AttnRes in recurrent models showing the three problems.
Figure 2: Visualization of AttnRes in recurrent models showing the three problems.

LoopRes Improvements

1. Loop-Aware Keys

Original AttnRes generates content keys from historical outputs. LoopRes introduces a trainable loop-aware key for each layer block in each loop, encoding both loop index and layer-block position. This lets attention weights consider both content relevance and structural position. Because loop-aware keys are directly optimized during fine-tuning, the model can distinguish loop outputs early, mitigating premature convergence.

Figure 3: How recurrent layers use previous layer outputs as input, highlighting one layer's input across up to 3 loops.
Figure 3: How recurrent layers use previous layer outputs as input, highlighting one layer's input across up to 3 loops.

2. Residual Window

LoopRes restricts each sub-layer to access only the most recent W loops' outputs (default W=1), while retaining the Prelude output and current-loop information. This prevents skipping intermediate loops, avoids dilution of attention weights by growing history, and controls memory, compute, and communication overhead. The team also fused the computation into a single Triton kernel inspired by FlashAttention, reducing HBM reads/writes.

Figure 4: PyTorch-style pseudocode for LoopRes. Blue lines mark the two improvements: loop-aware keys per input source and residual window of size W.
Figure 4: PyTorch-style pseudocode for LoopRes. Blue lines mark the two improvements: loop-aware keys per input source and residual window of size W.

Experimental Results

Experiments compare LoopRes against standard SFT and eight recurrent baselines (Huginn, Ouro, Hyperloop, CloseLoop, BRT, etc.) using identical data and hyperparameters.

Main Experiment (Qwen3-1.7B-Base)

At 2× per-token compute: LoopRes average score 55.8, a 29.1% improvement over SFT; best baseline BRT only +13.9%.

At 4× compute: LoopRes reaches 57.8, a 33.7% improvement over SFT.

Unlike some baselines that plateau or degrade with more loops, LoopRes effectively converts extra compute into performance gains.

Scalability Experiment

LoopRes adapts to different model sizes and architectures. Notably, Qwen3-4B-Base with LoopRes outperforms standard SFT on Qwen3-8B-Base on five challenging benchmarks at 2× compute.

Scalability results: LoopRes across model sizes.
Scalability results: LoopRes across model sizes.
Additional scalability comparison charts.
Additional scalability comparison charts.

Loop Count vs. Performance

Increasing the thinking budget from 1K to 30K tokens shows LoopRes's performance curve is steeper than SFT, achieving higher scores with less compute in long-output scenarios and breaking SFT's performance ceiling. However, gains saturate after 5 loops; 3 loops offer the best performance-cost trade-off .

Performance vs. thinking budget (tokens) for LoopRes vs. SFT on 1.7B model.
Performance vs. thinking budget (tokens) for LoopRes vs. SFT on 1.7B model.

Open-Source Release

The team has fully open-sourced LoopRes code, training data, and model weights at https://github.com/NUS-HPC-AI-Lab/LoopRes (ArXiv: 2611.31094), enabling further exploration of recurrent Transformer potential.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

LLM fine-tuningKimiattention residualHuginnloop-aware keyLoopResrecurrent Transformerresidual window

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion