TL;DR
This paper introduces a training-free method to retrofit recurrence into frozen, off-the-shelf Large Language Models (LLMs) at inference time. By treating a mid-stack block of transformer layers as a forward Euler step of an Ordinary Differential Equation (ODE), the authors implement a lightweight wrapper that executes damped sub-steps to refine the model's representations. This simple inference-time modification consistently boosts performance on knowledge-heavy benchmarks without any fine-tuning, extra parameters, or architectural changes.
What Problem Does This Paper Address?
While recurrent or "looped" transformers have shown great promise for efficiency and length generalization, existing approaches require training the network with this looped structure from scratch. Consequently, recurrence cannot be applied to the vast majority of publicly available, state-of-the-art open-weight models (like Llama or Qwen), which are trained as standard deep feed-forward stacks.
If you naively take a block of layers in a pretrained model and run it multiple times sequentially at inference time, performance collapses. This happens because the hidden states quickly drift outside the activation distribution the subsequent layers were trained to handle. This paper addresses a fundamental question: Can we exploit the inherent layer redundancy of frozen, off-the-shelf LLMs to safely inject recurrence at test time and unlock latent reasoning capabilities?
Methods
The authors bridge the gap between deep feed-forward networks and recurrence using numerical analysis. A standard pre-norm transformer layer adds a residual update to its input, which mathematically mirrors a forward Euler integration step with a step size of $h=1$ on an autonomous ODE ($\dot{x} = F(x)$).
Instead of naively repeating a block of layers $K$ times—which effectively integrates the ODE out to $t=K$ and breaks the model—the authors propose sub-stepping. They approximate the exact same $t=1$ endpoint that the model was trained to deliver, but at a finer resolution using $K$ smaller, damped steps of size $h=1/K$.
The paper introduces two primary execution modes for this loop wrapper:
- Block-mode: The entire contiguous window of layers is iterated as a single unit $K$ times.
- Layer-mode: Each individual layer within the window is iterated $K$ times before passing its output to the next layer.
Crucially, the entire mechanism is implemented as a lightweight, training-free monkey-patch on top of standard Hugging Face implementations. It modifies how the KV cache is handled during these iterations via a snapshot-and-restore protocol to prevent memory explosion and attention mask corruption.
Datasets
The method was validated across a comprehensive suite of 45 combinations of models and benchmarks. Evaluation focused heavily on multiple-choice (MC) and question-answering tasks, including:
- MMLU and MMLU-Pro (Massive Multitask Language Understanding)
- GPQA (Graduate-Level Google-Proof Q&A Benchmark)
- ARC-Challenge and ARC-Easy (AI2 Reasoning Challenge)
- CommonsenseQA (CSQA)
- OpenBookQA (OBQA)
- SciQ
- HellaSwag and LAMBADA (for language modeling perplexity)
No new datasets were introduced in this work.
Key Insights and Ideas
- Redundancy Implies Re-applicability: Prior work showed that mid-layers in LLMs can often be deleted with minimal performance loss. The authors flip this perspective: the same redundancy that makes a layer safe to delete also makes it safe to re-apply, provided it is done carefully.
- Staying in the Low-Loss Valley: Damped sub-stepping keeps intermediate activations clustered within the "trained low-loss valley" of the network, whereas naive looping causes states to rapidly diverge into high-loss regions.
- MoE Routing Thrash: In Mixture-of-Experts (MoE) architectures, block-mode looping causes severe instability because slight perturbations in the hidden state cause the gating network to thrash between different experts across iterations. Layer-mode solves this by computing the gating decision once and pinning that expert routing across all $K$ sub-steps.
- The Depth Fraction Rule: Across diverse model families, the optimal location for the loop window is remarkably consistent, sitting squarely in the middle of the network at a fractional depth of roughly 0.45 to 0.60.
Key Results
The training-free loop wrapper provides reliable accuracy boosts on complex, knowledge-heavy tasks across seven distinct model families (including dense, sparse MoE, and MLA architectures):
- Qwen3-4B-Instruct: Achieved a +2.64 percentage point (pp) gain on MMLU-Pro and +2.01 pp on GPQA-Main.
- Qwen1.5-MoE-A2.7B-Chat: Improved by +2.30 pp on ARC-Challenge.
- Moonlight-16B-A3B-Instruct: Gained +1.20 pp on OpenBookQA.
Importantly, when evaluating log-likelihood multiple-choice tasks, the loop can be restricted to the prompt prefill stage (bypass mode). This yields performance gains with 0% wall-clock overhead during token generation. For full autoregressive generation, a 4-layer loop window adds a manageable ~22% latency slowdown.
Limitations and Future Work
- Sub-1B Scale Limitations: The method struggles on very small or heavily distilled models (under 1.7B parameters). These compact models lack the mid-layer structural redundancy required for the loop to be effective, occasionally leading to performance regressions.
- Task Specificity: The largest gains are concentrated on difficult STEM and quantitative reasoning tasks. On simpler, surface-level language tasks, the wrapper acts neutrally.
- Failure of Advanced Solvers: Interestingly, higher-order ODE solvers (like RK4) and fixed-point accelerators (like Anderson acceleration) degraded performance. This indicates that the transformer's underlying vector field is not perfectly smooth or contractive, suggesting that alternative numerical integration strategies tailored specifically to transformer dynamics remain an open area for future research.
Summary updated