arXiv(opens in a new tab)cs.LGSep 2026Cited by 6 papers on PaperVantage

Manuscript Offprint

arXiv:2609.03379

RecurTrace: Adaptive Latent Reasoning with Loop-Time Memory

Yuxiang Wang, Kunyu Feng, Yingda Shen, Haoning Xu, Junyu Wang, Zhizheng Wu

Abstract

Repeating a small block of middle layers increases a language model's effective inference depth without adding parameters or generating extra tokens, and recent work shows that this latent recurrence improves reasoning. However, two design choices limit these gains. Each iteration sees only the previous output and cannot directly access earlier computations. Moreover, a fixed loop count wastes depth on easy inputs while leaving hard ones with too little computation. We introduce RecurTrace, which addresses both limitations using the loop's own trajectory. Specifically, Loop Memory Attention lets each looped layer attend to its own states from previous iterations along the loop-time axis, so the model can revisit earlier computations instead of relying on the latest state alone. A halting head then reads the loop state and predicts whether to continue, with supervision from an oracle that identifies when additional depth still reduces loss. In a controlled MathQA comparison on the same looped backbone, RecurTrace achieves 56.9% accuracy with an average of 2.0 loops, exceeding the best fixed loop depth by 2.2 points at matched compute. By comparison, ACT and PonderNet collapse to one loop, and CALM reaches only 54.1% with 5.6 loops, while the stronger LoopUS-Conf and TaH-Mismatch baselines reach 55.3% at 3.2 loops and 55.7% at 2.1 loops. Finally, RecurTrace improves generation accuracy over same-budget fine-tuned baselines at 0.6B, 1.7B, 4B, and 8B, with the gain growing with model size from 0.6 to 3.4 points.

1 Introduction

A transformer spends the same number of layers on an easy question and on a hard one. This is convenient for training but wasteful at inference. Reasoning quality scales with effective depth, whether the depth comes from stacking more layers, from spelling out a chain of thought in tokens (Wei et al. 2022), or from iterating a block of layers in latent space (Saunshi et al. 2025; Geiping et al. 2025). Among these routes, latent looping increases effective depth without emitting additional reasoning tokens. It adds depth at inference without new parameters or longer outputs, and it leaves the tokenizer and the decoding loop unchanged.

Two problems keep latent looping from delivering on this promise. The first is that the loop forgets. A looped block re-runs the same layers on their own output and passes forward only a single hidden state. Whatever an earlier iteration computed must fit into that state or be overwritten by later

Figure

Figure 1: MathQA accuracy versus mean loop count by halting method (1.7B, 3 training × 8 evaluation seeds). Points are means ±1 SD across training seeds; the dashed line marks the best fixed depth (54.71%). RecurTrace reaches 56.92% at ~2 loops, 1.25 points above TaH-Mismatch. Inset: fixed-depth accuracy peaks at 2 loops.

passes. A loop that cannot consult its own past cannot reason across iterations. The second problem is that the loop cannot budget. Looped models fix the iteration count for the whole dataset, so an easy question gets as many loops as a hard one. Figure 1 shows the cost. On MathQA, a 1.7B looped model peaks at two loops with 54.7% accuracy, stays near 53.6% at the eight-loop training clamp, and falls to 47.5% at sixteen. More loops soon stop helping and then hurt, so no fixed budget suits every input.

For the memory problem, two concurrent efforts attach external stores to looped language models, gated key-value banks in Frey et al. (2026) and a multi-slot buffer with read-write routers in MeSH (Yu et al. 2025), each adding extra parameters and a learned read-write mechanism. For budgeting, Adaptive Computation Time (ACT) (Graves 2016) and PonderNet (Banino, Balaguer, and Blundell 2021) halt under a compute penalty or a geometric prior, confidence rules such as CALM (Schuster et al. 2022) exit once an intermediate state looks certain, and Mixture-of-Recursions gives each token its own recursion depth but trains its routers from scratch (Bae et al. 2025). On a pretrained model whose block is looped, a penalty on extra loops makes halting stop too early, and a confidence threshold makes it stop too late.

Our starting point is that the loop already produces everything both problems require, so no outside machinery is needed. The states it computed on earlier passes are a ready-made memory, and the state it holds now carries evidence about whether another pass will change the answer. Therefore, we propose RecurTrace, which converts a pretrained Qwen3 model (Yang et al. 2025) into a memory-augmented looped reasoner with learned halting. For the forgetting problem, we give every looped layer a Loop Memory Attention module. Along a loop-time axis, each token attends from its current state to its own states from previous loops, so a layer can read what it computed one or two iterations earlier. The module sits beside the existing self-attention, adds few parameters, and mixes no information across token positions, so it cannot leak future tokens. For the budgeting problem, we train a halting head that reads the loop state and predicts whether a deeper loop will still help. Its supervision comes from an oracle that records, for each training example, the depth at which the answer stops improving, a measured target used directly, with no added compute penalty or confidence proxy. At inference the model loops until the head says stop, so depth is set per input rather than fixed across the dataset.

The memory and the halting head need each other. Without the memory, extra loops barely help, so the halting head gains little by running an input longer. Without the halting head, every input gets the same number of loops, so the extra loops the memory makes useful are wasted on easy inputs and denied to hard ones. Figure 1 previews the outcome on MathQA. RecurTrace reaches 56.9% at 2.0 loops, improving on the best fixed loop budget by 2.2 points at a comparable mean depth and beating every adaptive-compute baseline we test, including the recent LoopUS (Park et al. 2026) and Think-at-Hard (Fu et al. 2026b).

RecurTrace is also practical to adopt. All base weights stay frozen, the added modules hold at most about 2.2% of the parameters, and they start out nearly inactive, so a single loop reproduces the pretrained model exactly, a safe floor that more loops build on. Across 0.6B, 1.7B, 4B, and 8B, RecurTrace raises generation accuracy over same-budget baselines at every scale, with the gain growing to 3.4 points at 8B, and lowers teacher-forced loss at all four. Our contributions are:

  • Loop Memory Attention. An attention along the loop-time axis through which every token reads its own states from earlier loops. The looped block stays fully weight-tied and carries no external memory store.

  • Oracle-distilled halting. A sequence-level halting head supervised by whether a deeper loop still lowers the loss, not by a prior, penalty, or confidence rule. It matches or exceeds the best fixed depth across six tasks.

  • One model for every depth. One trained model serves every test-time loop depth, not one model for each budget, and the recipe holds from 0.6B to 8B with accuracy and likelihood gains over same-budget baselines.

References (95)

  • MathQA: Towards Interpretable Math Word Problem Solving with Operation-Based Formalisms
  • ReZero Is All You Need: Fast Convergence at Large Depth
  • Deep Equilibrium Models
  • PonderNet: Learning to Ponder
  • End-to-End Algorithm Synthesis with Recurrent Networks: Extrapolation without Overthinking
  • PIQA: Reasoning about Physical Commonsense in Natural Language
  • BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questions
  • Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge
  • Training Verifiers to Solve Math Word Problems
  • Universal Transformers
  • Depth-Adaptive Transformer
  • W.; Lydersen, S.; and Laake, P. 2013
  • Adaptive Loops and Memory in Transformers: Think Harder or Know More? arXiv:2603.08391 (opens arXiv in a new tab)
  • DiscoLoop: Looping Discrete Embeddings and Continuous Hidden States for Multi-hop Reasoning (opens arXiv in a new tab)
  • Think-at-Hard: Selective Latent Iterations to Improve Reasoning Language Models
  • Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach
  • Did Aristotle Use a Laptop? A Question Answering Benchmark with Implicit Reasoning Strategies
  • Think before You Speak: Training Language Models with Pause Tokens
  • Adaptive Computation Time for Recurrent Neural Networks
  • Training Large Language Models to Reason in a Continuous Latent Space
  • Measuring Massive Multitask Language Understanding
  • Measuring Mathematical Problem Solving with the MATH Dataset
  • Constructing a Multi-hop QA Dataset for Comprehensive Evaluation of Reasoning Steps
  • Depth-Recurrent Attention Mixtures: Giving Latent Reasoning the Attention It Deserves (opens arXiv in a new tab)
  • Encode, Think, Decode: Scaling Test-Time Reasoning with Recursive Latent Thoughts
  • ALBERT: A Lite BERT for Self-Supervised Learning of Language Representations
  • Program Induction by Rationale Generation: Learning to Solve and Explain Algebraic Word Problems
  • Note on the Sampling Error of the Difference Between Correlated Proportions or Percentages
  • Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answering
  • CoTFormer: A Chain of Thought Driven Architecture with Budget-Adaptive Computation Cost at Inference
  • LoopUS: Recasting Pretrained LLMs into Looped Latent Refinement Models (opens arXiv in a new tab)
  • Are NLP Models Really Able to Solve Simple Math Word Problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics
  • Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
  • Mixture-of-Depths: Dynamically Allocating Compute in Transformer-Based Language Models (opens arXiv in a new tab)
  • Solving General Arithmetic Word Problems
  • WinoGrande: An Adversarial Winograd Schema Challenge at Scale
  • Reasoning with Latent Thoughts: On the Power of Looped Transformers
  • Confident Adaptive Language Modeling
  • Can You Learn an Algorithm? Generalizing from Easy to Hard Problems with Recurrent Networks
  • CLUTRR: A Diagnostic Benchmark for Inductive Reasoning from Text
  • Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them
  • ProofWriter: Generating Implications, Proofs, and Abductive Statements over Natural Language
  • MuSiQue: Multihop Questions via Single-hop Question Composition
  • Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • SIM-CoT: Supervised Implicit Chain-of-Thought (opens arXiv in a new tab)
  • Towards AI-Complete Question Answering: A Set of Prerequisite Toy Tasks (opens arXiv in a new tab)
  • DeeBERT: Dynamic Early Exiting for Accelerating BERT Inference
  • Qwen3 Technical Report
  • HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering
  • MeSH: Memory-as-State-Highways for Recursive Transformers (opens arXiv in a new tab)
  • HellasWag: Can a Machine Really Finish Your Sentence? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics
  • PonderLM: Pretraining Language Models to Ponder in Continuous Space
  • Adaptive Test-Time Compute Allocation for Reasoning LLMs via Constrained Policy Optimization (opens arXiv in a new tab)
  • A Survey of Reinforcement Learning for Large Reasoning Models (opens arXiv in a new tab)
  • Scaling Latent Reasoning via Looped Language Models (opens arXiv in a new tab)
  • Every value comes from a logged run
  • Table 1 in the main text lists the architecture of each base and the block we loop
  • Stage 1 trains the loop modules, that is Loop Memory Attention and the input-injection scalars, under the matched same-budget protocol against the baseline
  • The 0.6B and 1.7B loop modules train on the full reasoning mixture for fifteen epochs at a peak learning rate of 1e-4 with a cosine schedule, a global batch of 128 sequences, and a maximum length of 1024 tokens, which after sequence packing is roughly 25 thousand optimizer steps
  • We lower-case and strip whitespace, then remove any training question that exactly matches a test question
  • The four buckets beyond the training range ($k \in \{10, 12, 14, 16\}$, 2 000 instances), each evaluated at a matched loop depth $T=k$, form the extrapolation subset reported in the bottom block of Table 5
  • The answer is the symbol reached after following the mapping $k$ times
  • A rule is one of five atomic operations (assign, swap, increment-mod-4, conditional-set, copy) applied to one or two named registers
  • The answer is the integer obtained after applying all $k$ operations in order
  • For every input we read the residual stream at the final token, the one position that a causal model lets see the whole sequence, and we record each layer's hidden state
  • Values are defaults used across scales
  • Start at MK and follow $k=3$ hops.</td><td>MK → TQ → ZR → VP</td><td>VP</td></tr><tr><td>Symbolic state tracking</td><td>Initial state [2, 0, 1, 3, 0, 2] over registers $r_0$ to $r_5$
  • These three layers sit 15 to 25 percent below their neighbors, while no fourth layer is separated enough to add
  • We therefore compare the deployed early-middle window, layers 15–17, against probe-core and late controls
  • We apply QK-normalization, an RM-SNorm on the per-head queries and keys before their dot product
  • At generation time the halting decision is read once from the prompt state, and the chosen depth is reused for every generated token, so no additional halting decision is made per generated token
  • With target mean $\bar{r} = \text{loop\_train\_mean} - 1$ and log-space deviation $\sigma$, we draw $z \sim \mathcal{N}(\log \bar{r} - \frac{1}{2}\sigma^2, \sigma)$, set $r \sim \text{Poisson}(e^z) + 1$, and clamp $r$ to $[1, \text{loop\_train\_max}]$
  • We use a floor of $T_{\min}=2$ in the main comparison so the halting head cannot collapse to a single loop
  • Counts are three-training-seed means (rounded)
  • The counts here are three-training-seed means; because each seed deepens a different set, they are per-seed averages rather than one fixed set of items
  • >Adaptive</td><td colspan=
  • The 56 wrong-to-right flips and 3 right-to-wrong flips yield a net +53
  • LoopUS-Conf follows the LoopUS confidence recipe (Park et al. 2026): the head is trained with a binary cross-entropy confidence loss plus a monotonicity regularizer that encourages the continue probability to decrease with depth, without any oracle labels
  • The train-covered suite holds the fourteen tasks whose training splits enter the mixture, and the classic suite holds eight standard multiple-choice benchmarks
  • At 1.7B the suite-level numbers match the breadth table in the body
  • Eval items
  • Both NLL $\Delta$ (teacher-forced negative log-likelihood minus the no-loop baseline) and Acc $\Delta$ (generation accuracy, pp) are measured at a fixed two-loop depth, matching Table S12
  • This split is independent of the fixed two-loop baseline used for the paired transition counts, so the $\sim50$ hard items among the $\sim65$ deepened and the 56 wrong-to-right flips against fixed two loops are counted against different references and do not conflict
  • At the main operating point, the conservative threshold stops 97.3% of items at the two-loop floor (Table S5)
  • A lower threshold keeps the halting head looping, which raises the mean depth, lowers the loop-count reduction, and widens the hard-easy gap
  • Hard items receive more loops than easy ones on all eight evaluation seeds, and the mean gap is +0.59 loops
  • Loop cut is the mean loop-count reduction relative to a sixteen-loop budget ($1-T/16$), not total compute
  • At 4B and 8B the pattern strengthens: plain looping drifts to +0.05 and +0.06 nats while memory yields -0.03 and -0.02 nats
  • The memory continuation reaches lower teacher-forced NLL than the matched plain continuation on both seeds, by 0.040 and 0.028 nats at the best loop and by 0.016 and 0.050 nats at four loops
  • Every row averages 3 training seeds (std 0.22, 0.29, 0.33, 0.37 pp from 0.6B to 8B)
  • The likelihood picture is more one-sided, since the capacity control lowers the overall 22-task teacher-forced NLL by only 0.01 nats against that baseline while RecurTrace lowers it by 0.08
  • RecurTrace freezes the base and trains only the loop, memory, and injection modules (≈0.12B, at most 2%) for the same 800 steps with the same optimizer and schedule (Stage 1); the halting head is distilled separately afterwards (Stage 2, Appendix E)
  • >Task</td><td colspan=
  • Base is the same-budget fine-tuned Qwen3-8B baseline, and Loop is RecurTrace